Issue2283

classification
Title: site.py should not fail if python.home is not set
Type: Severity: normal
Components: Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: zyasoft
Priority: high Keywords:

Created on 2015-03-09.17:48:53 by zyasoft, last changed 2015-03-27.23:39:16 by zyasoft.

Messages
msg9596 (view) Author: Jim Baker (zyasoft) Date: 2015-03-09.17:48:52
site.py should always be robust to missing settings and follow its default behavior that import-related errors are quietly ignored. The offending code seen in the error reported in http://sourceforge.net/p/jython/mailman/message/33546082/ is found here:

def makepath(*paths):
    dir = os.path.join(*paths)
    if _is_jython and (dir == '__classpath__' or
                       dir.startswith('__pyclasspath__')):
            return dir, dir
    try:
        dir = os.path.abspath(dir)
    except OSError:
        pass
    return dir, os.path.normcase(dir)

That should be easy enough to fix.

Blocker for RC1
msg9673 (view) Author: Jim Baker (zyasoft) Date: 2015-03-18.04:07:22
I'm wrong, it's not in site.makepath, it's in sysconfig, which is imported by site. The expedient change would be:

_PREFIX = os.path.normpath(sys.prefix) if sys.prefix is not None else None
_EXEC_PREFIX = os.path.normpath(sys.exec_prefix) if sys.exec_prefix is not None else None

However this is not sufficient - most subsequent imports will fail.

The python.home property is nearly essential for Jython so that it can find its standard library. We try to guess, and sometimes we are right, but in general it needs to be set.

Revisit as we get more user feedback.
msg9688 (view) Author: Jim Baker (zyasoft) Date: 2015-03-20.18:49:35
Fixed as of https://hg.python.org/jython/rev/b0d8aed3a8cd
History
Date User Action Args
2015-03-27 23:39:16zyasoftsetstatus: pending -> closed
2015-03-20 18:49:35zyasoftsetstatus: open -> pending
resolution: later -> fixed
messages: + msg9688
2015-03-18 04:07:22zyasoftsetpriority: urgent -> high
resolution: later
messages: + msg9673
2015-03-09 17:48:53zyasoftcreate