[Python.NET] Can't Import PIL Image
Brian Lloyd
brian.lloyd at revolution.com
Mon Sep 18 15:39:22 CEST 2006
Are you certain that you have installed PIL into the instance of Python that
you are using with Python for .NET? This is easy to forget - if you are
using the 'built-in' python install that comes with Python for .NET, it will
*not* know about any packages you may have installed in a pre-existing
Python install.
-Brian
On 9/16/06 8:17 PM, "Jen" <Schonlandy at hotmail.com> wrote:
>
> I have a py file using PIL to handle some image staff, and want to invoke its
> method in C#
> The py file works fine under Python or ActivePython (2.3), it looks sth like
> this:
>
> import Image, sys
> def convert(srcImg):
> im = Image.open(srcImg).convert("1").rotate(0)
> data = im.tostring("raw", "1;I")
> ...
> return "".join(strList)
>
> but when invoked in C# it comes with a Python.Runtime.PythonException
> I try to debug the problem, found out that
>
> def test(srcImg):
> return "some thing"
>
> works fine
>
> but
>
> def test(srcImg):
> im = Image.open(srcImg)
>
> not,
> so the problem is caused by unable to import Image
> have any solution? thx in advance
More information about the PythonDotNet
mailing list