473,320 Members | 2,193 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.

How do I separate my parameters with spawnv

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
2 1178
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
Thank you very much

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

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

Similar topics

0
by: nushin | last post by:
Greetings, I am running RedHat 7.3 and trying to spawn a hello.py program from hello_driver.py by using spawn*( ) API, as a P_NOWAIT : os.spawnv(os.P_NOWAIT,'/usr/bin/python',('python hello.py...
3
by: nushin | last post by:
Try to launch a test program that prints hello world for a minute or so using, spawnv( ) or spawnl( ). Check to see the process state code that the program is running. I am using RedHat Linux 7.3...
1
by: nushin | last post by:
If you do not null out the output of your parent process that launches a child process by os.spawnv( ) in P_NOWAIT mode, you will see that your child process is launched *synchronously* instead of...
2
by: L Mehl | last post by:
Different users of the app will want or not want to see report footer ( appears as a separate page). I can make the section invisible with a DLookup of a Y or N value from a 'parameters' table ...
3
by: IamIan | last post by:
I am using os.spawnv in Python 2.1 to do some geoprocessing in a subroutine/process. Everything works great, except when the processing is done the subroutine just waits for a couple minutes before...
0
by: Damon Pettitt | last post by:
I'm not sure if this is how I'm supposed to post, but I saw a thread entitled, "Help with os.spawnv", that I wanted to respond to. I believe if you change the variable pyScript from:...
0
by: Chris Reuter | last post by:
I've been trying to start a particular external program from Python using os.spawnv(). This works perfectly under Linux but under Windows, it first runs the program, then throws an OSError...
10
by: Zoe Hart | last post by:
I have a wsdl file that I received from a third party and I'm using wsdl.exe (.NET 2.0) to import it and generate a proxy class. I've actually got a proxy class that works, but I'm trying to...
8
by: Henrik Lied | last post by:
Hi there! I'm trying to convert a video in a background process. The scenario I'm after: 1. The user uploads a video 2. The video is saved in my media directory, and the database is populated...
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
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.