classification
Title: curses/__init__.py: global name '_os' is not defined
Type: compile error Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, andrix
Priority: normal Keywords: patch

Created on 2009-04-30 17:11 by andrix, last changed 2009-04-30 17:47 by amaury.forgeotdarc. This issue is now closed.

Files
File name Uploaded Description Edit
curses_init_patch.patch andrix, 2009-04-30 17:11 patch
Messages (2)
msg86846 - (view) Author: Andres Moreira (andrix) Date: 2009-04-30 17:11
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.
msg86847 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-04-30 17:47
These lines in curses/__init__.py have been added in trunk and patched 
in the python26-maint branch; never in python25-maint. 

How do they appear in your 2.5 version?
Do you use a customized version? In any case the patch was not correctly 
applied.
Closing as invalid. Please contact your package maintainer.
History
Date User Action Args
2009-04-30 17:47:59amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg86847

resolution: not a bug
2009-04-30 17:11:28andrixcreate