-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 08/07/14 18:12, Peter Otten wrote:
> I suggest that you calculate the folder name in Python instead:
>
> # untested name =
> datetime.datetime.now().strftime("%y-%m-%d_%H-%M") destpath =
> os.path.join("/home/bob/A3/docsnaps", name) subprocess.call
On 7/8/2014 9:44 AM, Bob Williams wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I'm using Python 2.7.6 on an openSUSE linux system.
I'm trying to convert a shell (bash) script to a python script, and
everything's worked OK except this. The following line in the shell script
btrfs subvo
Bob Williams wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> I'm using Python 2.7.6 on an openSUSE linux system.
>
> I'm trying to convert a shell (bash) script to a python script, and
> everything's worked OK except this. The following line in the shell script
>
> btrfs subvolume
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I'm using Python 2.7.6 on an openSUSE linux system.
I'm trying to convert a shell (bash) script to a python script, and
everything's worked OK except this. The following line in the shell script
btrfs subvolume snapshot /home/bob/A3/documents /home/
>
> From: Oscar Benjamin
>To: Albert-Jan Roskam
>Cc: Dave Angel ; eryksun ;
>"Tutor@python.org"
>Sent: Wednesday, February 26, 2014 3:38 PM
>Subject: Re: [Tutor] subprocess.call list vs. str argument
>
>
>On 26 Febru
On 26 February 2014 08:50, Albert-Jan Roskam wrote:
>
> Yesterday evening (it was *late* so forgive me if I wrong) I realized that
> part of my confusion was also caused by the fact that I ran my code in Idle.
> If I called subprocess.call with a list argument, it returned code 0
> (success) bu
On Wed, Feb 26, 2014 at 3:50 AM, Albert-Jan Roskam wrote:
> On Tue, Feb 25, 2014 at 4:54 PM, Dave Angel wrote:
>> CreateProcess has its own design bobbles as well. For
>> example, if you forget to put quotes around the program
>> name, it will happily try to add ".exe" to *multiple*
>> places in
?
~~
On Tue, 2/25/14, eryksun wrote:
Subject: Re: [Tutor] subprocess.call list vs. str argument
To: "Dave Angel"
Cc: tutor@python.org
Date: Tuesday, February 25, 2014, 11:30 PM
O
On Tue, Feb 25, 2014 at 4:54 PM, Dave Angel wrote:
> CreateProcess has its own design bobbles as well. For example, if
> you forget to put quotes around the program name, it will
> happily try to add ".exe" to *multiple* places in the hopes that
> one of them will work.
>
> Adding a file c:\prog
eryksun Wrote in message:
>
>
> FYI, in Windows the situation is different. CreateProcess takes a
> string argument, so the setup code changes to the following:
>
>
> It's fine to use a string for args in Windows, and you may need to if
> the program parses the command line differently than l
See the comment about 'args' in:
http://docs.python.org/2/library/subprocess.html#frequently-used-arguments
which says:
"""args is required for all calls and should be a string, or a
sequence of program arguments. Providing a sequence of arguments is
generally preferred, as it allows the mod
On Tue, Feb 25, 2014 at 2:52 PM, Albert-Jan Roskam wrote:
> Here is why I used "shell=True" before. Is it related to the
> file paths?
>
> cmd = (r'sphinx-apidoc '
>r'-f -F '
>r'-H "%(title)s" '
>r'-A "%(author)s" '
>r'-V "%(version)s" '
>
Albert-Jan Roskam Wrote in message:
>
>
> - Original Message -
>
>> From: Danny Yoo
>> To: Peter Otten <__pete...@web.de>
>> Cc: Python Tutor Mailing List
>> Sent: Monday, February 24, 2014 11:01 PM
>> Subject: Re: [Tutor] subproces
- Original Message -
> From: Danny Yoo
> To: Peter Otten <__pete...@web.de>
> Cc: Python Tutor Mailing List
> Sent: Monday, February 24, 2014 11:01 PM
> Subject: Re: [Tutor] subprocess.call list vs. str argument
>
> Last comment (apologies for being so frag
Last comment (apologies for being so fragmented!). I don't know why
the literal strings there are raw there. Altogether, I'd expect:
#
cmd1 = ['sphinx-apidoc',
'-f',
'-F',
'-H', title,
'-A', author,
'-V', version,
There are a few issues there. I'd also recommend not trying to
shell-quote these manually,
# in the argument list of os.subprocess:
r'-H', '"%s"' % title,
r'-A', '"%s"' % author,
r'-V', '"%s"' % version,
Rather, just do the simpler thing:
r'-H', title,
r'-A', author,
Peter Otten wrote:
>> r'-f -F',
>> r'-H', '"%s"' % title,
>
> "title" becomes \"title\", i. e. Python puts in an extra effort to have
> the quotes survive the subsequent parsing process of the shell:
>
print subprocess.list2cmdline(['"title"'])
> \"title\"
Forget that :(
Danny spotted th
Albert-Jan Roskam wrote:
> Hi,
>
> In the code below, cmd1 and cmd2 are equivalent, as in: " ".join(cmd1) ==
> cmd2. But the first example returns a code 2, whereas the second runs
> successfully. What is the difference? I prefer using a list as it looks a
> little cleaner. Btw, shell=True is nee
> cmd1 = [r'sphinx-apidoc',
>r'-f -F',
This part looks suspicious. Are you sure you don't mean:
'-f', '-F'
here? They need to be separate arguments.
Also, you mention:
> Btw, shell=True is needed here.
Why do you need shell expansion on the arguments? This can be
dangerous u
Hi,
In the code below, cmd1 and cmd2 are equivalent, as in: " ".join(cmd1) == cmd2.
But the first example returns a code 2, whereas the second runs successfully.
What is the difference? I prefer using a list as it looks a little cleaner.
Btw, shell=True is needed here.
# Python 2.7.3 (default, J
On Mon, 4 Oct 2010 05:42:16 pm Norman Khine wrote:
> >> the first calls the 'sox' library which joins all the .wav files
> >> into one file and then i use the 'wav2swf' library to create a SWF
> >> output of the file.
> >>
> >> can the code be improved?
> >
> > Code can always be improved :-) What
thank you for the reply
On Mon, Oct 4, 2010 at 12:47 AM, Steven D'Aprano wrote:
> On Mon, 4 Oct 2010 06:44:54 am Norman Khine wrote:
>> hello, from the docs http://docs.python.org/library/subprocess.html i
>> see there is a WARNING about deadlock when using the subprocess.call.
>> in my code i ha
On Mon, 4 Oct 2010 06:44:54 am Norman Khine wrote:
> hello, from the docs http://docs.python.org/library/subprocess.html i
> see there is a WARNING about deadlock when using the subprocess.call.
> in my code i have this
>
> http://pastie.org/1197024
The warning says:
Like Popen.wait(), this
hello, from the docs http://docs.python.org/library/subprocess.html i
see there is a WARNING about deadlock when using the subprocess.call.
in my code i have this
http://pastie.org/1197024
the first calls the 'sox' library which joins all the .wav files into
one file and then i use the 'wav2swf'
On Mon, 2009-07-27 at 14:40 -0400, davidwil...@safe-mail.net wrote:
> OK I think I found my error, here is what I did:
>
> flags = set([file for file in glob.glob('flag-*.svg')])
>
> def call(cmd):
> subprocess.call([cmd], shell=True)
You hardly ever need shell=True. And using [cmd] is close
OK I think I found my error, here is what I did:
flags = set([file for file in glob.glob('flag-*.svg')])
def call(cmd):
subprocess.call([cmd], shell=True)
for flag in flags:
name = flag[:-4]
out = name+'.png'
call('svg2png --width=17 --height=12 %s %s' \
% (flag, o
Hello again,
>From my previous post I would now like to transform the SVG images using the
>svg2png library, but am having difficulties in making it work. Here is the
>code:
import glob
import csv
from os import rename
import subprocess
countries = {}
reader = csv.reader(open("countries.csv"))
27 matches
Mail list logo