Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60016

Re: My first real request for help

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; '(b)': 0.07; 'fixes': 0.07; 'subject:help': 0.08; 'string': 0.09; '__init__': 0.09; 'executable': 0.09; 'function:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'changes': 0.15; '.py': 0.16; '2.6.4': 0.16; 'cmd': 0.16; 'command,': 0.16; 'errread,': 0.16; 'errwrite)': 0.16; 'inserting': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'time"': 0.16; 'alpha': 0.16; 'wrote:': 0.18; 'bit': 0.19; '(but': 0.19; 'subject:request': 0.19; 'written': 0.21; 'command': 0.22; '>>>': 0.22; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; '(a)': 0.24; 'config': 0.24; 'options': 0.25; 'skip:" 30': 0.26; 'suggested': 0.26; 'switch': 0.26; 'skip:_ 20': 0.27; 'header:X -Complaints-To:1': 0.27; 'leave': 0.29; 'on,': 0.29; '(this': 0.29; 'raise': 0.29; "doesn't": 0.30; 'code': 0.31; '"",': 0.31; 'option.': 0.31; 'sep': 0.31; 'work:': 0.31; 'file': 0.32; 'run': 0.32; 'running': 0.33; '(most': 0.33; 'call.': 0.33; 'actual': 0.34; 'skip:_ 10': 0.34; '(2)': 0.35; 'no,': 0.35; 'but': 0.35; 'add': 0.35; 'version': 0.36; 'ubuntu': 0.36; 'shows': 0.36; 'possible': 0.36; 'should': 0.36; 'so,': 0.37; 'too': 0.37; 'two': 0.37; 'list': 0.37; 'starting': 0.37; 'to:addr:python-list': 0.38; 'recent': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'new': 0.61; 'first': 0.61; 'such': 0.63; 'more': 0.64; 'believe,': 0.84; 'missing.': 0.84; 'otten': 0.84; 'plugins': 0.84; 'skip:/ 30': 0.84; 'dirty': 0.93; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: My first real request for help
Date Tue, 19 Nov 2013 18:46:54 +0100
Organization None
References <201311190431.15449.gheskett@wdtv.com> <l6fdpb$2dk$1@ger.gmane.org> <201311191119.27188.gheskett@wdtv.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084af94.dip0.t-ipconnect.de
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2930.1384883205.18130.python-list@python.org> (permalink)
Lines 108
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384883205 news.xs4all.nl 15939 [2001:888:2000:d::a6]:48052
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60016

Show key headers only | View raw


Gene Heskett wrote:

> On Tuesday 19 November 2013 11:16:10 Peter Otten did opine:
> 
>> Gene Heskett wrote:
>> > Old python, 2.6.4 I believe, not update able from the Ubuntu 10.04.3
>> > LTS repo's.
>> > 
>> > Should be a mauchs nichs as the code was written on, and is running
>> > on, several of these same linuxcnc installs.
>> > 
>> > But when I switch in, as one of the plugins a new .py version of
>> > camview- emc, I get this when I attempt to run linuxcnc -l, where the
>> > -l is "use the same config as last time" option.
>> > 
>> > Starting LinuxCNC...
>> > 
>> > Traceback (most recent call last):
>> >   File "/usr/bin/axis", line 3326, in <module>
>> >   
>> >     _dynamic_tabs(inifile)
>> >   
>> >   File "/usr/bin/axis", line 3182, in _dynamic_tabs
>> >   
>> >     child = Popen(cmd)
>> >   
>> >   File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
>> >   
>> >     errread, errwrite)
>> >   
>> >   File "/usr/lib/python2.6/subprocess.py", line 1139, in
>> >   _execute_child
>> >   
>> >     raise child_exception
>> > 
>> > OSError: [Errno 2] No such file or directory
>> > 
>> > No clue, even when straced, as to what file might be missing.
>> > 
>> > So, how do I find out?
>> 
>> How about inserting a
>> 
>> print cmd
>> 
>> before the line
>> 
>> child = Popen(cmd)
>> 
>> ? Depending on its value it may not even be a missing command, e. g.
>> This doesn't work:
>> 
>> Python 2.6.7 (r267:88850, Sep 28 2012, 16:26:39)
>> [GCC 4.6.1] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> 
>> >>> import subprocess
>> >>> subprocess.Popen("ls -1")
>> 
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
>>     errread, errwrite)
>>   File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
>>     raise child_exception
>> OSError: [Errno 2] No such file or directory
>> 
>> But this works:
>> >>> subprocess.Popen(["ls", "-1"])
>> 
>> <subprocess.Popen object at 0x7f8b31c5cfd0>
>> 
>> >>> alpha
>> 
>> beta
>> gamma
>> 
>> And this works, too (but is a bit less robust):
>> 
>> subprocess.Popen("ls -1", shell=True)
>> <subprocess.Popen object at 0x7f8b31c5cd90>
>> 
>> >>> alpha
>> 
>> beta
>> gamma
> 
> You are suggesting I edit /usr/lib/python2.6/subprocess.py?

No, first and foremost I suggested that you find out the actual value of 
cmd.

Only if that's indeed

(a) a string and
(b) contains a command with options

my demo shows two possible fixes that you can apply to the Popen() call in 
the _dynamic_tabs() function:

(1) The clean one: Make sure that cmd is a list with the executable as the 
first item and the options as the following items (this will require changes 
in other places), or

(2) The quick and dirty one: Leave everything as is and add shell=True to 
the Popen() call.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: My first real request for help Peter Otten <__peter__@web.de> - 2013-11-19 18:46 +0100

csiph-web