Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing parentheses in call to 'print' (last_social_activity.py, line 128) #3

Open
msbt opened this issue Jul 8, 2017 · 3 comments

Comments

@msbt
Copy link

msbt commented Jul 8, 2017

Hey there!
I'm having issues setting up last-social-activity, is it possible that this doesn't work with python 3.5+? As soon as I add it in INSTALLED_APPS I'm getting

Missing parentheses in call to 'print' (last_social_activity.py, line 128)

which refers to
print e

When I change that to
print (e)

it says

Invalid template library specified. ImportError raised when trying to load 'last_social_activity.templatetags.last_social_activity': No module named 'httplib'

Any idea what I might be doing wrong and/or might be the issue here?

Best regards,
M

@mbarchein
Copy link
Member

You are running Python 2 code on Python 3. In Python 3, the module has been renamed to http.client. See this: https://stackoverflow.com/a/13778285

@msbt
Copy link
Author

msbt commented Jul 11, 2017

Hey, thanks for getting back and for the hint with http.client. This brings me one step further. Had to change the line in all social networks and in fiveHundred some more brackets to print (media).

Now it throws one more error, probably related to the httplib aswell. Could you give me one more pointer how to solve this?

name 'HttpError' is not defined

in last_social_activity\social_networks\fiveHundred.py in get_last_media, line 49 which is

except (HttpError, HTTPException, ValueError) as e:

I'm guessing this is related to the urllib imports (https://stackoverflow.com/questions/15600707/python-exception-not-recognized-how-to-handle-with-except), but I tried a few options and couldn't get it to work :/

Best regards, M

@msbt
Copy link
Author

msbt commented Jul 16, 2017

Ok I took another look at it and apparently the casing of HTTPError was off, renaming that line to

except (HTTPError, HTTPException, ValueError) as e:

brought me one step further, the next error is

local variable 'url' referenced before assignment

in last_social_activity\social_networks\fiveHundred.py in get_last_media, line 47, which is "response = urlopen(url)"

Any idea what I could do to fix that? Already tried adding

from urllib.error import HTTPError

for python3 compatibility, but still no go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants