473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Basic Python FTP Question

I have just discovered how to do ftp with python, and have a question
about using macdef.

I can connect to the ftp site, using the .netrc file:

machine my.ftpsite.com
login myuserid
password mypass
macdef dload
cd maindir
get myfile
and the python command:

cmdline = "ftp my.ftpsite.com" % ()
os.system(cmdline)
but, once I connect, I would like to be able to enter more
commands to do whatever kind of ftp I want.

But the way it seems to work is that you can have a macdef init
which will do the same thing every time you connect.

If the macdef is named anything else, such as 'dload' as in the example,
above, there doesn't seem to be any way to enter a python command to
execute it.

I would like to have in the .netrc:

macdef def1
commands

macdef def2
commands

macdef def3
commands

etc.

and then somehow be able to run macdef def1 or macdef def2 etc.,
depending on what I am doing within the python script.

Or if it's not a matter of having the macdefs in the .netrc file, then I
would like to know how to set up the proper ftp commands in python.

I hope this makes sense. I have the feeling I am missing some obvious
thing.

Mar 8 '06 #1
2 1324
On Wed, 08 Mar 2006 00:09:34 -0800, Ravi Teja wrote:
Have you seen Python's ftplib?
http://effbot.org/librarybook/ftplib.htm
http://docs.python.org/lib/module-ftplib.html


No I hadn't. Thanks for the references; it looks like that method will do
anything I need to do with ftp.

Mar 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
3
by: Player | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello I am teaching myself python, and I have gotten a long way, it's quite a decent language and the syntax is great :) However I am having a...
5
by: Aaron Ginn | last post by:
I'm investigating the feasibility of using Python instead of Visual Basic for a commercial software package that I'm planning on developing. Now I'm absolutely a Python zealot. I use it for most...
9
by: abisofile | last post by:
hi I'm new to programming.I've try a little BASIC so I want ask since Python is also interpreted lang if it's similar to BASIC.
6
by: aghazalp | last post by:
hi guys, this would be the most basic question ever...I am not a programmer but I am trying to learn programming in python...I was reading John Zelle's text book and instructed me to make .py file...
1
by: bruce | last post by:
hi... i have the following test python script.... i'm trying to figure out a couple of things... 1st.. how can i write the output of the "label" to an array, and then how i can select a given...
4
by: Hoop | last post by:
Hi, I have been working in getting Boost.Python running on my PC, seems to work now. I have what I believe is somewhat of basic question here. I am starting on an application that will...
25
by: samjnaa | last post by:
Please check for sanity and approve for posting at python-dev. In Visual Basic there is the keyword "with" which allows an object- name to be declared as governing the following statements. For...
2
by: Dave Dean | last post by:
Hi all, I'm just starting out in sockets/network programming, and I have a very basic question...what are the 'security' implications of opening up a socket? For example, suppose I've written a...
14
by: MartinRinehart | last post by:
Working on parser for my language, I see that all classes (Token, Production, Statement, ...) have one thing in common. They all maintain start and stop positions in the source text. So it seems...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.