freelanceprogrammers.org Forum Index » Delphi
hox to prevent delphi showing dialog error
Joined: 23 Oct 2006
Posts: 5
hox to prevent delphi showing dialog error
Please,
What is the best way to never see error dialog ?
when in python illegal operation like importing module doesn`t exist
an error dialog showing
In my pythonEngine Component i do fatalmsgdls=False.
My code to exec my python file
try
gEngine.ExecStrings(templist);
except
showmessage(`python erreur`); -> this never occurs
end;
When error occurs in python, I`ve always the error dialog showing,
I want to redirect all errors to console without dialog.
If Someone have an Idea.
Joined: 29 Apr 2005
Posts: 103
hox to prevent delphi showing dialog error
Hi,
FatalMsgDlgs is only used when P4D can`t find/initialize Python.dll
and this has nothing to do with executing scripts that raise an
error.
Your "try…except" code is perfectly valid and should catch the
exception.
If it doesn`t, it means that Python did not raise an exception!
And in fact, you should do:
Try
PythonEngine1.ExecString("print MyVarThatDoesNotExist");
Except
On E: EPythonError do
ShowMessage(`Python Error: ` + E.Message);
End;
You can also catch syntax errors like that:
Try
PythonEngine1.ExecString("print dir(");
Except
On E: EPySyntaxError do
ShowMessage(`Syntax Error: ` + E.Message);
End;
Also, if you`re writing a Console application, then you should set
RedirectIO to False. Note that Python will print the error before we
raise the Delphi exception.
Bye,
Morgan
--- In pythonfordelphi@yahoogroups.com, "jobbyworld2"
<jobbyworld@...> wrote:
>
>
> Please,
>
> What is the best way to never see error dialog ?
>
> when in python illegal operation like importing module doesn`t
exist
> an error dialog showing
>
>
> In my pythonEngine Component i do fatalmsgdls=False.
> My code to exec my python file
>
> try
>
> gEngine.ExecStrings(templist);
>
> except
>
> showmessage(`python erreur`); -> this never occurs
>
> end;
>
>
>
> When error occurs in python, I`ve always the error dialog showing,
>
> I want to redirect all errors to console without dialog.
>
> If Someone have an Idea.
>
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







