Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pyce/_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ def get_code(self, fullname: str) -> Any:
path = self.get_filename(fullname)
data = self.get_data(path)

# Relative paths are impossible on Windows if the target file is on a different drive letter to the working directory
try:
r_path = relpath(path)
except:
# well, we tried
r_path = path
# It is important to normalize path case for platforms like Windows
data = decrypt(data, PYCEPathFinder.KEYS[normcase(relpath(path))])
data = decrypt(data, PYCEPathFinder.KEYS[normcase(r_path)])

# Call _classify_pyc to do basic validation of the pyc but ignore the
# result. There's no source to check against.
Expand Down