|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I'm having trouble with the ftplib module in Python 2.0
It was working yesterday but today it is giving me trouble. I'll post the traceback output below. Code:
Traceback (most recent call last):
File "c:\python20\pythonwin\pywin\framework\scriptutils.py", line 394, in ImportFile
exec codeObj in __main__.__dict__
File "<auto import>", line 1, in ?
File "C:\Documents and Settings\All Users\Desktop\ftp_test.py", line 13, in ?
ftp = ftplib.FTP("webstage.intra.lifespan.org")
AttributeError: FTP
Any thoughts? Thanks, Chris
__________________
"Once begun, half done." - EP |
|
#2
|
|||
|
|||
|
If you haven't changed your Python script from the night before I would say it is something outside of your Python script that has changed.
I can't be much more helpful than that without seeing the code. |
|
#3
|
|||
|
|||
|
Code
Good point - Here's the code.
Code:
import ftplib
import os
import re
print "\nBegining Transfer..."
reportDirectory = "C:\Program Files\Analog\Reports"
ftpTarget = "webstage.intra.lifespan.org"
ftpDirectory = "webreports/testing"
ftpUser = "anonymous"
ftpPass = "anon@lifespan.org"
ftp = ftplib.FTP("webstage.intra.lifespan.org")
ftp.login(ftpUser,ftpPass)
ftp.cwd(ftpDirectory)
print "\n" + ftp.getresp()
#print os.getcwd()
for file in os.listdir(reportDirectory):
print "\n" + file
if re.match("\w+\d{6}\.html",file):
ftp.storbinary("STOR" + file, open(file, "rb"), 1024)
print "\n" + ftp.getresp()
print "\nDone Transfer"
print ftp.dir()
ftp.quit()
Last edited by xangelusx : July 25th, 2001 at 01:39 PM. |
|
#4
|
|||
|
|||
|
Sorry its taken me so long to get back to you.
I ran your code up until the point that I logged in to a server. One problem I found is that the address could not be found which generated an error. I put in my own ftp address with l/p and it worked fine. I only ran the code on the interactive command line until this point. print "\n" + ftp.getresp() Hope this helps. E. |
|
#5
|
|||
|
|||
|
Hi, and thanks for writing back again.
I can't believe I didn't catch this before but the problem was because I was trying to connect to our intranet server from our extranet server which exists on the outside of our firwall. DUH! Thanks again for checking into it, though. Chris Bloom ![]() |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > FTP Problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|