You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When processing the .pth file I get the following error before the main module is even started. On windows executing the startup code via .pth is no problem. I guess that java.chaquopy.import_override modifies some behavior, so that _socket is not loaded when executing my startup code.
...
W/python.stderr: Error processing line 1 of /data/data/com.example.helloworld/files/chaquopy/AssetFinder/app/__briefcase_startup__.pth:
W/python.stderr:
W/python.stderr: Traceback (most recent call last):
W/python.stderr: File "<frozen site>", line 206, in addpackage
W/python.stderr: File "<string>", line 1, in <module>
W/python.stderr: File "import.pxi", line 60, in java.chaquopy.import_override
W/python.stderr: File "/data/data/com.example.helloworld/files/chaquopy/AssetFinder/app/__briefcase_startup__.py", line 4, in <module>
W/python.stderr: import socket
W/python.stderr: File "stdlib/socket.py", line 52, in <module>
W/python.stderr: ModuleNotFoundError: No module named '_socket'
W/python.stderr:
W/python.stderr: Remainder of file ignored
D/MainActivity: Running main module helloworld
...
sys.path correctly follows the dependency order (app, requirements, stdlib). However, initialization should happen in the reverse order, low level to high level. And in case .pth files scan the whole of sys.path, maybe we should create all path entries before running any .pth files. In which case, the order would be:
Add all sys.path entries, without running any code from those paths.
Run site.addsitedir in the order (stdlib, requirements, app)
Activity
mhsmith commentedon Mar 3, 2025
sys.pathcorrectly follows the dependency order (app, requirements, stdlib). However, initialization should happen in the reverse order, low level to high level. And in case .pth files scan the whole ofsys.path, maybe we should create allpathentries before running any .pth files. In which case, the order would be:sys.pathentries, without running any code from those paths.site.addsitedirin the order (stdlib, requirements, app)[-]site.addsitedir order is incorrect[/-][+]`site.addsitedir` order is incorrect[/+]