Skip to content

'NoneType' object has no attribute 'SMALL_ICON_SIZE'#80

Open
Saumya-Mishra9129 wants to merge 1 commit intosugarlabs:masterfrom
Saumya-Mishra9129:fixes
Open

'NoneType' object has no attribute 'SMALL_ICON_SIZE'#80
Saumya-Mishra9129 wants to merge 1 commit intosugarlabs:masterfrom
Saumya-Mishra9129:fixes

Conversation

@Saumya-Mishra9129
Copy link
Copy Markdown
Member

The PR should fix #65 . This is based on a regression made by e3f8fa9.

@quozl
Copy link
Copy Markdown
Contributor

quozl commented May 29, 2020

Thanks. Please tell me more about how this solves?

@Saumya-Mishra9129
Copy link
Copy Markdown
Member Author

Thanks. Please tell me more about how this solves?

As specified in #80 we are getting NoneType error on style object. It means it is not imported by system at the time when you tested. We can see in e3f8fa9 that the change I made in
4a3cf3f was removed in e3f8fa9.

@chimosky
Copy link
Copy Markdown
Member

@Saumya-Mishra9129 4a3cf3f uses a try except clause that imports or sets GRID_CELL_SIZE, the issue is with style.SMALL_ICON_SIZE.

@quozl
Copy link
Copy Markdown
Contributor

quozl commented May 30, 2020

@Saumya-Mishra9129 wrote:

As specified in #80

Actually, you mean in #65.

we are getting NoneType error on style object.

Yes. In the toolkit source file src/sugar3/graphics/icon.py.

style was an imported module, as shown by

https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/f0b479f068804db6ab99f38eb79d301fa4580c61/src/sugar3/graphics/icon.py#L106

style was found to be None at the point of the error, which was;

https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/f0b479f068804db6ab99f38eb79d301fa4580c61/src/sugar3/graphics/icon.py#L536

Above code links are from Sugar 0.112.

No code changes style between the import and the error.

We are also getting a RuntimeError: sys.meta_path must be a list of import hooks.

It means it is not imported by system at the time when you tested.

Not so. Firstly, it was imported as shown above, and secondly if it were not imported the error would have been "NameError: name 'style' is not defined".

We can see in e3f8fa9 that the change I made in 4a3cf3f was removed in e3f8fa9.

I see your logic; you are suggesting that the port to GTK 3 and GStreamer 1.0, which removed support for very old versions of the GTK 2 toolkit (before GRID_CELL_SIZE was added), was the cause of the error. You are suggesting that adding back support for very old versions of the GTK 2 toolkit will fix it. However, the error is not reported against the source file you are changing.

Let me offer an alternative speculation;

  • for style object to lose meaning in the scope of icon.py, despite being imported, means that the Python data structures in memory have been corrupted,
  • for sys.meta_path to lose contents in the scope of logger.py, means that the Python data structures in memory have been corrupted,
  • that the code was ported from GTK 2 with static modules to GTK 3 with PyGObject introspection modules suggests that the actual changes in Turtle Art e3f8fa9 may be less important than the changes between GTK 2 and GTK 3, and between static imports and PyGObject introspection imports.

By the way, to reproduce or test this you would need to install Fedora 18 VM with Sugar 0.112 packages. Those packages are available for i386 32-bit architecture from rpmdropbox.laptop.org.

@Saumya-Mishra9129
Copy link
Copy Markdown
Member Author

@Saumya-Mishra9129 wrote:

As specified in #80

Actually, you mean in #65.

we are getting NoneType error on style object.

Yes. In the toolkit source file src/sugar3/graphics/icon.py.

style was an imported module, as shown by

https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/f0b479f068804db6ab99f38eb79d301fa4580c61/src/sugar3/graphics/icon.py#L106

style was found to be None at the point of the error, which was;

https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/f0b479f068804db6ab99f38eb79d301fa4580c61/src/sugar3/graphics/icon.py#L536

Above code links are from Sugar 0.112.

No code changes style between the import and the error.

We are also getting a RuntimeError: sys.meta_path must be a list of import hooks.

It means it is not imported by system at the time when you tested.

Not so. Firstly, it was imported as shown above, and secondly if it were not imported the error would have been "NameError: name 'style' is not defined".

We can see in e3f8fa9 that the change I made in 4a3cf3f was removed in e3f8fa9.

I see your logic; you are suggesting that the port to GTK 3 and GStreamer 1.0, which removed support for very old versions of the GTK 2 toolkit (before GRID_CELL_SIZE was added), was the cause of the error. You are suggesting that adding back support for very old versions of the GTK 2 toolkit will fix it. However, the error is not reported against the source file you are changing.

Let me offer an alternative speculation;

  • for style object to lose meaning in the scope of icon.py, despite being imported, means that the Python data structures in memory have been corrupted,
  • for sys.meta_path to lose contents in the scope of logger.py, means that the Python data structures in memory have been corrupted,
  • that the code was ported from GTK 2 with static modules to GTK 3 with PyGObject introspection modules suggests that the actual changes in Turtle Art e3f8fa9 may be less important than the changes between GTK 2 and GTK 3, and between static imports and PyGObject introspection imports.

By the way, to reproduce or test this you would need to install Fedora 18 VM with Sugar 0.112 packages. Those packages are available for i386 32-bit architecture from rpmdropbox.laptop.org.

Yeah You are probably right. however I think sugar-toolkit-gtk3 is the place which can cause the error because of port from GTK2 to GTK3 . I still need to test it on Fedora because we can't make assumptions.

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.

RuntimeError: sys.meta_path must be a list of import hooks, AttributeError: 'NoneType' object has no attribute 'SMALL_ICON_SIZE'

3 participants