Sheng Qiang Xu | 7 Feb 11:22
Picon
Favicon

Cannot input password with getpass module in jython.2.5.1

I downloaded jython 2.5.1 from www.jython.org and tried to use getpass.getpass() to input a password.
I got a warning " Problem with getpass. Passwords may be echoed."
And after I input the password and pressed Enter, the method didn't return. It just hung there.
Here is the screenshot.



I tried to debug getpass.py in Lib directory and found "import msvcrt" failed and it used default_getpass to read password and input hung at sys.stdin.readline().

My questions: 1. How to avoid the warning message?
2. Why "import msvcrt" failed? From the codes, it's for Windows and my OS is Windows XP.
3. What may cause sys.stdin.readline() to hang?

My platform infomation:
OS: Windows XP
Language: Chinese
Jython: 2.5.1


Best Regards
--------------------
Sean

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Greg Hellings | 4 Feb 18:35
Picon

modjy question

I'm trying to get modjy up and running using the basic instructions at
http://www.jython.org/jythonbook/en/1.0/SimpleWebApps.html. I have now
tried the same files and settings on both Glassfish 3.1.1 and JBoss AS
7. Both of them give me the following exception which is
indecipherable to me:

Traceback (most recent call last):
  File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py",
line 80, in service
  File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py",
line 76, in service
  File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py",
line 103, in dispatch_to_application
  File "/home/greg/Projects/glassfish3/glassfish/domains/domain1/eclipseApps/web2py-bridge/WEB-INF/lib-python/Lib.zip/modjy/modjy.py",
line 121, in raise_exc
modjy.modjy_exceptions.ApplicationException: Invalid placeholder in
string: line 9, col 5724
	at org.python.core.PyException.fillInStackTrace(PyException.java:70)
	at java.lang.Throwable.<init>(Throwable.java:198)
	at java.lang.Exception.<init>(Exception.java:46)
...

Can anyone give me an idea what is going wrong here or what this
message means? I thought at first it might have something to do with
JBoss AS 7, since it is mentioned in the jython Book as having some
slight differences from Glassfish and other applications. However,
Glassfish is giving me the same error.

Any pointers would be most welcome.

--Greg

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
Chris Clark | 3 Feb 00:57
Favicon

import failures of core java libraries with Jython 2.2.1

I've discovered an odd Jython 2.2.1 specific problem, importing java.sql 
or java.awt fails.

Jython 2.2rc1 doesn't seem to have this problem (at least for java.sql).

Jython 2.5.2 works fine for both too.

I breifly tried to use 
org.python.core.JavaImporter().load_module('java.sql'), whilst this 
doesn't error, it doesn't seem to offer access to those libs.

The awt problem appears to show a bug with the "pawt" package that is 
shipped with Jython.

Any ideas? Any workarounds or tips on how to use JavaImporter?

Sometimes it is possible to "import java" and then access "java.sql", 
etc. but this doesn't work here either.

Here is a sample session from a Windows 7 machine:

    C:\jython2.2.1>java -jar jython.jar
    Jython 2.2.1 on java1.6.0_21
    Type "copyright", "credits" or "license" for more information.
     >>> import java
     >>> import java.sql
    Traceback (innermost last):
       File "<console>", line 1, in ?
    ImportError: no module named sql
     >>> import java.math
     >>> import java.lang
     >>> import java.util
     >>> import java.awt
    Traceback (innermost last):
       File "<console>", line 1, in ?
    ImportError: no module named awt
     >>> import pawt
    Traceback (innermost last):
       File "<console>", line 1, in ?
       File "C:\jython2.2.1\jython.jar\Lib/pawt/__init__.py", line 2, in ?
    ImportError: cannot import name awt

Chris

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Sharon Lucas | 31 Jan 22:34
Picon
Favicon

NullPointerException using a copy of a PyFile object in Jython 2.5.2

