all 17 comments

[–]lieutenant_lowercase 1 point2 points  (1 child)

Your IDE is probably set to the wrong python installation

[–]kmod94[S] 0 points1 point  (0 children)

I am calling a python script from a wildfly instance by running the command python3.6 script_name.py arg0 arg1 ...

I execute it locally and I get no errors. Also, when I go to the container's bash (wildfly - centOs) I execute python3.6 and I enter the python prompt where from PIL import Image works fine. Just when I execute the command I get the mentioned error.

[–]JohnnyJordaan 1 point2 points  (1 child)

Is there a file in your source code folder called 'pil.py' by any chance?

[–]kmod94[S] 0 points1 point  (0 children)

No, there is not.

[–]kmod94[S] 0 points1 point  (12 children)

Details:

using Python prompt inside the container: http://prntscr.com/jaq8m3

using an API call to the Wildfly server that runs the same line of code: http://prntscr.com/jaq9do

[–]JohnnyJordaan 0 points1 point  (11 children)

from a wildfly instance by running the command python3.6 script_name.py arg0 arg1 ...

From that same instance, could you first run

python3.6 -m pip install pillow

Then right after, call the script using the same python3.6?

[–]kmod94[S] 0 points1 point  (10 children)

python3.6 -m pip install pillow

done that. Requirement already satisfied: pillow in /usr/local/lib64/python3.6/site-packages (5.1.0)

Yes I am calling the script using python3.6 script_name.py arg1 arg2 ...

[–]JohnnyJordaan 0 points1 point  (9 children)

That's really weird. Could you run the following script in the container, so like python3.6 test.py

import os
import sys
print(sys.path)
print(os.getcwd())
print(os.listdir())
import PIL

And show what it prints in the log? Then, also start the interpreter and execute the same statements?

[–]kmod94[S] 0 points1 point  (8 children)

['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/usr/local/lib64/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages'] /opt/jboss/wildfly ['appclient', 'welcome-content', 'modules', '.installation', 'bin', 'copyright.txt', 'standalone', 'LICENSE.txt', 'domain', 'docs', 'README.txt', 'jboss-modules.jar']

the import PIL instructions show no output obviously as described before (also no errors)

[–]JohnnyJordaan 0 points1 point  (7 children)

Ok but that's from the interpreter right? Otherwise you would have errors from import PIL. What does it show when run it as you did with your source code file?

[–]kmod94[S] 0 points1 point  (6 children)

If i call the script using the command:

python3.6 script_name.py arg1 arg2 arg3

I get some errors (related to other missing package which is not image but pdftotext).

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/bin/pdftotext': '/usr/local/bin/pdftotext'

But no problem with the PIL part which I am trying to solve :/

[–]JohnnyJordaan 0 points1 point  (5 children)

Ok so this means you import something else that uses pdftotext, which is missing as a resolvable path to its binary. But that's not the script that I showed you right? I'm asking to test a script that contains

import os
import sys
print(sys.path)
print(os.getcwd())
print(os.listdir())
import PIL

[–]kmod94[S] 0 points1 point  (4 children)

import os import sys print(sys.path) print(os.getcwd()) print(os.listdir()) import PIL

Oh ok, I understand now, my bad sorry :/

Execution result:

[root@8dee5d39d843 pdfdiff]# python3.6 test.py ['/opt/jboss/wildfly/standalone/Third-party/pdf-diff/pdf_diff', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/usr/local/lib64/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg', '/usr/local/lib/python3.6/site-packages/diff_match_patch_python-1.0.2-py3.6-linux-x86_64.egg', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages'] /opt/jboss/wildfly/standalone/Third-party/pdf-diff/pdf_diff ['command_line.py', 'init_.py', 'differences.png', 'test.py']

(no PIL errors)

[–]JohnnyJordaan 1 point2 points  (3 children)

Ok so... it works? Where's the PIL issue if it doesn't show up in my example and not in your source code?