cgi error

S

s99999999s2003

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.
 
V

v0id

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
 
R

Richard Brodie

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top