clonly / python4delphi

Automatically exported from code.google.com/p/python4delphi
0 stars 0 forks source link

ERROR IN DEMO 29? #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Hi, I'm using py4d on delphi2010 on windows vista. No matter what type of image 
i load, the prompt always reads:

Traceback (most recent call last):
  File "<string>", line 6, in ProcessImage
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1982, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file'

Does anyone know how to make it work?

Original issue reported on code.google.com by niall.ma...@gmail.com on 18 Aug 2012 at 8:04

GoogleCodeExporter commented 9 years ago
Which version of Delphi are you using?  Just by browsing the code I can see 
that there may be a Unicode compatibility issue in this function:

function BinStrToPyStr(const AString : String) : Variant;
var
  _str : PPyObject;
begin
  _str := GetPythonEngine.PyString_FromStringAndSize(PAnsiChar(AString), Length(AString));
  Result := VarPythonCreate(_str);
  GetPythonEngine.Py_DECREF(_str);
end;

Original comment by pyscripter on 27 Aug 2012 at 1:37

GoogleCodeExporter commented 9 years ago
Hi,
I'm using Delphi 2010.

Original comment by niall.ma...@gmail.com on 27 Aug 2012 at 7:45

GoogleCodeExporter commented 9 years ago
Partially fixed in version control.  Note that to use the PIL library (C 
extension) with Python version 2.6 or later you need to add a manifest 
(http://code.google.com/p/python4delphi/wiki/P4DPython26).  This has been added 
to the project.

There is one part of the code that I could not get it to work.  (see TODO 
item).  If anyone can find a workaround, that would be great.

Original comment by pyscripter on 28 Aug 2012 at 1:14