I am writing a Python script to leverage the installation of a big project. I would like to make a single executable .py
script, that once called, it will do everything needed (it will basically be a wrapper for bash commands, with added error handling and user input). However, I need some third party modules (such as envoy
)...how can I include them in order to be usable from within my script?
Asked
Active
Viewed 140 times
0

linkyndy
- 17,038
- 20
- 114
- 194
-
this seems to give some info on this http://www.coderanch.com/t/600754/Jython-Python/python-equivalent-Java-jar-file is seems like an egg file is the way to go – jgr208 Nov 12 '14 at 13:52
-
I assume you ask it because you don't want to be relay on what that is previously installed in the server. You can add all the dependencies to the script folder and deploy them together with your script zip file. Another but maybe a better option is using py2exe – asafm Nov 12 '14 at 14:28
-
So you are suggesting to create a shell file, install all Python modules from there, then execute my Python script? – linkyndy Nov 12 '14 at 14:31
1 Answers
0
Assuming that the 3rd party modules are not already installed, and you don't want to include them with the python script, you could use urllib2 to download the modules when the user runs the script: How do I download a file over HTTP using Python?
-
It's a bit cumbersome to search some modules on PyPI, download them and place them in the same folder to be able to use them...thought it would be a cleaner approach. – linkyndy Nov 12 '14 at 16:24
-
Yes. It would be easier still to distribute them with the python installation script, as suggested by some of the other replies above, but I wasn't sure if you were trying to avoid that. – Dew Nov 13 '14 at 12:29
-
I was looking for the best way of doing this, but if this is it...probably I'll go with it. – linkyndy Nov 13 '14 at 13:01