Want to use PIL, but can't seem to install it
#1
I want to use PIL in an addon I'm making.

I'm using

Code:
from PIL import Image

in my code, however, Python complains:

Code:
ImportError: No module named PIL

I've downloaded the SuperRepo PIL module: http://superrepo.org/script.module.pil/

However, when I try to install the ZIP, I receive no confirmation that it is successful. No error message -- but no "addon enabled" message, either.

I can't find it in the SuperRepo list either, nor in my installed addons, so I would guess it has failed... but I am not sure why?

I am using Windows 7 and XBMC 12.2, if it matters.

Any help appreciated
Reply
#2
You need to first import it in your addon.xml file first.

Code:
<import addon="script.module.pil" version="1.1.7"/>

It goes into the <requires></requires> section.
Reply
#3
I've got that added.
Reply
#4
I've just checked and I do have a script.module.pil the XBMC directory in Program Files, but trying to import it with "from PIL import Image" fails for some reason. My program operates under Python normally, but doesn't run under XBMC.

Any help appreciated
Reply
#5
Try just
Quote:import PIL
maybe?
Reply
#6
I get a similar error with that. Just did a list of installed modules, and there is no PIL or Image or anything in the available list; I'm guessing that although it has been installed into XBMC, it has not been registered somehow with Python. I don't know how to fix this, though...
Reply
#7
In your c:\Program Files(x86)\XBMC\addons\script.module.pil is there a lib folder?

Also delete your addons database file then restart XBMC.
Reply
#8
Remove the crap one you installed from supperrepo. It's useless junk.
Xbmc should already come with an PIL module and you installing the bad one rendered the good one useless.
Please complain at supperrepo that they should remove it at once.
Remove your Addons15.db and reboot.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#9
I decided to delete script.modules.pil, however, upon trying the SuperRepo install zip, it did not come back. Seriously borkeled then, I guess.
I will try your deleting Addons15.db suggestion, if not, I will reinstall XBMC, I haven't got much customisation installed.
Reply
#10
on win32 and darwin, PIL is broken since it was probably compiled and packaged as byte-code (pyc), on win32 and darwin, current xbmc only load .py and .pyo file.

and there's also other problem prevent from the PIL egg be loaded, I made a PR try to fix it: https://github.com/xbmc/xbmc/pull/3100
Reply
#11
This is still a problem on Windows; but is working on Darwin. I tested on Both Win 7 and 8.1 Pro and get the import error reported here.
Reply
#12
(2014-11-21, 16:29)geofstro Wrote: This is still a problem on Windows; but is working on Darwin. I tested on Both Win 7 and 8.1 Pro and get the import error reported here.

please get us a Debug Log :-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#13
font = ImageFont.truetype("C:\Program Files (x86)\XBMC\media\Fonts\arial.ttf", 16)
File "C:\Program Files (x86)\XBMC\addons\script.module.pil\lib\PIL\ImageFont.py", line 218, in truetype
return FreeTypeFont(filename, size, index, encoding)
File "C:\Program Files (x86)\XBMC\addons\script.module.pil\lib\PIL\ImageFont.py", line 134, in __init__
self.font = core.getfont(file, size, index, encoding)
File "C:\Program Files (x86)\XBMC\addons\script.module.pil\lib\PIL\ImageFont.py", line 34, in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed
Reply
#14
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

Is in my code
Reply
#15
We are still waiting for a proper debug log + preferrably your addon.xml, both posted on some pastebin-like site...
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply

Logout Mark Read Team Forum Stats Members Help
Want to use PIL, but can't seem to install it0