Fix hacky imports causing clash with libplist #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The bare
import plist
inScripts/plistwindow.py
was supposed to import theplist.py
module in the same (Scripts
) package. However, if thelibplist
package was installed on the system, it actually imported the system'splist.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.