[Tutor] cgi cross import problem

pan at uchicago.edu pan at uchicago.edu
Thu May 6 05:57:18 EDT 2004


I have 2 modules:

mod1.py
mod2.py

Each is used for cgi, so they both start with:

#!C:\python22\python.exe
print 'Content-type: text/html'
print

And they both perform cgi function normally. 

Now, in mod2, I want to use the classes in mod1, so in mod2 I added:

import mod1

Unfortunately, this import results in a 'Content-type: text/html'
showing up as the first line on the webpage when calling mod2.py. 

I tried to import only the class I need:

from mod1 import MyClass

But the 'Content-type: text/html' still shows up.

Can I avoid this in any way??? 
(certainly, I want both mod1 and mod2 able to perform cgi normally)

thx in advance.

pan



More information about the Tutor mailing list