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

Fix unable to start Medusa due to configparser ImportError #5145

Merged
merged 6 commits into from
Sep 9, 2018

Conversation

sharkykh
Copy link
Contributor

@sharkykh sharkykh commented Sep 8, 2018

Fixes #5137

I had a hunch that the .pth file I got when installing the package locally was important.
I can try to explain the fix better later, if anyone is interested, but basically site.addsitedir adds a path to sys.path, plus it handles these files if any are found on the path.
However it uses appends and not insert, that's why we need to rebuild sys.path like in the new code.

https://bugs.python.org/issue7744

Fix `configparser`s package structure.
Add missing `.pth` file for configparser
`.pth` file renamed for simplicity - original name: `configparser-3.5.0-py2.7-nspkg.pth`.
@sharkykh sharkykh added this to the 0.2.10 milestone Sep 8, 2018
@sharkykh sharkykh added Needs review and removed Changelog Requires a changelog entry Do not merge labels Sep 8, 2018
@sharkykh sharkykh modified the milestones: 0.2.10, 0.2.10 (Hotfix) Sep 8, 2018
@sharkykh sharkykh mentioned this pull request Sep 8, 2018
8 tasks
p0psicles
p0psicles previously approved these changes Sep 9, 2018
@p0psicles p0psicles merged commit a1e7e1a into develop Sep 9, 2018
@p0psicles p0psicles deleted the bugfix/configparser-better-syspath-develop branch September 9, 2018 12:09
p0psicles pushed a commit that referenced this pull request Sep 9, 2018
* Fix `_configure_syspath` to handle `.pth` files

Fix `configparser`s package structure.
Add missing `.pth` file for configparser
`.pth` file renamed for simplicity - original name: `configparser-3.5.0-py2.7-nspkg.pth`.

* Explain the code better

* Update info on `ext/readme.md`

* Prepare `syspath` code for the future

* Update changelog
@hobeone
Copy link

hobeone commented Sep 17, 2018

This doesn't seem to work if you have configparser installed with a system package:

Traceback (most recent call last):
  File "/opt/medusa/start.py", line 6, in <module>
    from medusa.__main__ import main
  File "/opt/medusa/medusa/__main__.py", line 67, in <module>
    from medusa import (
  File "/opt/medusa/medusa/name_cache.py", line 12, in <module>
    from medusa.scene_exceptions import (
  File "/opt/medusa/medusa/scene_exceptions.py", line 13, in <module>
    import adba
  File "/opt/medusa/ext/adba/__init__.py", line 27, in <module>
    from configparser import ConfigParser
  File "/opt/medusa/ext/configparser.py", line 12, in <module>
    from backports.configparser import (
ImportError: cannot import name ConverterMapping

After running apt-get remove python-configparser medusa starts as normal.

This is on Debian testing. I ran git reset --hard origin/master to make sure everything was up to date but removing the system package was the only thing that got it working.

Debian package info:

Package: python-configparser
Source: configparser
Version: 3.5.0b2-1

@sharkykh
Copy link
Contributor Author

@hobeone
Unfortunately I don't have a way of testing this, but can you try re-adding this file:
https://github.com/pymedusa/Medusa/raw/31171bc896108a52f80cfd90f3c70f0baf205db2/ext/backports/__init__.py
Save it to /opt/medusa/ext/backports/__init__.py
Reinstall the python-configparser system package and try to run medusa.

@sharkykh
Copy link
Contributor Author

Also I must say,
that debian package seems to be out of date with the actual library version and that's probably the reason for the issue: Current library version is 3.5.0 (it's out of beta) - 3.5.0b2 is from 2014.
If you still want to use the system package over installing a user package with pip,
I suggest contacting the debian pkg maintainer(s) to bump the version.
https://packages.debian.org/sid/python-configparser

@hobeone
Copy link

hobeone commented Sep 18, 2018

Adding that init.py file doesn't seem to fix it. I get the same error code when starting.

I think you're right about the package being too old. When I get a second I'll see about filing a request to update it.

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

Successfully merging this pull request may close these issues.

3 participants