On 20/09/17 22:09, Derek Smith wrote:
> Why does python output this b and newline characters
Because that's what the command is returning.
The b indicates its an array of bytes (as
opposed to a unicode string)
Note the module dpocumentation for check_output() says:
"By default, this function wil
Add sound of me beating my head with a bat! :)
Thanks Peter!
-I was a bit too precise in my naming conventions for later review!
On 06/03/2016 02:30 PM, Peter Otten wrote:
dirkjso...@gmail.com wrote:
Running Linux Mint 17.3
Python3.4.3
I'm following a Tutor concerning the subprocess modul
dirkjso...@gmail.com wrote:
> Running Linux Mint 17.3
> Python3.4.3
>
> I'm following a Tutor concerning the subprocess module which said to
> open a Terminal SHELL and type:
>
> $ python3
> >>> import subprocess
> >>> subprocess.call('ls', shell=True)
>
> Last night the subprocess.call porti
On Fri, Feb 20, 2015 at 06:58:17PM -0500, brads wrote:
> My subprocess is in error but the same command at the command line works
> fine.
Are you running the Python script as the same user and from the same
location as the command line? If you are running the Python script as an
unprivileged us
On 06Nov2014 22:18, jarod...@libero.it wrote:
Dear All thanks so much for the suggestion !!!
One thing is not clear to me: How can write more safe string to send on
subprocess.Popen() without %s? What is the best way to do this?
The safest way is to use shell=False and pass a python list wit
Dear All thanks so much for the suggestion !!!
One thing is not clear to me: How can write more safe string to send on
subprocess.Popen() without %s? What is the best way to do this?
thanks so much!
___
Tutor maillist - Tutor@python.org
To unsubscr
-
On Thu, Nov 6, 2014 12:57 AM CET Cameron Simpson wrote:
>On 05Nov2014 14:05, jarod...@libero.it wrote:
>> I need to use external program from my scirpt.
>> code = "intersectBed -a %s -b /database/Refseq_Gene2.bed -wa -wb|cut -f
>> 4,8|uniq > tmp.tmp1"%("gene5.tmp.
On 05Nov2014 14:05, jarod...@libero.it wrote:
I need to use external program from my scirpt.
code = "intersectBed -a %s -b /database/Refseq_Gene2.bed -wa -wb|cut -f 4,8|uniq >
tmp.tmp1"%("gene5.tmp.bed")
code2 = "intersectBed -a %s -b /database/Refseq_Gene2.bed -wa -wb|cut -f 4,8|uniq >
tm
> "Semantically, the command above means:
> execute "./octosetupBROADCASTER-linux_i386.bin" in an environment
> that binds BYPASSROOT to "yes"."
>
> Does the above mean "BYPASSROOT" is an environmet variable? Is this created
> and set by default by the system or is it created and set by
> "octo
Thank you Danny for your assistance. Just a couple of follow up questions to
help me understand what is going on.
You said...
"Semantically, the command above means:
execute "./octosetupBROADCASTER-linux_i386.bin" in an environment
that binds BYPASSROOT to "yes"."
Does the above mean "BYPASSR
> The command I need to run is "BYPASSROOT=yes
> ./octosetupBROADCASTER-linux_i386.bin"
Semantically, the command above means:
execute "./octosetupBROADCASTER-linux_i386.bin" in an environment
that binds BYPASSROOT to "yes".
The subprocess.Popen command takes in an optional "env" argument,
On Tue, Apr 22, 2014 at 3:10 PM, Alan Gauld wrote:
> We have no clue what you are doing. You say "this works"
> but we can't see what 'this' is. Is the code on the
> pastebin link the working or the broken version?
>
Per what is expected output (which I forgot to provide - sorry about
that). Sho
On 22/04/14 10:14, shawn wilson wrote:
This works when I have a class for ldd and nothing else, but when I
run it like this:
https://gist.github.com/ag4ve/11171201
I don't get any of the libraries and I can't figure out where it's failing.
['fattr', [['/testroot', 0, 0, 777], ['/bin/dash']]]
HER
On Dec 10, 2013, at 2:28 PM, Reuben wrote:
> Hi,
>
> There exists two Linux machines A and B. Machine B contains python script
> which needs to be run e.g. Test.py
>
> In order to run that script, machine A needs to telnet into machine B and
> then execute "python Test.py"
>
> How can this b
On Wed, Dec 11, 2013 at 12:58:16AM +0530, Reuben wrote:
> Hi,
>
> There exists two Linux machines A and B. Machine B contains python script
> which needs to be run e.g. Test.py
>
> In order to run that script, machine A needs to telnet into machine B and
> then execute "python Test.py"
Using tel
Reuben wrote:
>I want to implement a python script on machine A to do telnet/ssh into
>machine B (this might be easy)and then run the Test.py (this is
>challenging)
>On 11-Dec-2013 1:05 AM, "Danny Yoo" wrote:
>
>> On Tue, Dec 10, 2013 at 11:28 AM, Reuben
>wrote:
>> > Hi,
>> >
>> > There exists t
Ok; so in your situation, it sounds like machine A is also running a
Python script, and you want to automate the remote administration of
machine B through that program. If that's the case, you may want to
look at the "Fabric" library, or other libraries that help with
driving ssh through Python:
I want to implement a python script on machine A to do telnet/ssh into
machine B (this might be easy)and then run the Test.py (this is challenging)
On 11-Dec-2013 1:05 AM, "Danny Yoo" wrote:
> On Tue, Dec 10, 2013 at 11:28 AM, Reuben wrote:
> > Hi,
> >
> > There exists two Linux machines A and B
On Tue, Dec 10, 2013 at 11:28 AM, Reuben wrote:
> Hi,
>
> There exists two Linux machines A and B. Machine B contains python script
> which needs to be run e.g. Test.py
>
> In order to run that script, machine A needs to telnet into machine B and
> then execute "python Test.py"
Nothing about this
Thank you "Eryksun" and "EikeWek" for your responses. It is this sort of
thing that begins to pull one out of the newbie into the intermediate
category. I'm grateful.
alex
> I've not found anywhere a clear explanation of when not to set shell=True.
> If the command line must be interpreted by the
On Sunday 10.03.2013 09:56:26 aklei...@sonic.net wrote:
> I've not found anywhere a clear explanation of when not to set shell=True.
> If the command line must be interpreted by the shell then clearly this
> must be set. So the question that comes up is why not set it always?
Because ``shell=True`
On Sun, Mar 10, 2013 at 12:56 PM, wrote:
> I've not found anywhere a clear explanation of when not to
> set shell=True. If the command line must be interpreted by
> the shell then clearly this must be set. So the question
> that comes up is why not set it always?
Using the shell can be a securit
Ya. Do it using python. Why do you want to use bash when you already have
python?
See, do something like this:-
import os
alldirs = os.listdir("/path/to/dir")
DIRS = [] #Only the dirs you are interested in
for i in alldirs:
if i.find("deploy") is -1: L.append(i)
if i.find("TEMPLATE"
Please read the documentation of Popen. You cannot pass arguments like that.
>>> from subprocess import Popen,PIPE
>>> import shlex
>>> cmd="ls -l"
>>> cmd=shlex.split(cmd)
>>> p = Popen(cmd,stdout=PIPE,stderr=PIPE)
or simply that means
>>> p = Popen(['ls','-l'],stdout=PIPE,stderr=PIPE)
Hope I
> #!/usr/bin/env python
> import subprocess
> import sys
>
> dom = sys.argv[1]
> switch = sys.argv [2]
> answer = subprocess.call("whois " + dom, shell=True)
>
> Execute the above (whatever.py -example.com -a1) prints the entire WHOIS
> output, but I just want it saved to the variable 'answer', n
- Original message -
> I'm using Python 2.6.5 and I've got a challenge with the subprocess
> module. I'd like the output to be stored in a variable, and not sent to
> the stdout. The relevant lines as they are now:
Go to google, enter "pymotw subprocess" and hit I am feeling lucky ;-)
gre
On 27 March 2010 09:30, David Abbott wrote:
> Here is an example using subprocess.call
> http://dwabbott.com/code/index8.html
>
> and some more here with subprocess.Popen
> http://asterisklinks.com/wiki/doku.php?id=wiki:subprocess
On top of that we have the excelent PyMOTW from Doug on subprocess
Thanks David. Those are excellent short clear examples. I will look those over.
Super! Thanks for that.
-kp
On Mar 27, 2010, at 5:30 PM, David Abbott wrote:
> On Sat, 2010-03-27 at 16:55 +0900, kevin parks wrote:
>
> Here is an example using subprocess.call
> http://dwabbott.com/code/index8.
On Sat, 2010-03-27 at 16:55 +0900, kevin parks wrote:
> I tried readings some toots and tried reading alan's thing. I just still
> can't grok how to use subprocess.
>
> I am trying to call sox (fun fact: an early contributer to sox was none other
> than Guido van Rossum)
>
> In the old days you
Muhammad,
I am no expert, but I think you have to call proc_log.close() in your
StartProc() to make sure that the file is written out to disk.
If I understand what you are doing, you are trying to generate a new path for
each pass through the loop, of the form 0/, 1/,... and write "MyLog.txt" to th
Essah Mitges wrote:
> game runs fine out of the WODDS.py it when I start it from the menu lies the
> problemup-1.png is the first pic file used in the program so I'm guessing
> that all of the imported files from data have a problem if i took away up-1
> up-2 would start a problem then side-1 an
so on
> From: sri...@gmail.com
> Date: Wed, 10 Jun 2009 17:16:43 -0500
> Subject: Re: [Tutor] subprocess/files help
> To: e_mit...@hotmail.com
> CC: tutor@python.org
>
> On Wed, Jun 10, 2009 at 4:21 PM, Essah Mitges> wrote:
>
>
>
>
> The p
On Wed, Jun 10, 2009 at 4:21 PM, Essah Mitges wrote:
>
> The problem I am have now is that once my game is initiated from the menu
> file the modules that are with cannot import the imagesthe folder looks like
> thisWODDSdataAll images and sound for gamegamelib
> ObjectsU
On Fri, Apr 03, 2009 at 03:12:08PM -0700, Weidner, Ronald wrote:
> I have a long running py script that I'm trying to kick off from
> another long running py script as a separate process... If either
> script fails or terminates, I don't want the other script to be
> effected as a result. In other
David wrote:
> Martin Walsh wrote:
>
>> Welcome!
>
> thanks
welcome (uh oh, infinite loop warning)
> This "podcast_file.write('%s: %s' % (entry.updated, entry.link))"
> writes it in one very long string
Copy and paste gets me every time. Try this, and note the presence of
the newline ('\n'):
"David" wrote
sys.stdout = open("podcast_links.txt", "a")
print '%s' % (entry.link)
sys.stdout.close()
getFeed()
This "podcast_file.write('%s: %s' % (entry.updated, entry.link))"
writes it in one very long string
Use podcastfile.writeline() to write it line by line
Martin Walsh wrote:
Welcome!
thanks
You should probably try to avoid reassigning sys.stdout. This is usually
a bad idea, and can cause odd behavior that is difficult to
troubleshoot, especially for a beginner. A reasonable approach is to
assign the open file object to a name of your own ch
Hi David,
David wrote:
> Hi everyone.
> Just learning :) I have one program to parse a podcast feed and put it
> into a file.
Welcome!
>
> def getFeed():
> url = raw_input("Please enter the feed: ")
> data = feedparser.parse(url)
> for entry in data.entries:
> sys.stdout =
On Sun, Dec 21, 2008 at 7:29 PM, David wrote:
> This seems to work;
>
> download = L.readline()
> print download
> download = download[0:-1]
>
> What is that last character that is added;
> .mp3%0A
It is a newline character (line feed). readline() includes the line
endings in the returned lines.
This seems to work;
download = L.readline()
print download
download = download[0:-1]
What is that last character that is added;
.mp3%0A
--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu
___
Tutor maillist - Tutor@python.org
http
John wrote:
> Hello,
Hi John,
I didn't see a response to your question, so I'll make an attempt ...
>
> I've written a script which conducts several subprocess calls and then
> ultimately calls a shell script which runs even more programs... my
> script is using subprocess to execute a few sed
> how I thought that it was supposed to work was it would allow me to use
> sbp.communicate() to
> send stuff to the stdin, and get information out. What do get is a prompt
> ask for my password.
I believe that su does not read its input from stdin but from its
controlling tty. So you'd have to o
"Alan Gauld" <[EMAIL PROTECTED]> wrote
> Oddly I just tried some experiments and I can't get subprocess
> to work with the stdout=PIPE option, it used to...
>
> Anyone have any idea what my obvious mistake is?
>
> Traceback (most recent call last):
> File "", line 1, in ?
> File "C:\Python24\li
"Tino Dai" <[EMAIL PROTECTED]> wrote
> PIPE=subprocess.pipe
Not sure why you need this?
> sbp=subprocess.Popen
> (["su","-",stdin=PIPE,stdout=PIPE,close_fds=True,shell=True)
and I'm not sure what that [ is doing in there? I assume you meant
to have a closing ] after the "-"?
Have you looked a
Tino Dai wrote:
> Hi there,
>
> I'm have a tough time figuring out how to get su and subprocess
> working. I have
>
> PIPE=subprocess.pipe
>
> sbp=subprocess.Popen(["su","-",stdin=PIPE,stdout=PIPE,close_fds=True,shell=True)
>
>
>
> how I thought that it was supposed to work was it would all
Eric Brunson wrote:
> Noufal Ibrahim wrote:
[..]
>> def createSignalDelegator(p):
>> def sighandler(signal,frame,pmake = p):
>> os.kill(pmake.pid,signal)
>> return sighandler
>>
>> pmake = subprocess.Popen(pmake_cmd, bufsize = 1, stdout =
>> subprocess.PIPE, stderr = subprocess.
Noufal Ibrahim wrote:
> Hello everyone,
>I've come across a situation which is somewhat confusing to me.
>I googled for some details and came across another email thread on
> this very list but couldn't really glean a solution out of it.
>
>I have a program (a compiled binary) for whic
"Jason Massey" <[EMAIL PROTECTED]> wrote
> gedit launches with a blank file called window1. The python shell
> is now
> waiting for gedit to exit before it does anything else.
>
> 2nd console
> ---
import subprocess
subprocess.call('gedit --new-window window2',shell=True)
>
"Brian van den Broek" <[EMAIL PROTECTED]> wrote
> gedit is the default text editor on my ubuntu feisty system, so in
> the
> first instance, I've tried to do this with gedit. The
> subprocess.call:
>
> >>> subprocess.call("gedit somefilename", shell=True)
>
You should probably check the VISUAL
I'm running Feisty as well.
I launched python in two separate consoles and tried this:
1st console
import subprocess
subprocess.call('gedit --new-window window1',shell=True)
gedit launches with a blank file called window1. The python shell is now
waiting for gedit to exit be
On Thursday 07 December 2006 10:25, Dave S wrote:
> On Thursday 07 December 2006 00:31, Luke Paireepinart wrote:
> > Dave S wrote:
> > > Hi all,
> > >
> > > I thought I had my solution with subprocess ... my test code ...
> > >
> > >
> > >
> > > #!/usr/bin/env python
> > > # -*- coding: iso8859_1 -
On Thursday 07 December 2006 00:31, Luke Paireepinart wrote:
> Dave S wrote:
> > Hi all,
> >
> > I thought I had my solution with subprocess ... my test code ...
> >
> >
> >
> > #!/usr/bin/env python
> > # -*- coding: iso8859_1 -*-
> >
> > import subprocess
> >
> > a = subprocess.Popen('tasklist.ex
Dave S wrote:
> Hi all,
>
> I thought I had my solution with subprocess ... my test code ...
>
>
>
> #!/usr/bin/env python
> # -*- coding: iso8859_1 -*-
>
> import subprocess
>
> a = subprocess.Popen('tasklist.exe', bufsize=0, stdout=subprocess.PIPE,
> universal_newlines=True)
> op = a.s
53 matches
Mail list logo