[Tutor] (no subject)

Roberts, Alice ARoberts at ambac.com
Mon Oct 31 15:58:33 CET 2005


Good morning,

 

I'm migrating from DOS scripting to Python, and need a little help.  I
got this sample from a Google search that brought me to effbot.org,
http://effbot.org/librarybook/ftplib.htm.  Also, I plugged in all my
variables when I tested, but replaced with generics for this email. ie)
ftp.website.com <ftp://ftp.website.com/> .

 

Thank you,

 

Alice Roberts

Ambac Assurance Corp.

 

from ftplib import FTP

import sys

 

def upload(ftp, file):

        ftp.storlines("STOR " + file, open(file))

 

ftp = ftplib.FTP('ftp.website.com')   # connect to host, default port

ftp.login('user', 'pwd') # user, passwd

ftp.set_debuglevel(1) 

ftp.cwd('/temp')

ftp.delete('fname.txt')

 

upload(ftp, "fname.txt")

 

ftp.quit()

ftp.close() <ftp://ftp.close()/> 

 

When I ran in debugger, calling the FTP library invokes a no SOCKS
module error that the ftplib seems to be trying to access.

 

>>> --Call--

>>> Unhandled exception while debugging...

Traceback (most recent call last):

  File "C:\Python24\lib\ftplib.py", line 42, in ?

    import SOCKS; socket = SOCKS; del SOCKS # import SOCKS as socket

ImportError: No module named SOCKS

>>> --Call--

>>> Unhandled exception while debugging...

Traceback (most recent call last):

  File "C:\Python24\lib\socket.py", line 50, in ?

    import _ssl

ImportError: No module named _ssl

>>> --Call--

>>> Unhandled exception while debugging...

Traceback (most recent call last):

  File "C:\Python24\lib\os.py", line 36, in _get_exports_list

    return list(module.__all__)

AttributeError: 'module' object has no attribute '__all__'

[Dbg]>>> Traceback (most recent call last):

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py"
, line 305, in RunScript

    debugger.run(codeObject, __main__.__dict__, start_stepping=1)

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\__init__.py",
line 60, in run

    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\debugger.py",
line 595, in run

    exec cmd in globals, locals

  File "c:\temp\ftp_get_hub.py", line 13, in ?

    ftp = ftplib.FTP("ftp.website.com")   # connect to host, default
port

NameError: name 'ftplib' is not defined

[Dbg]>>> Traceback (most recent call last):

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py"
, line 305, in RunScript

    debugger.run(codeObject, __main__.__dict__, start_stepping=1)

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\__init__.py",
line 60, in run

    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\debugger.py",
line 595, in run

    exec cmd in globals, locals

  File "c:\temp\ftp_put_hub.py", line 3, in ?

    import FTP

ImportError: No module named FTP

[Dbg]>>> Traceback (most recent call last):

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py"
, line 305, in RunScript

    debugger.run(codeObject, __main__.__dict__, start_stepping=1)

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\__init__.py",
line 60, in run

    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)

  File
"C:\Python24\Lib\site-packages\pythonwin\pywin\debugger\debugger.py",
line 595, in run

    exec cmd in globals, locals

  File "c:\temp\ftp_put_hub.py", line 9, in ?

    ftp = ftplib.FTP('ftp.website.com')   # connect to host, default
port

NameError: name 'ftplib' is not defined

[Dbg]>>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051031/c0546fbb/attachment-0001.htm


More information about the Tutor mailing list