With Jython 2.5.2, it allows doing a shallow or deep copy of a file object (which wasn't allowed in Jython 2.1).  However, when you try to use the copied file (e.g. print it, write to it, etc), you get a NullPointerException.  Is this a known bug?

It seems to me that if Jython 2.5.2 also cannot perform a valid shallow copy or deep copy of a PyFile object that it should give a similar error as it did in Jython 2.1 when doing the copy instead of later when trying to use the copied PyFile object.  This new behavior is causing issues in our Java application that we migrated to use Jython 2.5.2 instead of Jython 2.1.

C:\tools\jython2.5.2>jython.bat
Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[IBM J9 VM (IBM Corporation)] on java1.5.0
Type "help", "copyright", "credits" or "license" for more information.
>>> log_file = open('C:\Test\log.txt', "w")
>>> print log_file
<open file 'C:\Test\log.txt', mode 'w' at 0x2>
>>> import copy
>>> log_file2 = copy.deepcopy(log_file)   <== copy.copy(log_file) will also cause NullPointerException
>>> type(log_file2)
<type 'file'>
>>> print log_file2                       <== log_file2.write("hi") and str(log_file2) also cause NullPointerExceptions.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
java.lang.NullPointerException
        at org.python.core.PyFile.file_toString(PyFile.java:499)
        at org.python.core.PyFile.toString(PyFile.java:510)
        at org.python.core.PyObject.__repr__(PyObject.java:174)
        at org.python.core.PyObject.__str__(PyObject.java:207)
        at org.python.core.StdoutWrapper.print(StdoutWrapper.java:116)
        at org.python.core.StdoutWrapper.println(StdoutWrapper.java:214)
        at org.python.core.Py.println(Py.java:1393)
        at org.python.pycode._pyx5.f$0(<stdin>:1)
        at org.python.pycode._pyx5.call_function(<stdin>)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1261)
        at org.python.core.Py.exec(Py.java:1305)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:215)
        at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
        at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
        at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:46)
        at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
        at org.python.util.jython.run(jython.java:317)
        at org.python.util.jython.main(jython.java:129)

java.lang.NullPointerException: java.lang.NullPointerException
>>>

In Jython 2.1, attempting to perform a shallow or deep copy of a PyFile object failed up front with an error message saying that objects of type PyFile are un-copyable.  For example:

C:\tools\jython-2.1>jython.bat
Jython 2.1 on java1.5.0 (JIT: j9jit23)
Type "copyright", "credits" or "license" for more information.
>>> log_file = open('C:\Test\log.txt', "y")
>>> print log_file
<file C:\Test\log.txt, mode y at 1392792324>
>>> import copy
>>> log_file2 = copy.deepcopy(log_file)
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "C:\tools\jython-2.1\Lib\copy.py", line 159, in deepcopy
Error: un-deep-copyable object of type org.python.core.PyFile
>>> log_file2 = copy.copy(log_file)
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "C:\tools\jython-2.1\Lib\copy.py", line 78, in copy
Error: un(shallow)copyable object of type org.python.core.PyFile
>>>

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   lucass <at> us.ibm.com
(512) 286-7313 or Tieline 363-7313
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Sheng Qiang Xu | 29 Jan 12:50
Picon
Favicon

Re: I can only input a character with java.lang.System.console().readline() in Chinese or Japanese language

Could somebody help to take a look at this?
Thanks.

Best Regards
--------------------
Sean

Sheng Qiang Xu---01/21/2012 01:13:10 AM---Sheng Qiang Xu/China/IBM

          Sheng Qiang Xu/China/IBM

          01/21/2012 01:13 AM


To

Johannes Buchner <buchner.johannes <at> gmx.at>,

cc

jython-users <at> lists.sourceforge.net

Subject

Re: [Jython-users] I can only input a character with java.lang.System.console().readline() in Chinese or Japanese language
Thanks Johannes.
Sorry for late response.

I tried with plain Java andI can input characters. Here is the test file. (See attached file: test.java)
Compile it and run it in windows console
>> java -classspath "." test

However, in the same console, after I start jython console with "java -jar jython.jar "
and run "import java; java.lang.System.console().readLine()",
I can still input only a character and the console echoed what I input, like u'c' ( c is what I input)

Here is my environment:
OS: windows XP sp3
Language: Chinese (same issue in Japanese)
JDK: 1.6
Jython: 2.5.1

Any suggestions are appreciated.

Thanks.
Sean


Johannes Buchner ---2012/01/18 18:03:09---On 01/18/12 04:17, Sheng Qiang Xu wrote:

          Johannes Buchner <buchner.johannes <at> gmx.at>

          2012/01/18 18:01


To

jython-users <at> lists.sourceforge.net

cc


Subject

Re: [Jython-users] I can only input a character with java.lang.System.console().readline() in Chinese or Japanese language

On 01/18/12 04:17, Sheng Qiang Xu wrote:
> I'm using jython 2.5.1 and my OS is windows XP and language is
> Chinese.
>
> When using java.lang.System.console().readline() to input text, I
> can only input a character (the behavior seems like pressing enter)
> and the console jumps to next line.
>
> Could somebody pls help to take a look at this?

Does the same happen with plain Java? If yes, please file a bug for Java.

Cheers,
Johannes

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



