4815162342lost / steam_gifts_bot

bot for http://www.steamgifts.com/
GNU General Public License v3.0
32 stars 6 forks source link

gi doesn't work properly with python3 #6

Closed ghost closed 5 years ago

ghost commented 7 years ago
blah@bleh:~ $ sudo pip3 install requests bs4 datetime notify2 gi
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python3/dist-packages
Requirement already satisfied (use --upgrade to upgrade): bs4 in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): datetime in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): notify2 in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): gi in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in /usr/local/lib/python3.4/dist-packages (from bs4)
Cleaning up...
blah@bleh:~/sgbot $ ./sg.py
Traceback (most recent call last):
  File "./sg.py", line 15, in <module>
      import gi
  File "/usr/local/lib/python3.4/dist-packages/gi/__init__.py", line 39 
    print url
SyntaxError: Missing parentheses in call to 'print'
4815162342lost commented 7 years ago

Hello!

Very strange, all OK on Ubuntu.

Please, try to install this module from repository if you are using Ubuntu: sudo apt install python3-gi

If you not using Ubuntu, please, provide your distr.

ghost commented 7 years ago

I'm running this bot on an RPi3 based on Debian 8.0. And yes, this is indeed a strange occurrence as I did not modify anything python-related on that machine.

I purged all required modules and reinstalled them manually via apt.

python3         3.4.2-2
python3-requests    2.4.3-6
python3-bs4     4.3.2-2
python3-notify2     0.3-3
python3-gi      3.14.0-1

datetime is not on the list since it's an integrated module and 4.2 is already installed in /usr/local/lib/python3.4/dist-packages so I didn't bother with that any further.

Nonetheless same old story as in my first post. import gi... __init__.py... line 39... syntax error... missing parentheses blablabla... Ok then, manually adding these is not exactly rocket science. Next try aaaand- nope.

blah@bleh:~/sgbot $ ./sg.py
Traceback (most recent call last):
  File "./sg.py", line 16, in <module>
    gi.require_version('GdkPixbuf', '2.0')
AttributeError: 'module' object has no attribute 'require_version'

Well, at least it's not line 15 anymore. /s

4815162342lost commented 7 years ago

hello,.

Please, read: https://github.com/enkore/i3pystatus/issues/314

If previous solution did not work, please, try to delete these lines from script and try again:

if platform.system()=="Linux": import notify2 import gi gi.require_version('GdkPixbuf', '2.0') from gi.repository.GdkPixbuf import Pixbuf pb=Pixbuf.new_from_file("icon.png")

Thanks.

ghost commented 7 years ago

I commented that area out and it seems to work well so far. The bot runs on a headless machine so excluding notify2 is not a big loss in that case. Thanks for the help!

A question regarding search list. Do the names have to be an exact copy of how they are displayed on SG? Some of them have an unusual char length and get cropped with a ... at the end like Title: Something Something Game of the... which supposedly is Title: Something Something Game of the Year Edition.

4815162342lost commented 5 years ago

Support of the Debian 8.0 will be end in May. So, close the topic.