By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,302 Members | 1,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,302 IT Pros & Developers. It's quick & easy.

Does FTPLIB have a 'local change directory' ?

P: n/a
Hi, first I wanted to say that:

I have finally been able to ftp a file in my python app - however, it
works like this:

When you use storbinary and hand it a full path
"c:\myfiles\morefiles\picture.gif"..
it will find the file on your hard drive, and
then upload the file, but on the ftp server, it literally names the file:

"c:\myfiles\morefiles\picture.gif"
I'd like to be able to first

ftplib.lcd( "c:\myfiles\morefiles" )

and then just

storbinary( picture.gif .. ).

But the python doc doesn't show any LCD.

Or am I going to have to be satisfied with having to just use a rename on
the server,
after uploading the file?

Thanks
Steve


Aug 7 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
python newbie wrote:
Hi, first I wanted to say that:

I have finally been able to ftp a file in my python app - however, it
works like this:

When you use storbinary and hand it a full path
"c:\myfiles\morefiles\picture.gif"..
it will find the file on your hard drive, and
then upload the file, but on the ftp server, it literally names the file:

"c:\myfiles\morefiles\picture.gif"
I'd like to be able to first

ftplib.lcd( "c:\myfiles\morefiles" )

and then just

storbinary( picture.gif .. ).

But the python doc doesn't show any LCD.


os.chdir()

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Aug 7 '05 #2

P: n/a
If you want to change the working directory of a Python program, then use
os.chdir() for that purpose. That's what 'lcd' does in ftp client software.
It doesn't send a remote command of any kind.

Or, when you call the storbinary method, give the os.path.basename() of the
file you are storing, instead of the name you used to open the file on the local
system.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFC9WZgJd01MZaTXX0RAg6UAKCSztXi8VVC9PvkKprv5Q wBctMDHwCgqSho
A7t6OLeHZBp/uXybH5wWXK4=
=5XcD
-----END PGP SIGNATURE-----

Aug 7 '05 #3

P: n/a
On Sun, 07 Aug 2005 01:28:31 GMT,
"python newbie" <qu**************@gmail.com> wrote:
I'd like to be able to first ftplib.lcd( "c:\myfiles\morefiles" ) and then just storbinary( picture.gif .. ). But the python doc doesn't show any LCD.


Try os.chdir.

HTH,
Dan

--
Dan Sommers
<http://www.tombstonezero.net/dan/>
Aug 7 '05 #4

P: n/a
Yes, I tried using just the filename itself in using storbinary, but
it returned some kind of error, but your suggestion to use os.chdir is
so obvious I'm not sure why I didn't think of that.
Thanks for the email
Steve

On 8/6/05, je****@unpythonic.net <je****@unpythonic.net> wrote:
If you want to change the working directory of a Python program, then use
os.chdir() for that purpose. That's what 'lcd' does in ftp client software.
It doesn't send a remote command of any kind.

Or, when you call the storbinary method, give the os.path.basename() of the
file you are storing, instead of the name you used to open the file on the local
system.

Jeff


Aug 7 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.