Issue2349

classification
Title: os.umask no longer exists?
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Milestone: Jython 2.7.0
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: joshfriend, zyasoft
Priority: Keywords:

Created on 2015-05-04.02:32:25 by joshfriend, last changed 2015-05-04.14:21:45 by zyasoft.

Messages
msg9999 (view) Author: Josh Friend (joshfriend) Date: 2015-05-04.02:32:24
Installing `pip` with `get-pip.py` now fails because:

    AttributeError: 'module' object has no attribute 'umask'

I tried chasing down in the hg history where the function disappeared, it moved from `Lib/os.py` to `Lib/posix.py` and I'm not sure what happened after that.

It appears this was previously reported and fixed: http://bugs.jython.org/issue1954

Am I missing something obvious?
msg10000 (view) Author: Jim Baker (zyasoft) Date: 2015-05-04.02:48:32
On OS X 10.10.3 or Windows 8.1 (and presumably other systems):
$ jython27
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_45
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.umask
<java function umask 0x2>

Please don't use get-pip.py for the time being until pip upstream is fixed. We bundle our own version of pip, along with ensurepip. Also ensurepip is run by default when you install Jython 2.7.0 with the installer.
msg10001 (view) Author: Josh Friend (joshfriend) Date: 2015-05-04.03:21:45
> ensurepip is run by default when you install Jython 2.7.0 with the installer.

Good to know, thanks for the info.

Unfortunately it seems that `umask` is still unavailable on OSX (10.10.3) for me:

Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_40
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.umask
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'umask'

However, on Ubuntu trusty 64 bit:

Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.7.0_79
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.umask
<java function umask 0x2>

I installed from https://repo1.maven.org/maven2/org/python/jython-installer/2.7.0/jython-installer-2.7.0.jar
as follows:

$ java -jar jython-installer-2.7.0.jar -s -d jython
Performing silent installation
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
Generating start scripts ...
Installing pip and setuptools
 90 %
java.io.IOException: Cannot run program "jython/bin/jython" (in directory "jython/bin"): error=20, Not a directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at org.python.util.install.ChildProcess.run(ChildProcess.java:272)
    at org.python.util.install.JarInstaller.ensurepip(JarInstaller.java:187)
    at org.python.util.install.JarInstaller.inflate(JarInstaller.java:152)
    at org.python.util.install.ConsoleInstaller.install(ConsoleInstaller.java:66)
    at org.python.util.install.Installation.internalMain(Installation.java:389)
    at org.python.util.install.Installation.main(Installation.java:43)
Caused by: java.io.IOException: error=20, Not a directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 6 more
 100 %
Congratulations! You successfully installed Jython 2.7.0 to directory /Users/josh/jython.
msg10002 (view) Author: Jim Baker (zyasoft) Date: 2015-05-04.03:33:10
Josh, it's possible that you're seeing a similar problem to  http://bugs.jython.org/issue2345 and http://bugs.jython.org/issue2346:

The following environment variables do not usually have to be set, but if they are, they must be set correctly

JAVA_ENCODING - Character set encoding, such as UTF-8
JAVA_MEM - Java memory (sets via -Xmx)
JAVA_OPTS - options to pass directly to Java
JAVA_STACK - Java stack size (sets via -Xss)
JAVA_HOME - Java installation directory, if set the java command is assumed to be at $JAVA_HOME/bin/java
JYTHON_HOME - Jython installation directory
JYTHON_OPTS - default command line arguments

https://wiki.python.org/jython/JythonReleaseNotes
msg10003 (view) Author: Josh Friend (joshfriend) Date: 2015-05-04.04:30:09
None of the listed environment variables were set initially. Setting JAVA_HOME seems to take care of the issue.

jython-2.7.0 should be available through pyenv soon: https://github.com/yyuu/pyenv/pull/370

I also noticed that the IOException seen in the install logs I included previously seems to be preventing pip from being installed. I have to install it manually after the jython install finishes and then it's fine. That's probably a separate issue though, so this can be closed now.

Thank you for your time!
msg10005 (view) Author: Jim Baker (zyasoft) Date: 2015-05-04.12:52:07
Josh, thanks for working this out!

Sounds like the installer should check that the java command is available as part of its pre-install steps, much like it probes for the availability of CPython 2.7.
History
Date User Action Args
2015-05-04 14:21:45zyasoftsetstatus: open -> closed
resolution: invalid
2015-05-04 12:52:08zyasoftsetmessages: + msg10005
2015-05-04 04:30:09joshfriendsetmessages: + msg10003
2015-05-04 03:33:10zyasoftsetmessages: + msg10002
2015-05-04 03:21:45joshfriendsetmessages: + msg10001
2015-05-04 02:48:32zyasoftsetnosy: + zyasoft
messages: + msg10000
2015-05-04 02:32:25joshfriendcreate