rpy is not compatible with os.popen

Issue #72 resolved
Former user created an issue
  1. the code below segfaults {{{ import os

print('open') with os.popen('ls') as f: pass print('closed')

import rpy2.robjects as ro }}}

  1. the code below {{{ import os import rpy2.robjects as ro

print('open') with os.popen('ls') as f: pass print('closed') }}}

gives {{{ $ python3 t.py open Traceback (most recent call last): File "t.py", line 5, in <module> with os.popen('ls') as f: File "/home/users/wrobell/opt/lib/python3.2/os.py", line 792, in popen bufsize=buffering) File "/home/users/wrobell/opt/lib/python3.2/subprocess.py", line 736, in init restore_signals, start_new_session) File "/home/users/wrobell/opt/lib/python3.2/subprocess.py", line 1175, in _execute_child restore_signals, start_new_session, preexec_fn) TypeError: embedded NUL character }}}

above with python 3.2

Comments (5)

  1. Laurent Gautier

    Ian't reproduce the problem with any of the code snippets given with the tip of rpy2-2.2.0, R-2.13, and either Python 2.7.1+ (r271:86832) or 3.2 (r32:88445) on a x86_64 GNU/Linux system.

    I am putting this on hold.

  2. Former user Account Deleted

    Checking the following snippet on different system now. This time on Fedora 14 (64-bit).

    1. Perform fresh install of rpy and run

    import os
    
    with os.popen('ls') as f:
        pass
    
    import rpy2.robjects as ro
    

    Above gives

    Traceback (most recent call last):
      File "t.py", line 7, in <module>
        import rpy2.robjects as ro
      File "/home/wrobell/opt/lib/python3.2/site-packages/rpy2/robjects/__init__.py", line 17, in <module>
        from rpy2.robjects.robject import RObjectMixin, RObject
      File "/home/wrobell/opt/lib/python3.2/site-packages/rpy2/robjects/robject.py", line 5, in <module>
        rpy2.rinterface.initr()
    AttributeError: 'module' object has no attribute 'rinterface'
    

    2. Run the script again and there is no exception, but the script results in Python segfault.

    $ rpm -q glibc gcc binutils
    glibc-2.13-1.x86_64
    glibc-2.13-1.i686
    gcc-4.5.1-4.fc14.x86_64
    binutils-2.20.51.0.7-6.fc14.x86_64
    

    The Python 3.2 was built from sources and installed locally in my home directory.

  3. Log in to comment