python script question

Erik Max Francis max at alcyone.com
Mon Oct 21 16:46:20 EDT 2002


Ken wrote:

> Hi all, just like to ask if python CGI script can be mix with python
> Shell
> script?
> 
> I.e. if:
> file1 is CGI (#!/usr/local/bin/python)
> and file2 is shell script (#!/bin/sh)
> 
> can I have "import file2" inside file1 and use the functions inside
> file2?

No.  You want os.system or some variant.

The import statement in Python is _only_ for importing Python modules.

> Also, does the shell script have *.py extension?

If it did and tried to import it you'd get some interesting syntax
errors.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ I want a martini that could be declared a disaster area.
\__/ Capt. Benjamin "Hawkeye" Pierce
    Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
 A new, virtual planet, every day.



More information about the Python-list mailing list