matplotlib-0.87.2 on Windows - ValueError: close_fds is not supported on Windows platforms

Dear All,

Using the new matplotlib-0.87.2 on Windows, I get the following error
message:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=True)
  File "C:\Python\lib\subprocess.py", line 500, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms

Changeing all the `close_fds=True' -> `close_fds=False', I get the
following:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=False)
  File "C:\Python\lib\subprocess.py", line 533, in __init__
    (p2cread, p2cwrite,
  File "C:\Python\lib\subprocess.py", line 593, in _get_handles
    p2cread = self._make_inheritable(p2cread)
  File "C:\Python\lib\subprocess.py", line 634, in _make_inheritable
    DUPLICATE_SAME_ACCESS)
TypeError: an integer is required

Changed all the stdout=PIPES to stdout=STDOUT, but get the same error...

I've read through PEP-324 and subprocess.html but these PIPES confuses
me...

I thought computers work with CPUs, chips, wires and PCBs etc. ... but
not PIPES ... or at least not my win32 type computer, maybe Linux uses
different hardware ... >:-)

(At to that `file descriptors', `child process', `stdin', `stdout',
`stderr'...)

Would something like the following work?

if sys.platform == 'win32':
  stdin, stdout, stderr = os.popen3(command)
  verbose.report(stdout.read(), 'debug-annoying')
  err = stderr.read
  if err: verbose.report(err, 'helpful'):
    ...
else:
      process = Popen(command, shell=True, stderr=STDOUT,
                      stdout=PIPE, close_fds=True)
      exit_status = process.wait()
      if exit_status:
    ...

PJR

This is frustrating. subprocess is listed under the Generic Operating System
Services in the Python Reference Manual, and there is no mention of
incompatibility in the module's doc string.

I suggest that usetex users on windows continue to use mpl-0.87.1 for now.
I'll work on fixing this today.

···

On Friday 17 March 2006 04:19, Randewijk P-J <pjrandew@...841...> wrote:

Dear All,

Using the new matplotlib-0.87.2 on Windows, I get the following error
message:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=True)
  File "C:\Python\lib\subprocess.py", line 500, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms

Can anyone tell me if the popen2 module is compatible with MacOS? From the
docs: "This module allows you to spawn processes and connect their i/o/err
pipes and obtain return codes under Unix and Windows."

···

On Friday 17 March 2006 08:25, Darren Dale wrote:

On Friday 17 March 2006 04:19, Randewijk P-J <pjrandew@...841...> wrote:
> Dear All,
>
> Using the new matplotlib-0.87.2 on Windows, I get the following error
> message:
>
> File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
> in make_ps
> stdout=PIPE, close_fds=True)
> File "C:\Python\lib\subprocess.py", line 500, in __init__
> raise ValueError("close_fds is not supported on Windows "
> ValueError: close_fds is not supported on Windows platforms

This is frustrating. subprocess is listed under the Generic Operating
System Services in the Python Reference Manual, and there is no mention of
incompatibility in the module's doc string.

I suggest that usetex users on windows continue to use mpl-0.87.1 for now.
I'll work on fixing this today.

Does this work on windows?

···

On Friday 17 March 2006 04:19, Randewijk P-J <pjrandew@...841...> wrote:

Dear All,

Using the new matplotlib-0.87.2 on Windows, I get the following error
message:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=True)
  File "C:\Python\lib\subprocess.py", line 500, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms

Does this work for you?

import subprocess
process = subprocess.Popen(['dir'], shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stat = process.wait()
print process.stdout.read()

···

On Friday 17 March 2006 04:19, Randewijk P-J <pjrandew@...841...> wrote:

Dear All,

Using the new matplotlib-0.87.2 on Windows, I get the following error
message:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=True)
  File "C:\Python\lib\subprocess.py", line 500, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms

I've updated (and also re-renamed) subprocess.py to the latest Python
upstream version in svn. Unfortunately it looks like it still has this
comment about Windows specific code for close_fds, so I don't believe it
addresses this issue. I'm going to send another email to the
matplotlib-dev list regarding another issue...

Darren Dale wrote:

···

On Friday 17 March 2006 04:19, Randewijk P-J <pjrandew@...841...> wrote:

Dear All,

Using the new matplotlib-0.87.2 on Windows, I get the following error
message:

File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
   stdout=PIPE, close_fds=True)
File "C:\Python\lib\subprocess.py", line 500, in __init__
   raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms
   
Does this work for you?

import subprocess
process = subprocess.Popen(['dir'], shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stat = process.wait()
print process.stdout.read()

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I just changed texmanager.py and backend_ps.py in svn, so they do not use the
subprocess module anymore. You can point your web browser to
http://svn.sourceforge.net/viewcvs.cgi/matplotlib/trunk/matplotlib/lib/matplotlib/
to get the updated versions of these files.

Darren

···

On Friday 17 March 2006 04:19, Randewijk P-J <pjrandew@...841...> wrote:

Dear All,

Using the new matplotlib-0.87.2 on Windows, I get the following error
message:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=True)
  File "C:\Python\lib\subprocess.py", line 500, in __init__
    raise ValueError("close_fds is not supported on Windows "
ValueError: close_fds is not supported on Windows platforms

Changeing all the `close_fds=True' -> `close_fds=False', I get the
following:

  File "c:\Python\lib\site-packages\matplotlib\texmanager.py", line 245,
in make_ps
    stdout=PIPE, close_fds=False)
  File "C:\Python\lib\subprocess.py", line 533, in __init__
    (p2cread, p2cwrite,
  File "C:\Python\lib\subprocess.py", line 593, in _get_handles
    p2cread = self._make_inheritable(p2cread)
  File "C:\Python\lib\subprocess.py", line 634, in _make_inheritable
    DUPLICATE_SAME_ACCESS)
TypeError: an integer is required

Changed all the stdout=PIPES to stdout=STDOUT, but get the same error...

I've read through PEP-324 and subprocess.html but these PIPES confuses
me...

I thought computers work with CPUs, chips, wires and PCBs etc. ... but
not PIPES ... or at least not my win32 type computer, maybe Linux uses
different hardware ... >:-)

(At to that `file descriptors', `child process', `stdin', `stdout',
`stderr'...)

Would something like the following work?

if sys.platform == 'win32':
  stdin, stdout, stderr = os.popen3(command)
  verbose.report(stdout.read(), 'debug-annoying')
  err = stderr.read
  if err: verbose.report(err, 'helpful'):
    ...
else:
      process = Popen(command, shell=True, stderr=STDOUT,
                      stdout=PIPE, close_fds=True)
      exit_status = process.wait()
      if exit_status:
    ...

PJR

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Darren S. Dale, Ph.D.
Cornell High Energy Synchrotron Source
Cornell University
200L Wilson Lab
Rt. 366 & Pine Tree Road
Ithaca, NY 14853

dd55@...163...
office: (607) 255-9894
fax: (607) 255-9001