Ticket #956 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

misc.addons does not import

Reported by: mitar Owned by: matija
Milestone: 2.6 Component: other
Severity: minor Keywords:
Cc: Blocking:
Blocked By:

Description

I get this error on Debian:

>>> import orngStat
/usr/lib/python2.7/dist-packages/orange/Orange/__init__.py:90: UserWarning: Could not import: misc.addons
  _import("misc.addons")

misc.addons is available in Orange module, but Orange itself is not in Python path. Probably there should be _import("Orange.misc.addons")?

Change History

comment:1 Changed 3 years ago by mitar

Update: I get this error only when having installation without Orange canvas (only Orange library).

comment:2 Changed 3 years ago by mitar

OK. It was an agreement that everything that goes to library package starts with orng. It seems there are some files which do not (like fileutil.py). Matija, can you provide me with a list of files which should be moved to library package which you added to root dir?

comment:3 Changed 3 years ago by mitar

OK, adding fileutil.py helps, but now import of misc.addons fails with:

>>> import Orange.misc.addons
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Orange/misc/addons.py", line 1862, in <module>
    load_repositories(refresh=False)
  File "Orange/misc/addons.py", line 1500, in load_repositories
    listFileName = repository_list_filename()
  File "Orange/misc/addons.py", line 1483, in repository_list_filename
    canvasSettingsDir = os.path.realpath(Orange.misc.environ.canvas_settings_dir)
  File "/usr/lib/python2.7/posixpath.py", line 358, in realpath
    if isabs(filename):
  File "/usr/lib/python2.7/posixpath.py", line 53, in isabs
    return s.startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'

Problem is that Orange.misc.environ.canvas_settings_dir does not exist as canvas is not installed. Could we have add-on settings stored in non-canvas related dir?

comment:4 Changed 3 years ago by matija

  • Status changed from new to closed
  • Resolution set to fixed

The code is fixed so that the add-on repository list resides in the Orange settings directory instead of Canvas settings directory. If the file in the new location does not exist, but it does exist in the old location (Canvas settings directory), Orange.misc.addons module moves the file to the new location. If that fails with an exception, it is silently ignored.

I'm closing this ticket as fixed; you may reopen it if you find that the issue persists in some other form or if you don't feel like my solution is adequate.

Note: See TracTickets for help on using tickets.