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... 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>
>>
>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?
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> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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 "$@"...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |