470,591 Members | 1,586 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

cgi error

hi
I have a little function to use ftputil module to get a file from a
server

def getfile(filename):
import ftputil
host = ftputil.FTPHost(svr, usr,pswd)
host.chdir("/somewhere")
try:
host.download(filename,filename,"a")
except ftputil.FTPError,v:
print v

It works fine when i run it in python , but it won't run when i run my
cgi script
It says AttributeError: 'module' object has no attribute 'FTPHost'
what could be a possible cause? thanks.

Mar 31 '06 #1
2 1126
I'm not sure, but in your CGI script, where you have
import cgi
or
import cgi
import cgitb; cgitb.enable()
there sometimes come error if place any other modules over it.
I don't now if it is that, 'cus i don't have seen more of your code.
so if your code is:
importFTPHost
import cgi
import cgitb; cgitb.enable()
#Some code here
# and here
... then prove this:
import cgi
import cgitb; cgitb.enable()
import FTPHost
#Some code here
# and here

Mar 31 '06 #2

<s9************@yahoo.com> wrote in message
news:11**********************@z34g2000cwc.googlegr oups.com...
It works fine when i run it in python , but it won't run when i run my
cgi script.

It says AttributeError: 'module' object has no attribute 'FTPHost'
what could be a possible cause? thanks.


Perhaps you called your script 'ftputil'. If so, 'import ftputil' won't
import the standard library version.
Mar 31 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Gregory | last post: by
7 posts views Thread by p | last post: by
3 posts views Thread by Manuel | last post: by
1 post views Thread by developer | last post: by
reply views Thread by mchuc7719 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.