Open decalage2 opened 10 years ago
Original comment by Niko Ehrenfeuchter (Bitbucket: ehrenfeu, GitHub: ehrenfeu):
Hi Philippe,
I'll do so, but it might take a while - I'm super busy at the moment. Regarding CPython, I've done some preliminary (manual) tests, as this is anyway also my main platform, and it worked as before. As the changes are only very minimal, and happen only while initially parsing the file (at least as far as I can tell) I wouldn't expect any noticable impact on speed either - but some more serious testing probably wouldn't hurt.
PEP-8 stuff will (of course) go into a separate PR, so you can review it and decide whether you like it or not. However, this will probably take even longer than the Jython stuff ;-)
Cheers ~Niko
Original comment by Philippe Lagadec (Bitbucket: decalage, GitHub: decalage2):
Hi Niko, thanks a lot. Yes, some instructions how to test it with Jython would help. Then I'll merge the pull request. Looking at the code, it should not have an impact on CPython compatibility.
For the PEP-8 suggestions, please send me a separate message by e-mail or bitbucket.
Hi @ehrenfeu, it's been a while but maybe you can still provide the instructions how to run olefile with Jython?
Otherwise I will simply close this issue.
It seems possible to run Travis CI with Jython, that might be a solution to test this: https://www.topbug.net/blog/2012/05/27/use-travis-ci-with-jython/
Unfortunately I still haven't found the time to dig through this again. It's still on my list though, I haven't forgotten about it!
Just FYI, we now (finally!) have some demand to dedicate time to our project again which is involving olefile
, so I will hopefully be able to come up with some Jython test instructions soon!
Now here are some very basic instructions on how to (manually) test olefile
through Jython by parsing some Olympus OIB files. I'm just writing them down here so I don't forget and you get an idea how to do it, if time permits I might go and write some unit tests from them (or provide scripts to facilitate testing).
1.8.0_144
64-Bit on Ubuntu)jython-standalone-2.7.1.jar
)test-olympus-oib-file.oib.zip
(zipped, 22M, provided by me / @imcf)Full-4.oib.zip
(zipped, 2M, provided by image.sc forum user "Raincoat" / Alfonso Schmidt in thread 14553)2712 1-1000 10X S5.oib.zip
(zipped, 1,7M, provided by image.sc forum user "cferrebee" in thread 13889)Assuming we're in a shell in a freshly cloned olefile
repository, we can run these commands to prepare and start a Jython session:
cd test/images
wget https://github.com/decalage2/olefile/files/2270413/test-olympus-oib-file.oib.zip
unzip test-olympus-oib-file.oib.zip
cd ../../olefile
java -jar /path/to/your/jython-standalone-2.7.1.jar
This will get you an interactive Jython shell, ready to import olefile
and start investigating:
import olefile
import codecs
ole = olefile.OleFileIO('../tests/images/test-olympus-oib-file.oib')
stream = ole.openstream(['OibInfo.txt'])
conv = codecs.decode(stream.read(), 'utf16')
print conv
stream = ole.openstream(['Storage00001', 'Stream00060'])
conv = codecs.decode(stream.read(), 'utf16')
print conv
In case of success this prints the details from the selected sections of the OLE file. Will update this post with the outputs later...
Originally reported by: Niko Ehrenfeuchter (Bitbucket: ehrenfeu, GitHub: ehrenfeu)
This issue is mostly meant as notification...
I'm having a scenario where I'd like to use olefile with Jython (the Java implementation of Python), which is unfortunately not 100% compatible to the CPython reference, especially when it comes to data types and number interpretations.
With a lot of debugging I managed to create prototype which is working with Jython 2.7-beta1 on Java 6 / 64-bit (unfortunately I can't use the latest Jython 2.7-beta3 as I am limited to Java 6, for which support was dropped in 2.7-beta2).
It will require a bit more polishing until I can file a pull request. Should be doable in the next days.
@decalage : on top of the Jython stuff, I'd have a couple of suggestions to make the code follow PEP-8 a little better. Are you interested in those?
Cheers ~Niko