Hello folks, my name is Kevin, HAM call vk3ukf, site www.vk3ukf.com I am brand new to Python and having the big learn at the moment. Running Windows XP pro SP3 with Delphi 7 free version I installed Python 2.6 and the 1.1.6 PIL to go with it Now, because I am running the free version of Delphi 7.
I had to remove the vcldb and maybe some other reference in PythonForDelphi installation files. They were removed to allow me to fix the Delphi Python installation *.dpk files in the C:\Program Files\PythonForDelphi\Components directory, for Delphi to accept and compile them. Oh, and I had to rename the Python26.dll to Python25.dll for Delphi to operate. ??? I got it going, but it may be crippled in some ways. I tired an example that executes wonderfully on its own, using the Python in my machine. This will display basic info on the image such as format type and dimensions and convert a *.PGM format image with the filename r9516294.pgm into a *.JPG format image and then save it as ZZZZ.jpg. # Python Test File - ImageOpen3.py import os, sys import Image infile = "r9516294.pgm" im = Image.open(infile) print im.format, im.size, im.mode outfile = "ZZZZ.jpg" if infile != outfile: try: Image.open(infile).save(outfile) except IOError: print "cannot convert", infile # end of Py code That works fine when run from IDLE, Pythons own engine and debugger. It also works fine if I call it from my Delphi app. as an external app. to be run using the Delphi code, procedure TForm1.Button4Click(Sender: TObject); begin ShellExecute(Handle, 'open', PChar('ImageOpen3.py'), nil, nil, SW_SHOWNORMAL) ; end; My problem occurs when I attempt to run this Python script in the following way from Delphi The Delphi form has an AtomPythonEngine1 and a PythonInputOutput1 on it. The IO property of the AtomPythonEngine1 is set to PythonInputOutput1. procedure TForm1.Button2Click(Sender: TObject); begin PyExeFile('ImageOpen3.py', AtomPythonEngine1); end; My Delphi app. crashes, saying the application has requested to terminate in an unusual way. Really!! I also tried, procedure TForm1.Button5Click(Sender: TObject); begin PyExe('ImageOpen3.py', AtomPythonEngine1); end; That produces the error, exceptions.NameError: name 'ImageOpen3' is not defined. If I include the code, procedure TForm1.FormCreate(Sender: TObject); begin PyExeFile('ImageOpen3.py', AtomPythonEngine1); end; The app. crashes upon starting, again with the message about the unusual ways. I tried building the Py code line by line and getting Delphi to run it. It began to crash as soon as I included the Python code, import Image. This line of code is OK though, import os, sys This is not very good, as it is images I am trying to manipulate. I tried this, from PIL import Image That also crashed with unusual ways. I am still wading through the demos and tutorials. I am obviously perplexed, it doesn't seem to be a lacking in Python, as the script runs beaut on its own. I think Delphi has a problem, possibly me and my current lack of knowledge, hoping it's not anything else. Any help, much appreciated. Thanks in advance to the list, Kevin. -- http://mail.python.org/mailman/listinfo/python-list