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

How do I separate my parameters with spawnv

P: n/a
Hi,

I have a command line that works fine when I execute it directly:

c:\\curl.exe -T c:\\upload.txt -u login:pwd ftp://ftp-myurl --ftp-ssl

But when I try to use os.spawnv to excute it from my python code, it
doesn't work at all. Here is my code:

exe = "c:\\curl.exe"
f = "c:\\upload.txt"
logon = "login:pwd"
url = "ftp://ftp-myurl"
import os
os.spawnv(os.P_WAIT, exe, ["-T", f, "-u", logon, url, "--ftp-ssl"])

Does anyone know How I can execute my command line in python?

Thanks and best regards,
Fabio

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Nov 23 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Fabio Chelly wrote:
But when I try to use os.spawnv to excute it from my python code, it
doesn't work at all. Here is my code:

exe = "c:\\curl.exe"
f = "c:\\upload.txt"
logon = "login:pwd"
url = "ftp://ftp-myurl"
import os
os.spawnv(os.P_WAIT, exe, ["-T", f, "-u", logon, url, "--ftp-ssl"])
iirc, spawnv expects an argv-style list, with the program name as the
first argument. try writing the above as

os.spawnv(os.P_WAIT, exe, [exe, "-T", f, "-u", logon, url, "--ftp-ssl"])
Does anyone know How I can execute my command line in python?
the subprocess module is usually much nicer for things like this.

</F>

Nov 23 '06 #2

P: n/a
Thank you very much

--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Nov 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.