|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Implicit byte swap on array.fromfile()?All,
I'm porting some scripts from CPython to Jython and I am running into some I/O issue that perhaps someone could clarify whether this is a bug or a feature of jython v2.2.1. Basically, I am loading some floats from a binary stream into an array. Something like, import array a = array.array('f') a.fromfile(Reader,10) where Reader is actually the stdout of a C program captured with popen2(): Reader, Writer = popen2(cmdline,bufsize=0) On CPython 2.5 I get the values as expected. Under jython, the numbers are byte swapped, that is, a.byteswap() produce the correct values. It appears that somewhere along jython is assuming that the Reader stream is in network byte order and doing the swap for me. Not surprisingly, I have no problem getting strings from Reader. Is there a way for me to disable this automatic byte swap when reading floats? Thank you, Arlindo -- Arlindo da Silva dasilva@... ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: Implicit byte swap on array.fromfile()?All,
I just realized that on both Mac OS X 8.5/Intel and Linux/Ubuntu 8.04 I always get os.byteorder='big' with Jython, while CPython gives me os.byteorder='little' as expected. This is probably a reflection of the fact that the JVM is big-endian regardless of the endianess of the underlying hardware. This could explain the automatic byteswapping in my original posting. Can someone confirm this?
Arlindo On Thu, Jun 19, 2008 at 2:12 PM, Arlindo da Silva <dasilva@...> wrote: All, -- Arlindo da Silva dasilva@... ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
import error in hashlibHi, I am trying to import hashlib in my jython script......and getting error msg No Module named _md5 Here is traceback result File C:\Python25\Lib\hashlib.py line 60 in _get_built_constructor File C:\Python25\Lib\hashlib.py Line 133 my current directory is c:\grinder-3.0.1
If this is standard problem of importing Python modules in Jython (like parsers, XMLstring)....is there a way to use same Hash sha1 functionality in Jython ..may be using Java ? can someone please share that recipe.
Thanks -Balbir
|
|
|
Re: import error in hashlibHi, Jython 2.2 currently only supports Jython 2.2 and a little 2.3
stuff. Python 2.5 will be supported when Jython 2.5 is released sometime in the
future. So importing python 2.5 modules into the current Jython more than
likely won’t work. I’d recommend using a Java lib. But which one, I
don’t know maybe google will help you there. Greg. From:
jython-users-bounces@... [mailto:jython-users-bounces@...]
On Behalf Of Balbir.Kaur@...
File C:\Python25\Lib\hashlib.py Line 133 my current directory is c:\grinder-3.0.1 If this is
standard problem of importing Python modules in Jython (like parsers,
XMLstring)....is there a way to use same Hash sha1 functionality in Jython
..may be using Java ? can someone
please share that recipe. Thanks
-Balbir
This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: import error in hashlibOn Fri, Jun 20, 2008 at 11:19 AM, <Balbir.Kaur@...> wrote:
> I am trying to import hashlib in my jython script......and getting error msg > > No Module named _md5 Jython 2.2 does have the sha module: http://docs.python.org/lib/module-sha.html You'll want to update to hashlib when things move to 2.5, but you should be able to import sha directly for now. Charlie ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
| Free Forum Powered by Nabble | Forum Help |