Python 2.7 application will not run after recent distribution upgrade.

I have been running the PysolFC game since I installed Tumbleweed over a year ago. However recently it has failed to launch.

When executing from the konsole, it generates the following error.

spcwh2@linux-xmhl:~> pysol.py
Traceback (most recent call last):
File “/usr/bin/pysol.py”, line 29, in <module>
from pysollib.main import main
File “/usr/lib/python2.7/site-packages/pysollib/main.py”, line 31, in <module>
from util import DataLoader
File “/usr/lib/python2.7/site-packages/pysollib/util.py”, line 53, in <module>
from mfxutil import Image
File “/usr/lib/python2.7/site-packages/pysollib/mfxutil.py”, line 44, in <module>
import Image
File “/usr/lib64/python2.7/site-packages/PIL/Image.py”, line 27, in <module>
from . import VERSION, PILLOW_VERSION, _plugins
ValueError: Attempted relative import in non-package

I’ve waited for a week or two before posting this to see if the updates to Tumbleweed would resolve this issue. However it persists.

Any help would be appreciated.

Hi
I see the Fedora package has a PIL patch, unfortunately since OBS is maintenance mode can’t branch, patch and test the fix…

As root user manually edit /usr/lib/python2.7/site-packages/pysollib/mfxutil.py and add from PIL to the import lines starting down at line 44;


--- PySolFC-2.0.orig/pysollib/mfxutil.py
+++ PySolFC-2.0/pysollib/mfxutil.py
@@ -41,18 +41,18 @@ from settings import PACKAGE, TOOLKIT
 Image = ImageTk = ImageOps = None
 if TOOLKIT == 'tk':
     try: # PIL
-        import Image
-        import ImageTk
-        import ImageOps
+        from PIL import Image
+        from PIL import ImageTk
+        from PIL import ImageOps
     except ImportError:
         Image = None
     else:
         # for py2exe
-        import GifImagePlugin
-        import PngImagePlugin
-        import JpegImagePlugin
-        import BmpImagePlugin
-        import PpmImagePlugin
+        from PIL import GifImagePlugin
+        from PIL import PngImagePlugin
+        from PIL import JpegImagePlugin
+        from PIL import BmpImagePlugin
+        from PIL import PpmImagePlugin
         Image._initialized = 2

Thanks Malcom, it is working now.