Attachment (test.java): application/octet-stream, 179 bytes
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Sheng Qiang Xu | 18 Jan 04:17
Picon
Favicon

I can only input a character with java.lang.System.console().readline() in Chinese or Japanese language

I'm using jython 2.5.1 and my OS is windows XP and language is Chinese.

When using java.lang.System.console().readline() to input text, I can only input a character (the behavior seems like pressing enter) and the console jumps to next line.

Could somebody pls help to take a look at this?
Thanks.


Best Regards
--------------------

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Chris Clark | 13 Jan 21:21
Favicon

Re: Jython 2.2 and Windows 7

On 1/10/2012 11:17 PM, Roger Marquis wrote:
> fwierzbicki wrote:
>> It is true that 2.2 is no longer maintained -- though if someone
>> (other than me) where interested enough to learn how to put together a
>> 2.2 release with some simple updates I'd be open to discussing it. I'd
>> probably even help :)
> I personally would love to see 2.2.X maintained and could probably be
> coerced into submitting a patch or two if it were.  We still use 2.2 for
> the bytecode compiler, which we then obfuscate to protect our (non-OSS)
> IP.
>

Thanks for the offer Frank. I can manage a few (python) patches but I'm 
not ready to take on release builds for Jython! I personally use Jython 
so I don't have to use Java/ant ;-) It makes deploying scripts/apps to 
friends/family very easy.

Are any companies (on this mailing list) relying on Jython (2.2) for 
their commercial product? If so are you already performing release 
builds? Do you want Windows 7 support?

Chris

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
Sheng Qiang Xu | 13 Jan 15:38
Picon
Favicon

I can only input a character using java.lang.System.console().readXXX in jython 2.5.1

Hi friends,

I'm using jython 2.5.1 in a windows XP machine and the language is Japanese.

I find a weird thing about inputting characters in the console.
Using java.lang.System.console().readLine (or readPassword), I can only input a character, after that, the input is over.
But if I change my language to English and the input is OK.

Here is what I did in the console:
java -jar jython.jar
>> import java
>>java.lang.System.console().readLine() (after inputting a character, the call ends)
>>

Could somebody pls take a look at this?
Pls let me know if you need more info and thanks a lot..

Sean

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Roger Marquis | 11 Jan 08:17

Re: Jython 2.2 and Windows 7

fwierzbicki wrote:
> It is true that 2.2 is no longer maintained -- though if someone
> (other than me) where interested enough to learn how to put together a
> 2.2 release with some simple updates I'd be open to discussing it. I'd
> probably even help :)

I personally would love to see 2.2.X maintained and could probably be
coerced into submitting a patch or two if it were.  We still use 2.2 for
the bytecode compiler, which we then obfuscate to protect our (non-OSS)
IP.

Roger Marquis

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
Chris Clark | 9 Jan 18:24
Favicon

Jython 2.2 and Windows 7

TL;DR

Jython 2.2 "fails" under Windows 7 (e.g. os.environ lookups), see http://odiexperts.com/jython-os-bug-in-windows-7

Slightly longer.

After reading http://pydev.blogspot.com/2011/12/preparing-for-pydev-230.html I was reminded how much smaller Jython 2.2 is than 2.5.x (when 2.5 came out I jumped at it), so I've used 2.2 on a couple of small projects recently as the deployment size is super tiny :-) This isn't a dig against 2.5, just a cool re-discovery.

However... I just ran a script on a Windows 7 machine and got some odd warnings/errors about "sh" "env" calls, which are obviously Unix'y. It turns out javashell.py has a list of hard coded platforms for working out the "style" of platform. I'm not the first to hit this, http://odiexperts.com/jython-os-bug-in-windows-7 has a note on this. What is the support status of Jython 2.2? Is there value in logging an issue with a patch? We can't use the 2.5 javashell.py as that expects the subprocess module. My change is fairly simple:

In _getOsType, instead of:

    if not foundType:
        foundType = "posix" # default - posix seems to vary most widely

Have:

    if not foundType:
        if 'windows' in os.lower():
            foundType = "nt"
        else:
            foundType = "posix"  # default - posix seems to vary most widely


Chris

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users
Sheng Qiang Xu | 5 Jan 11:29
Picon
Favicon

assert and print behave differently to display the message

I am using Jython 2.5.1 and find a strange behavior for assert and print. Pls see the following lines.

1. assert False == True, u"\u4eee\u60f3\u30a4\u30e1\u30fc\u30b8\u300c"

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Error in sys.excepthook:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

2. print u"\u4eee\u60f3\u30a4\u30e1\u30fc\u30b8\u300c"

output: b

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users

Gmane