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

port to python3 #10

Closed
wants to merge 4 commits into from
Closed

port to python3 #10

wants to merge 4 commits into from

Conversation

ayushnawal
Copy link
Contributor

Tested

@ayushnawal
Copy link
Contributor Author

@quozl please review!

@quozl
Copy link
Contributor

quozl commented Jan 20, 2020

Thanks. Tested. Makes an error before and after porting. Please fix the error.

@ayushnawal
Copy link
Contributor Author

I didn't get an error before, but when you said so i tested it extensively and somehow got this in my traceback

Traceback (most recent call last):
File "/home/ayush/activities/pukllanapac/PukllanapacActivity.py", line 186, in change_play_mode_cb
GAME_ICONS[self._play_mode])
File "/home/ayush/activities/pukllanapac/grid.py", line 56, in initialize_cards
self.card_table[i].set_orientation(
IndexError: list index out of range

As you didn't mention the error, is this what you were talking about?

tried to fix it, not getting this error now.

@quozl
Copy link
Contributor

quozl commented Jan 23, 2020

No, this was the error;

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Pukllanapac.activity/window.py", line 122, in _button_release_cb
    gobject.timeout_add(3000, self.activity.change_play_level_cb,
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 72, in __getattr__
    raise AttributeError(_static_binding_error)
AttributeError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject". See: https://bugzilla.gnome.org/show_bug.cgi?id=709183

@ayushnawal
Copy link
Contributor Author

Although I didn't encounter this error but fixed it as suggested by logs displayed by you.

To be sure, used this

Tested.

@quozl
Copy link
Contributor

quozl commented Jan 24, 2020

Wording we use in other activities in this classification is "is not part of the Sugar desktop, but can be added."

Tested.

Fixes #11.

Reviewed.

@ayushnawal
Copy link
Contributor Author

Done.

Closes #11

@chimosky
Copy link
Member

Tested, I get this error

Traceback (most recent call last):
  File "/home/ibiam/Activities/pukllanapac/PukllanapacActivity.py", line 186, in change_play_mode_cb
    GAME_ICONS[self._play_mode])
  File "/home/ibiam/Activities/pukllanapac/grid.py", line 60, in initialize_cards
    x, y, 'hexagon'))
  File "/home/ibiam/Activities/pukllanapac/card.py", line 42, in __init__
    card_dim * scale))
  File "/home/ibiam/Activities/pukllanapac/card.py", line 20, in load_image
    return Pixbuf.new_from_file_at_size(file, int(w), int(h))
gi.repository.GLib.Error: rsvg-error-quark: Error displaying image (2)
1579874613.941253 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sugar3/activity/activity.py", line 1277, in _prepare_close
    self.save()
  File "/usr/local/lib/python2.7/dist-packages/sugar3/activity/activity.py", line 978, in save
    self.write_file(file_path)
  File "/home/ibiam/Activities/pukllanapac/PukllanapacActivity.py", line 97, in write_file
    self.win.grid.card_table[self.win.grid.grid[i]].orientation)
IndexError: list index out of range

The error referring to the hexagon select game button occurs before and after the port.

@ayushnawal
Copy link
Contributor Author

@chimosky if you don't mind, can you please provide steps to reproduce this error because I am not getting this in my logs again 😬

@quozl
Copy link
Contributor

quozl commented Jan 29, 2020

@chimosky, your traceback contains /usr/local/lib/python2.7/dist-packages/sugar3/activity/activity.py and this suggests wrong Python interpreter was used in test. Please try again?

@@ -48,7 +48,7 @@ def initialize_cards(self, sprites, path, card_dim, scale, shape):
for c in self.card_table:
c.spr.hide()
self.card_table = []
for i in self.grid:
for i in range(0,24):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change at this point seems unintuitive. It was made in 20aca72. Could you explain the change further?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont agree with change made in 20aca72 . There is no need to do that the loop is already running with length of self.grid times.

@chimosky
Copy link
Member

@chimosky, your traceback contains /usr/local/lib/python2.7/dist-packages/sugar3/activity/activity.py and this suggests wrong Python interpreter was used in test. Please try again?

Yes, tested again and this is the traceback gotten when Select game button is clicked.

Traceback (most recent call last):
  File "/home/ibiam/Activities/pukllanapac/PukllanapacActivity.py", line 186, in change_play_mode_cb
    GAME_ICONS[self._play_mode])
  File "/home/ibiam/Activities/pukllanapac/grid.py", line 60, in initialize_cards
    x, y, 'hexagon'))
  File "/home/ibiam/Activities/pukllanapac/card.py", line 42, in __init__
    card_dim * scale))
  File "/home/ibiam/Activities/pukllanapac/card.py", line 20, in load_image
    return Pixbuf.new_from_file_at_size(file, int(w), int(h))
gi.repository.GLib.Error: rsvg-error-quark: Error displaying image (2)
1589330744.852411 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/activity.py", line 1277, in _prepare_close
    self.save()
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/activity.py", line 978, in save
    self.write_file(file_path)
  File "/home/ibiam/Activities/pukllanapac/PukllanapacActivity.py", line 97, in write_file
    self.win.grid.card_table[self.win.grid.grid[i]].orientation)
IndexError: list index out of range

@JuiP
Copy link
Member

JuiP commented May 13, 2020

I'm getting the same errors. I will try fixing them in #13. I think I will use the changes made by @ayushnawal and will cherry-pick commits along with other fixes in #13

@quozl
Copy link
Contributor

quozl commented May 14, 2020

@JuiP, please do fix the error in master before porting. You will need to use a Python 2 capable environment.

@Saumya-Mishra9129
Copy link
Member

We can close this now.

@quozl
Copy link
Contributor

quozl commented May 21, 2020

i agree. thanks @ayushnawal!

@quozl quozl closed this May 21, 2020
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

Successfully merging this pull request may close these issues.

5 participants