JamesTheLibrarian
Posts: 2
Joined: Fri Jul 07, 2017 4:46 am

Another noob: Traceback Error in Python 2

Thu Aug 10, 2017 6:05 am

Howdy all!

I've been lurking for awhile and have learned quite a bit and I really appreciate how open and patient the community is here. I'm hoping you can keep that patience and assist me with figuring out what this error I'm getting means.

I'm running code based on the bot_mccloud Twitter feed found here: https://github.com/mkremins/bot_mccloud

I figured out the syntax errors I was getting were because I was running Python 3 instead of Python 2 (thanks to searching here) and have managed to get threshold.py to work correctly but when I run panelize.py I get the following error in the shell:

Code: Select all

Traceback (most recent call last):
  File "/home/pi/Desktop/Twitter API/panelize.py", line 105, in <module>
    panelize(page_path)
  File "/home/pi/Desktop/Twitter API/panelize.py", line 90, in panelize
    panel_bounds = find_panel_bounds(thresholded)
  File "/home/pi/Desktop/Twitter API/panelize.py", line 76, in find_panel_bounds
    bounds_1 = find_row_bounds(image, (0, 0, image.width, image.height))
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 608, in __getattr__
    raise AttributeError(name)
AttributeError: width
I had left a message on the GitHub page and forgotten about it, but it had been a couple weeks so I thought I'd reach out here as well.

Thanks in advance for any help on this and thanks so much for such a robust and interesting forum. There's so much I never knew I wanted to learn how to do until I arrived here.

User avatar
MrYsLab
Posts: 74
Joined: Mon Dec 15, 2014 7:14 pm
Location: Noo Joysey, USA

Re: Another noob: Traceback Error in Python 2

Thu Aug 10, 2017 3:42 pm

From the traceback, it looks like pil is located in the python 2.7 dist-packages directory. Are you using Python 3? Also, be aware the the original PIL is not python 3 compatible. You would nee to use pillow https://github.com/python-pillow/Pillow

bensimmo
Posts: 1909
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Another noob: Traceback Error in Python 2

Thu Aug 10, 2017 3:49 pm

I think it is saying 'image' has no .width (and probably no . height ) attribute it can use.

bensimmo
Posts: 1909
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Another noob: Traceback Error in Python 2

Thu Aug 10, 2017 3:53 pm

It could be PIL is some versions behind what is needed?

JamesTheLibrarian
Posts: 2
Joined: Fri Jul 07, 2017 4:46 am

Re: Another noob: Traceback Error in Python 2

Thu Aug 10, 2017 4:14 pm

MrYsLab wrote:
Thu Aug 10, 2017 3:42 pm
From the traceback, it looks like pil is located in the python 2.7 dist-packages directory. Are you using Python 3? Also, be aware the the original PIL is not python 3 compatible. You would nee to use pillow https://github.com/python-pillow/Pillow
Hi,

I was using Python 3 until I realized the original file was written in 2.

I *thought* I had Pillow, but I'll start there and see where it gets me.

Thank you.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 29 guests