Hello! Years ago I wrote a ST package that adds perforce support and I’m trying to get it up and running at a new workplace. (I’m aware there’s another existing perforce package available via Package Manager.) I’m in ST build 4169 on linux.
The perforce python API is implemented in two files, P4.py
and P4API.cpython-39-x86_64-linux-gnu.so
. The P4 module itself does an import P4API
internally.
At the top of my package I have from P4 import P4
and a print (sys.path)
which produces this output in the ST console:
reloading python 3.3 plugin PerforcePlus.PerforcePlus
reloading plugin ... etc ...
PATH: ['/opt/sublime_text/Lib/python3.3.zip', '/opt/sublime_text/Lib/python33', '/opt/sublime_text/Lib/python3', '/home/megatron/.config/sublime-text/Lib/python33', '/opt/sublime_text/Packages', '/home/megatron/.config/sublime-text/Packages']
So I tried putting those two files in the home dir .config python33 path. My import P4
succeeds, but the module’s own import P4API
fails:
File "/home/megatron/.config/sublime-text/Packages/PerforcePlus/PerforcePlus.py", line 17, in <module>
from P4 import P4, P4Exception
File "/home/megatron/.config/sublime-text/Lib/python33/P4.py", line 420, in <module>
import P4API
ImportError: No module named 'P4API'
Anybody know how I might fix this? I don’t know anything about how python uses .so
files, but simply installing them next to each other works just fine in regular old python in the shell.
Incidentally I also tried appending to sys.path rather than copying the module somewhere in the ST path and had the same problem: the P4 import succeeds but the P4API import fails.
(Side question: when I print sys.path
in the ST console, it shows python38 paths instead of 33. Why is that? Also why does ST appear to load my package as 3.3? Don’t know if that’s related to my problem, just curious.)