SchemaSync icon indicating copy to clipboard operation
SchemaSync copied to clipboard

Cannot run via `pipx`

Open stephenreay opened this issue 1 year ago • 1 comments

After the 'simple' fixes in #68 schemasync seems to run properly under python3 again, but when trying to install it as a global tool we're advised to no longer use sudo pip install but instead to use pipx (with some other hoop jumping to get a truly global install).

However something isn't quite right when it's installed this way, but I can't quite tell what.

Using schemasync from a pipx install (using a local copy of the repo with the fixes applied in #68 as the source) gives:

Traceback (most recent call last):
  File "/home/vagrant/.local/bin/schemasync", line 5, in <module>
    from schemasync.schemasync import main
  File "/home/vagrant/.local/pipx/venvs/schemasync/lib/python3.11/site-packages/schemasync/schemasync.py", line 9, in <module>
    import syncdb
ModuleNotFoundError: No module named 'syncdb'

The schemasync executable at /home/vagrant/.local/bin/schemasync contains this:

#!/home/vagrant/.local/pipx/venvs/schemasync/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from schemasync.schemasync import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

Even weirder, if I just execute the main schemasync.py file directly using that env's python, it works fine:

/home/vagrant/.local/pipx/venvs/schemasync/bin/python /home/vagrant/.local/pipx/venvs/schemasync/lib/python3.11/site-packages/schemasync/schemasync.py 

Python isn't really my deal, I'm just trying to make this tool work for a client's project. It'd be great if someone a little more knowledgeable in Python could look into this. I don't have unlimited time to mess around with it, but if there are suggestions of what to try, I can do so, within reason.

stephenreay avatar Mar 28 '24 19:03 stephenreay

I'll check it in a days maybe but if you fix it and make PR I'll accept it.

mitsh avatar Mar 29 '24 01:03 mitsh