[New-bugs-announce] [issue5886] curses/__init__.py: global name '_os' is not defined

Andres Moreira report at bugs.python.org
Thu Apr 30 19:11:30 CEST 2009


New submission from Andres Moreira <elkpichico at gmail.com>:

Hi, 
 using ipython2.5 in Ubuntu 9.04. I've get this traceback: 

In [1]: max?
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/var/lib/python-support/python2.5/IPython/iplib.py in
multiline_prefilter(self, line, continue_prompt)
   2272         out = []
   2273         for l in line.rstrip('\n').split('\n'):
-> 2274             out.append(self._prefilter(l, continue_prompt))
   2275         return '\n'.join(out)
   2276 

/var/lib/python-support/python2.5/IPython/iplib.py in _prefilter(self,
line, continue_prompt)
   2254         #print 'pre <%s> iFun <%s> rest <%s>' %
(pre,iFun,theRest)  # dbg
   2255 
-> 2256         return prefilter.prefilter(line_info, self)
   2257 
   2258 

/var/lib/python-support/python2.5/IPython/prefilter.py in
prefilter(line_info, ip)
    149         handler = check(line_info, ip)
    150         if handler:
--> 151             return handler(line_info)
    152 
    153     return ip.handle_normal(line_info)

/var/lib/python-support/python2.5/IPython/iplib.py in handle_help(self,
line_info)
   2443             if line:
   2444                 #print 'line:<%r>' % line  # dbg
-> 2445                 self.magic_pinfo(line)
   2446             else:
   2447                 page(self.usage,screen_lines=self.rc.screen_length)

/var/lib/python-support/python2.5/IPython/Magic.py in magic_pinfo(self,
parameter_s, namespaces)
    661         else:
    662             self._inspect('pinfo', oname, detail_level=detail_level,
--> 663                           namespaces=namespaces)
    664 
    665     def magic_pdef(self, parameter_s='', namespaces=None):

/var/lib/python-support/python2.5/IPython/Magic.py in _inspect(self,
meth, oname, namespaces, **kw)
    746                 pmethod(info.obj,oname,formatter)
    747             elif meth == 'pinfo':
--> 748                 pmethod(info.obj,oname,formatter,info,**kw)
    749             else:
    750                 pmethod(info.obj,oname)

/var/lib/python-support/python2.5/IPython/OInspect.py in pinfo(self,
obj, oname, formatter, info, detail_level)
    553         output = out.getvalue()
    554         if output:
--> 555             page(output)
    556         # end pinfo
    557 

/var/lib/python-support/python2.5/IPython/genutils.pyc in page(strng,
start, screen_lines, pager_cmd)
   1663             # the checks.
   1664             term_flags = termios.tcgetattr(sys.stdout)
-> 1665             scr = curses.initscr()
   1666             screen_lines_real,screen_cols = scr.getmaxyx()
   1667             curses.endwin()

/usr/lib/python2.5/curses/__init__.py in initscr()
     28     # we call setupterm() here because it raises an error
     29     # instead of calling exit() in error cases.
---> 30     setupterm(term=_os.environ.get("TERM", "unknown"),
     31               fd=_sys.__stdout__.fileno())
     32     stdscr = _curses.initscr()

NameError: global name '_os' is not defined


I have python2.6 and python2.5 working together. I've attached a patch
to the code that make ipython2.5 working correctly.

----------
components: Library (Lib)
files: curses_init_patch.patch
keywords: patch
messages: 86846
nosy: andrix
severity: normal
status: open
title: curses/__init__.py: global name '_os' is not defined
type: compile error
versions: Python 2.5
Added file: http://bugs.python.org/file13822/curses_init_patch.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5886>
_______________________________________


More information about the New-bugs-announce mailing list