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 hacky imports causing clash with libplist #43

Merged
merged 1 commit into from Jun 24, 2020

Conversation

hchargois
Copy link
Contributor

The bare import plist in Scripts/plistwindow.py was supposed to import the plist.py module in the same (Scripts) package. However, if the libplist package was installed on the system, it actually imported the system's plist.so.

This kind of import (import X to import the module X in the same package) is called implicit relative import and according to PEP8, it should never be used. It isn't even supposed to work anymore in Python 3, but in this case, there was a hack to emulate it by adding the current package to the search path, making it a global import. However, the system packages took precedence.

I replaced it with a relative import.

I've tested that it works with both Python 2(.7) and 3(.8).

This should correctly fix #19, #22, #28, #31, without people having to remove their libplist system package.

@corpnewt
Copy link
Owner

Thanks for the explanation and PR on this.

-CorpNewt

@corpnewt corpnewt merged commit edb10ca into corpnewt:master Jun 24, 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.

Saves blank plists on python 3 (Arch Linux)
2 participants