vendredi 29 mai 2015

Run a setup.py from another Python script, path issue, installing in calling script dir?

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 :)

Aucun commentaire:

Enregistrer un commentaire