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


Groups > comp.lang.python > #14963

Re: spawnl issues with Win 7 access rights

Date 2011-10-25 13:19 +0100
From Tim Golden <mail@timgolden.me.uk>
Subject Re: spawnl issues with Win 7 access rights
References <c7b441c4-3e7c-4b6b-bd2e-b60e08ca62f0@gk10g2000vbb.googlegroups.com> <4308935.65.1319502062676.JavaMail.geo-discussion-forums@prfq1> <047ec741-9164-4b0e-bb24-f71e3ab1e39b@gk10g2000vbb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2206.1319545179.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 25/10/2011 08:01, Propad wrote:
> Thnx again for all the answers. As stated before, I'm limited in my
> options. One of them just might be to switch to Python 2.5, rewrite
> the code that crashes using the subprocess module, and then somehow
> patch the library I use (which I'm not suposed to do, but... oh
> well :-)). I can just hope subrocess was already mature adn offering
> the relevant functionality in 2.5.

I must admit I'm more than slightly surprised by this. My test case
is to use os.spawnl to run c:/windows/notepad.exe. From the docs,
I would expect to use os.spawnl (os.P_WAIT, "c:/windows/notepad.exe").
(I only want to open notepad.exe; there's no need for additional args).

These are my test cases:

(1)

os.spawnl (
   os.P_WAIT,
   "c:/windows/notepad.exe"
)

(2)

os.spawnl (
   os.P_WAIT,
   "c:/windows/notepad.exe",
   "c:/windows/notepad.exe"
)

(3)

os.spawnl (
   os.P_WAIT,
   "c:/windows/notepad.exe",
   "c:/windows/notepad.exe",
   "c:/temp.txt"
)


And the results:

==============================================================
Python | Platform | Case | Result
--------------------------------------------------------------
2.2.2  | WinXP    | 1    | Works (empty notepad)
2.2.2  | WinXP    | 2    | Works (empty notepad)
2.2.2  | WinXP    | 3    | Works (notepad temp.txt)
--------------------------------------------------------------
2.2.2  | Win7     | 1    | OSError
2.2.2  | Win7     | 2    | Works (empty notepad)
2.2.2  | Win7     | 3    | Works (notepad temp.txt)
--------------------------------------------------------------
2.7.2  | WinXP    | 1    | Crashes
2.7.2  | WinXP    | 2    | Works (empty notepad)
2.7.2  | WinXP    | 3    | Works (notepad temp.txt)
--------------------------------------------------------------
2.7.2  | Win7     | 1    | Crashes
2.7.2  | Win7     | 2    | Works (empty notepad)
2.7.2  | Win7     | 3    | Works (notepad temp.txt)
==============================================================


Add to this a look at the mscrt source which ships with VS 2008
and the MSDN docs for spawnl:

http://msdn.microsoft.com/en-us/library/wweek9sc%28v=vs.80%29.aspx

and we see that the first args parameter must be the same as the
path parameter.

FWIW, at no extra cost, I went to the trouble of testing it on some
flavour of Linux with Python 2.6 and got the same results
as per 2.2.2 on WinXP. (Basically: everything works).

Which leaves us with http://bugs.python.org/issue8036 in which recent
versions of Python crash when the (arbitrary) second parameter isn't
passed. And with an inexplicable behaviour change between the same
version of Python running on WinXP and on Win7.

It looks as though the workaround for your problem (or, possibly,
your failure to fulfil some artificial parameter requirements) is
to add the executable again as the third parameter.

issue8036 (which also affects the execl family) has a patch waiting
for review, which hopefully we can get round to fixing. As far as I
can tell, the execl/spawnl family of functions isn't currently
represented in the testsuite.

TJG

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


Thread

spawnl issues with Win 7 access rights Propad <npropadovic@googlemail.com> - 2011-10-24 05:43 -0700
  Re: spawnl issues with Win 7 access rights Tim Golden <mail@timgolden.me.uk> - 2011-10-24 14:18 +0100
    Re: spawnl issues with Win 7 access rights Propad <npropadovic@googlemail.com> - 2011-10-24 06:47 -0700
      Re: spawnl issues with Win 7 access rights Terry Reedy <tjreedy@udel.edu> - 2011-10-24 18:16 -0400
  Re: spawnl issues with Win 7 access rights Tim Golden <mail@timgolden.me.uk> - 2011-10-24 15:18 +0100
  Re: spawnl issues with Win 7 access rights Terry Reedy <tjreedy@udel.edu> - 2011-10-24 18:14 -0400
  Re: spawnl issues with Win 7 access rights Miki Tebeka <miki.tebeka@gmail.com> - 2011-10-24 17:21 -0700
    Re: spawnl issues with Win 7 access rights Propad <npropadovic@googlemail.com> - 2011-10-25 00:01 -0700
      Re: spawnl issues with Win 7 access rights Tim Golden <mail@timgolden.me.uk> - 2011-10-25 13:19 +0100
      Re: spawnl issues with Win 7 access rights Terry Reedy <tjreedy@udel.edu> - 2011-10-25 21:11 -0400
      Re: spawnl issues with Win 7 access rights Tim Golden <mail@timgolden.me.uk> - 2011-10-26 15:38 +0100
      Re: spawnl issues with Win 7 access rights Terry Reedy <tjreedy@udel.edu> - 2011-10-26 15:20 -0400
        Re: spawnl issues with Win 7 access rights Propad <npropadovic@googlemail.com> - 2011-10-27 03:27 -0700
          Re: spawnl issues with Win 7 access rights Tim Golden <mail@timgolden.me.uk> - 2011-10-27 11:36 +0100
          Re: spawnl issues with Win 7 access rights Terry Reedy <tjreedy@udel.edu> - 2011-10-27 15:53 -0400
          Re: spawnl issues with Win 7 access rights Tim Golden <mail@timgolden.me.uk> - 2011-10-28 09:22 +0100

csiph-web