|
From: Régis R. <reg...@gm...> - 2021-03-02 09:50:10
|
Thank you Jeef,
I tried to copy lib into a 'contrib' folder without installing it.
It's a bit better, but it still doesn't work...
Caused by: org.python.core.PySyntaxError: SyntaxError: no viable
alternative at input '"module '{__name__}' has no attribute '{name}'"'
(__init__.py, line 42)
at org.python.core.ParserFacade.fixParseError(ParserFacade.java:95)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.ParserFacade.parse(ParserFacade.java:190)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.compileSource(imp.java:542) ~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.createFromSource(imp.java:575)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.loadFromSource(imp.java:944)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.find_module(imp.java:769) ~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.import_next(imp.java:1158) ~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.import_module_level(imp.java:1350)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.importName(imp.java:1528) ~[jython-2.7.2.jar:2.7.2]
at org.python.core.ImportFunction.__call__(__builtin__.java:1285)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.PyObject.__call__(PyObject.java:433)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.importFromAs(imp.java:1620) ~[jython-2.7.2.jar:2.7.2]
at org.python.core.imp.importFrom(imp.java:1595) ~[jython-2.7.2.jar:2.7.2]
at
openpyxl.drawing.image$py.f$0(C:/Tools/jython2.7.2/Lib/site-packages/openpyxl/drawing/image.py:23)
~[na:na]
at
openpyxl.drawing.image$py.call_function(C:/Tools/jython2.7.2/Lib/site-packages/openpyxl/drawing/image.py)
~[na:na]
I can't figure where it comes from. I commented all functions in image.py
but still get the same error...
Thanks again ! :)
Régis
Le mar. 2 mars 2021 à 00:02, Jeff Mitchell <jef...@za...> a
écrit :
> fwiw, with xlsxwriter, I just imported that and good to go.
>
> https://xlsxwriter.readthedocs.io/
>
> I don't even bother with pip in this one project, I have a 'contrib'
> directory that I drop in various libs. (Connectivity to internet is
> unavailable on this target server, and working on cached egg files or
> whatever seemed like work.) So in this case, I clone the repo to a dir in
> contrib, use sys.path.append ( contrib-dir-path ), and then import
> xlsxwriter
>
>
> On Mon, Mar 1, 2021 at 5:33 PM Régis Ramillien <reg...@gm...>
> wrote:
>
>> Dear jython users,
>>
>> I'm new to python, and I would like to call a python script from java.
>> After a little bit of research, I decided to use jython.
>>
>> I want the java program to let an admin generate custom excel files using
>> python.
>>
>> That's why I need to install openpyxl, multiprocessing and finally pillow
>> to load images into the xlsx.
>>
>> But installing pillow gives me some troubles.
>> First, I got a "java heap space" exception. So I tried installing it
>> using this command:
>>
>> ----------------------------------------------------------------------------------------------
>> jython -J-Xmx1g -m pip install pillow.
>>
>> ----------------------------------------------------------------------------------------------
>> I know, you're right, 1g seems enormous ! But I still get java heap space
>> with 512mb...
>>
>> And with 1g of memory, I receive this stack:
>>
>> ----------------------------------------------------------------------------------------------
>> c:\Tools\jython2.7.2\bin>jython -J-Xmx1g -m pip install pillow
>> [33mDEPRECATION: A future version of pip will drop support for Python
>> 2.7. [0m
>> Collecting pillow
>> Using cached
>> https://files.pythonhosted.org/packages/b3/d0/a20d8440b71adfbf133452d4f6e0fe80de2df7c2578c9b498fb812083383/Pillow-6.2.2.tar.gz
>> [31m ERROR: Complete output from command python setup.py egg_info: [0m
>> [31m ERROR: Traceback (most recent call last):
>> File "<string>", line 1, in <module>
>> File
>> "C:\Users\RGISRA~1\AppData\Local\Temp\pip-install-ctmgop\pillow\setup.py",
>> line 25, in <module>
>> import mp_compile
>> File "mp_compile.py", line 11, in <module>
>> from multiprocessing import Pool, cpu_count
>> File
>> "C:\Tools\jython2.7.2\Lib\site-packages\multiprocessing\__init__.py", line
>> 64, in <module>
>> import multiprocessing.patch
>> File
>> "C:\Tools\jython2.7.2\Lib\site-packages\multiprocessing\patch.py", line 58,
>> in <module>
>> class ConditionPatch(object):
>> File
>> "C:\Tools\jython2.7.2\Lib\site-packages\multiprocessing\patch.py", line 61,
>> in ConditionPatch
>> notify_all = threading._Condition.notifyAll.im_func
>> AttributeError: 'module' object has no attribute '_Condition'
>> ---------------------------------------- [0m
>> [31mERROR: Command "python setup.py egg_info" failed with error code 1 in
>> C:\Users\RGISRA~1\AppData\Local\Temp\pip-install-ctmgop\pillow\ [0m
>> [33mWARNING: You are using pip version 19.1, however version 20.3.4 is
>> available.
>> You should consider upgrading via the 'pip install --upgrade pip'
>> command. [0m
>>
>> ----------------------------------------------------------------------------------------------
>>
>> Does any one able to install pillow on jython ? Or is it a pillow issue ?
>> Or my fault ?
>>
>> Thank you all for your kind help !
>>
>> Best regards,
>>
>> Régis Ramillien
>> _______________________________________________
>> Jython-users mailing list
>> Jyt...@li...
>> https://lists.sourceforge.net/lists/listinfo/jython-users
>>
>
>
> --
>
> Jeff Mitchell
>
> Sr Application Architect
>
> Zayo | Our Fiber Fuels Global Innovation
>
> 1821 30th Street | Unit A | Boulder, CO 80301
>
> Desk: 999.999.9999 | Cell: 999.999.9999
>
> jef...@za...
>
> Purpose <http://zayo.is/signature-purpose> | Network Map
> <http://zayo.is/signature-network> | LinkedIn
> <http://zayo.is/signature-linkedin> | Twitter
> <http://zayo.is/signature-twitter>
>
> This communication is the property of Zayo and may contain confidential or
> privileged information. If you have received this communication in error,
> please promptly notify the sender by reply e-mail and destroy all copies of
> the communication and any attachments.
>
>
> He who dies with the best barbecue sauce, wins.
>
|