473,397 Members | 2,068 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,397 software developers and data experts.

problem using subprocess.call

Hi!
running py module with the following code from shell:
__
dir=os.path.join(os.path.expanduser("~/domains/domain.com/html"),'test')
subprocess.call(['find',dir+" -name '*.zip' -execdir unzip {} \;"])
__
returns:
__
find: /home/clients/alex291_ftp0/domains/domain.com/html/test -name
'*.zip' -execdir unzip {} \;: No such file or directory
__

Maybe I should change some escape-symbols? Which of them?
Tricks with
r"..."
"""..."""
\\
didn't help...

Oct 26 '06 #1
3 2210
Alex Kachanov wrote:
running py module with the following code from shell:
__
dir=os.path.join(os.path.expanduser("~/domains/domain.com/html"),'test')
subprocess.call(['find',dir+" -name '*.zip' -execdir unzip {} \;"])
subprocess.call(["find", dir, "-name", "*.zip", "-execdir", "unzip", "{}", ";"])

</F>

Oct 26 '06 #2
>>
>dir=os.path.join(os.path.expanduser("~/domains/domain.com/html"),'test')
subprocess.call(['find',dir+" -name '*.zip' -execdir unzip {} \;"])

subprocess.call(["find", dir, "-name", "*.zip", "-execdir", "unzip",
"{}", ";"])
Ok, thanks, it works.
But what's the difference? Why I can't pass all parameters as one string?
Oct 26 '06 #3
Alex Kachanov wrote:
> subprocess.call(["find", dir, "-name", "*.zip", "-execdir", "unzip", "{}", ";"])

Ok, thanks, it works.
But what's the difference? Why I can't pass all parameters as one string?
because there's no one around to split them up for you.

after all, that's the whole point of running another program without going though the
shell: what you pass in ends up, as is, in the other program's argument array.

</F>

Oct 26 '06 #4

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

Similar topics

2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
2
by: Do Re Mi chel La Si Do | last post by:
Hi! This script (under Win-XP + P-2.4.1) : import subprocess p1=subprocess.Popen(r'cmd /cdir *.* /S /W /B', stdout=subprocess.PIPE) chaineretour=p1.stdout.read() run OK if called from...
4
by: Pekka Niiranen | last post by:
Hi, I am running Python script in W2K or in WinXP. The script is started from DOS prompt and writes text file to disk with codecs.open() in UTF8. The problem is: When script writes the file...
2
by: Stewart Midwinter | last post by:
this has me puzzled; I've created a small test app to show the problem I'm having. I want to use subprocess to execute system commands from inside a Tkinter app running under Cygwin. When I...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
3
by: Darren Dale | last post by:
I'm a developer on the matplotlib project, and I am having trouble with the subprocess module on windows (Python 2.4.2 on winXP). No trouble to report with linux. I need to use _subprocess instead...
5
by: Grant Edwards | last post by:
I'm trying to use the py-gnuplot module on windows, and have been unable to get it to work reliably under Win2K and WinXP. By default, it uses popen(gnuplotcmd,'w'), but in some situations that...
9
by: Phoe6 | last post by:
Hi all, Consider this scenario, where in I need to use subprocess to execute a command like 'ping 127.0.0.1' which will have a continuous non- terminating output in Linux. # code # This...
2
by: Michael George Lerner | last post by:
Hi, (Python 2.5, OS X 10.4.10) I have a program called pdb2pqr on my system. It is installed so that "pdb2pqr" is in my path and looks like: #\!/bin/zsh -f /sw/share/pdb2pqr/pdb2pqr.py "$@"...
3
by: Evan | last post by:
Hello - i'm trying to call subprocess.popen on the 'command-based' function in linux. When I run the command from the shell, like so: goset -f ' "%s %s" name addr ' file_name it works fine...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.