Issue1930

classification
Title: traceback raises exception in os.py
Type: Severity: normal
Components: Any Versions: Jython 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amak, fwierzbicki, lsgroup, strangeBear, zyasoft
Priority: normal Keywords:

Created on 2012-06-19.01:58:37 by lsgroup, last changed 2014-07-01.17:55:32 by zyasoft.

Messages
msg7247 (view) Author: lsgroup (lsgroup) Date: 2012-06-19.01:58:36
import traceback results in 
ImportError: no os specific module found
when embedded interpreter is run from java.

Looks like this is because when interpreter is run from inside java, sys.builtin_module_names  does not include 'posix' nor any of the OS names that os.py is looking for in that if else if statement at the beginning of os.py.

When interpreter is run from command line, 'posix' is included in sys.builtin_module_names.



================================
actual stack trace looks like:
================================
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/usr/local/jython2.5.2/Lib/traceback.py", line 3, in <module>
    import linecache
  File "/usr/local/jython2.5.2/Lib/linecache.py", line 9, in <module>
    import os
  File "/usr/local/jython2.5.2/Lib/os.py", line 118, in <module>
    raise ImportError, 'no os specific module found'
================================
msg7332 (view) Author: Anatoly Danilov (strangeBear) Date: 2012-07-21.06:41:00
it should be possible to specify explicitly that 'nt' or 'posix' module should be within builtin. Any ideas how to do that?
msg7781 (view) Author: Alan Kennedy (amak) Date: 2013-02-26.00:40:48
If you look at the bottom of the registry file, you will see an option called "python.modules.builtin", which should allow you to specify the relevant os module for your platform.

"""
# Use this registry entry to control the list of builtin modules; you
# can add, remove, or override builtin modules.  The value for this
# registry key is a comma separated list of module entries, each entry 
# of which has the following allowable forms:
#
# name
#     The module name is `name' and the class name is
#     org.python.modules.name
#
# name:class
#     The module name is `name' and the class name is `class' where
#     class must be a fully qualified Java class name
#
# name:null
#     The module `name' is removed from the list of builtin modules
#
# A good example would be to use a jni version of os for more
# functionality by having an entry such as os:com.foo.jni.os
#python.modules.builtin = whatever

"""
msg8861 (view) Author: Jim Baker (zyasoft) Date: 2014-07-01.17:55:32
Functionality is available, any reason not to close this out?
History
Date User Action Args
2014-07-01 17:55:32zyasoftsetnosy: + zyasoft
messages: + msg8861
2013-02-26 00:40:48amaksetnosy: + amak
messages: + msg7781
2013-02-25 21:42:46fwierzbickisetpriority: normal
versions: + Jython 2.5, - 2.5.2
2012-07-21 06:41:00strangeBearsetnosy: + strangeBear
messages: + msg7332
2012-06-19 02:18:31fwierzbickisetnosy: + fwierzbicki
2012-06-19 01:58:37lsgroupcreate