zMotoR
Members-
Content Count
9 -
Joined
-
Last visited
Everything posted by zMotoR
-
Hello. I faced with a problem.. exit command in a python script terminates a delphi app. I use Demo1 app for testing. How to prevent terminating the app if I use exit command? Or how to get around the problem? I use this simple script to test: exit()
-
All these decisions are on the Python side. 😞 I need a decision on a Delphi side, without changing the Python script.
-
Hello. I'd like to use chromium to analyze web content via P2D + chromedriver.exe + chromium. But my app freezes on executing webdriver.Chrome. But this script works fine via python.exe. How to make the code to work fine with P2D? import requests, os, urllib3, shutil, tempfile, zipfile, datetime, time, winreg import selenium from selenium import webdriver CHROMEDRIVER = os.path.abspath("chromedriver.exe") BINARY_LOCATION = os.path.abspath(r"chromium\chrome.exe") chrome_options = selenium.webdriver.chrome.options.Options() chrome_options.binary_location = BINARY_LOCATION browser = webdriver.Chrome(CHROMEDRIVER, options=chrome_options) browser.get('http://www.google.com/');
-
I found a decision. Have to add the option --no-sandbox: chrome_options.add_argument("--no-sandbox") The full script: import requests, os, urllib3, shutil, tempfile, zipfile, datetime, time, winreg import selenium from selenium import webdriver CHROMEDRIVER = os.path.abspath("chromedriver.exe") BINARY_LOCATION = os.path.abspath(r"chromium\chrome.exe") chrome_options = selenium.webdriver.chrome.options.Options() chrome_options.binary_location = BINARY_LOCATION chrome_options.add_argument("--no-sandbox") browser = webdriver.Chrome(CHROMEDRIVER, options=chrome_options) browser.get('http://www.google.com/');
-
When I was talking about errors on exit() I mean a Delphi side, not a Python side. On a Delphi side I don't know that the app is terminating. No main form events (OnClose, OnDestroy, etc), no exceptions.
-
Hmm strange.. If I try to execute my script with webdriver.Chrome through ShellExecute + python.exe the script freezes also. Maybe there is a problem with some rights? procedure TForm1.Button4Click(Sender: TObject); var fileName: string; parameters: string; directory: string; begin fileName := TPath.Combine(PythonEngine.DllPath, 'python.exe'); parameters := 'A:\Projects\PythonTest2\Win32\Debug\test.py'; directory := 'A:\Projects\PythonTest2\Win32\Debug'; ShellExecute(0, 'open', PChar(fileName), PChar(parameters), PChar(directory), SW_NORMAL); end;
-
There are no exceptions after exit() at all. Nothing to catch. 😞
-
"Not using exit()" is not what i'm looking for. I need a solution to prevent terminating the app from python script. Do you know how to do it?
-
Is it possible to catch SystemExit inside the delphi app? I'd like to stop script running via exit() instead of terminating the app. How to do it?