0

My environment is delphi7 and Python2.6.6, python for delphi installed.

But when I run a test app, I got a runtime error.

Microsoft Visual C++ Runtime Library
Runtime Error!
program:E:\programming\delphi\p4dtest\dd\project1.exe

This application has requeste, the Runtime to terminate it in an unusual way.  
Please contact the application's support team for more information.

test.py:

import ctypes
print 'hello'

delphi app main:

procedure TForm1.Button1Click(Sender: TObject);
begin
      PyExeFile('test.py', PE);    
end;

It runs ok if I remove the line "import ctypes", but failed if ctypes is imported.

I googled and found an issue on this: http://code.google.com/p/python4delphi/wiki/P4DPython26.

According to the article, I compile the res file and put the res file and Microsoft.VC90.CRT.manifest even msvcr90.dll in the project folder, add XP_UAC.RES in the project file, but I still got the error. Then I reinstalled the Microsoft Visual C++ 2008 SP1 Redistributable Package, but it seems not the problem. Did anyone use the P4D under python2.6 successfully, please tell me how I can make it.

==================================
Now i have solved the ploblem by myself through reading the issues on the official website of P4D:

1、In the pythonengine property tab

‍keep set  “UseLastKnownVersion” to True

‍keep ‍set   "DLLName"  to  python26

2、on your PythonEngine component and adjust your define:

{$DEFINE PYTHON26}

which you can do in the project options of Delphi 7.  
Just add PYTHON26 to the "conditional defines" dialog box.

By the way, I don't mean to confuse everyone of my question, if it does, I'm sorry for that, so please don't devote others' question arbitrarily if you didn't try by yourself.

4
  • 1
    "failed" is not an error report. Commented Mar 17, 2011 at 17:07
  • If you want to add clarification, simply edit your question. The answer your posted was simply too large to merge. Answers are reserved for just that, answers to your question. Commented Mar 18, 2011 at 12:47
  • 1
    sorry to trouble you for this,i'v re-edited the post. Commented Mar 19, 2011 at 3:07
  • 1
    Thanks for editing your question; you can put your solution in as an answer, then accept that answer in 2 days. Note that many users would appreciate it if you would beef up your editing a bit (Start sentences with a captial letter, use correct interpunction, use a bit more markup, etc). By making your questions and answers readable, you get a much higher chance that people actually read them, try to answer them (if they are questions) and vote for them. Commented Mar 19, 2011 at 8:24

2 Answers 2

1

Maybe I did't describe my question clearly. Now i have solved the ploblem by myself through reading the issues on the official website of P4D:

1、In the pythonengine property tab

‍keep set  “UseLastKnownVersion” to True

‍keep ‍set   "DLLName"  to  python26

2、On your PythonEngine component and adjust your define:

{$DEFINE PYTHON26}

which you can do in the project options of Delphi 7.  
Just add PYTHON26 to the "conditional defines" dialog box  
Sign up to request clarification or add additional context in comments.

Comments

1

I tried the solution of babykick, but kept getting the error message: can't load python25.dll

The following worked for me. (delphi7, python26, windows xp sp3)

Open the TPythonEngine property tab and apply the following modifications

  • DllName : python26.dll
  • DllPath : c:\windows\system32\
  • UseLastknownVersion : false

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.