First, I've found how to call a script from within an other script in Python, the call works perfectly well, but here's the problem I'm running into :
In order to easy-install my web-app (Bottle) on an another server, I packed inside a /redist rep, with mod_wsgi and PyMySQL source files. What I'm trying to achieve is a kind of "setup.py" file, that will launch the /mod_wsgi/setup.py install file and the same with the PyMySQL setup file.
Here's what I'm doing for PyMySQL for example :
subprocess.call("python3 ./redist/PyMySQL/setup.py install", shell=True)
The instalation runs fine, BUT, I end up with a /build
, a /dist
and a /PyMySQL.egg-info
folders in my app directory, and when I'm trying to launch anything that imports PyMySQL, it told me that the module didn't exist.
If I manually install it (using my terminal I mean, like cd /redist/PyMySQL/
and then py3 setup.py install
), it works great, and the import will then work ...
Any idea ? Am I doing something wrong ?
By advance, thanks :)
I think this would solve your issue : Python specify popen working directory via argument
I suppose in the "./redist/PyMySQL/" directory could be used as parameter because it is where the setup.py is located
try this :
subprocess.Popen("py3 setup.py", cwd='/redist/PyMySQL/')
on my end this works :
subprocess.Popen(['py3','setup.py'], cwd='path-of-my-setup')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.