How to call a script from another?
Jaime Wyant
programmer.py at gmail.com
Thu Oct 13 10:45:29 EDT 2005
I think this is the simplest way to do that:
import sys
sys.path.append('/path/to/directory/containg/script')
import zopescript
zopescript.main()
The code above assumes:
o that the path you use to append contains an __init__.py in it...
o zopescript is the module you want to `run'
o main is the method in zopescript that cranks up zope.
I'm not sure of how to do it the hard way...
jw
On 10/13/05, Christian <christian at spam.no> wrote:
> From a not even newbie:
>
> Without knowing much about Python (yet) I'm trying to install the CMS
> Zope via FTP (with the well documented changes to make it work on an
> Apache server).
> By birth Zope is started from a shell script. And not having the
> permissions to execute such ones I'll try writing a .py script (with the
> shebang that I allready knows will do the job) to call another .py
> script like the original shell script does.
>
> So my question is:
> How do I call a .py script from another .py script?
> (Writing the rest - I hope - is piece of cake ;-) ).
>
> (And yes, I know that there are a lot of other problems but for starters
> I just would like to try to call a .py script from another .py script.)
>
>
> Thanks
>
> Chris
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list