pyotherside icon indicating copy to clipboard operation
pyotherside copied to clipboard

addImportPath with qrc paths broken

Open wasular opened this issue 3 years ago • 2 comments

I am currently trying to run pyotherside in a project on MacOs Monteray and QT 5.15.2 but I can't quite get this specific issue solved ... anyone here an idea ... On Windows and Linux it runs like a charm

Python Version via pyenv 3.9.6

Got library name:  "/opt/homebrew/Cellar/qt@5/5.15.2_1/qml/io/thp/pyotherside/libpyothersideplugin.dylib"
qml: Added Handler
"PyOtherSide error: Traceback (most recent call last):

  File \"<frozen importlib._bootstrap>\", line 919, in _find_spec
AttributeError: 'PyOtherSideQtRCImporter' object has no attribute 'find_spec'

During handling of the above exception, another exception occurred:

ImportError: PyCapsule_Import could not import module \"datetime\"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File \"<frozen importlib._bootstrap>\", line 1007, in _find_and_load
  File \"<frozen importlib._bootstrap>\", line 982, in _find_and_load_unlocked
  File \"<frozen importlib._bootstrap>\", line 921, in _find_spec
  File \"<frozen importlib._bootstrap>\", line 895, in _find_spec_legacy
  File \"qrc://io/thp/pyotherside/qrc_importer.py\", line 26, in find_module
  File \"qrc://io/thp/pyotherside/qrc_importer.py\", line 38, in get_filename
SystemError: <built-in function qrc_is_file> returned a result with an error set

Unhandled PyOtherSide error: Cannot import module: bridge (Traceback (most recent call last):

  File "<frozen importlib._bootstrap>", line 919, in _find_spec

AttributeError: 'PyOtherSideQtRCImporter' object has no attribute 'find_spec'`

wasular avatar Nov 16 '21 18:11 wasular

The issue seems to be clearly around putting a qrc path into addImportPath , trying to figure out how to circumvent this but since general python libs seem to work it is probably not directly related to the ARM processor architecture

wasular avatar Nov 17 '21 17:11 wasular

Looks like _find_spec / find_spec has been added in Python 3.4?

https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder.find_spec

Are you sure you have the right bundled/frozen importlib/standard library?

thp avatar Feb 20 '23 15:02 thp