Chromedriver executable path problems even though executable path is in PATH [duplicate] - selenium

This question already has answers here:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome
(1 answer)
WebDriverException: Message: 'chromedriver' executable needs to be in PATH while setting UserAgent through Selenium Chromedriver python
(1 answer)
Closed 2 years ago.
I'm working on a website automation program for 1 month, all went well and worked perfectly fine until I had to reset my laptop to factory settings due to a black screen that kept on going after turning on the laptop.
I'm running a laptop with windows 10, Pycharm is the IDE and I code with Python (64-bit version). I use chromedrivers, sadly there's not a 64-bit version but no problem was ever given by that.
Now, when I try to start the code I saved from the finished project, it just keeps saying
"'chromedriver.exe' executable needs to be in PATH."
I looked for everything I could, I copied the chromedriver into the PyCharm folder, I unzipped it on my Desktop, I used the executable_path=r'...' option, I tried to install the webdriver manager... nothing helped and the webdriver manager couldn't even get downloaded.
I think it's important to say that I have 2 mass storages, one called "Windows (C:)" and the other "Data (D:)", which has 380 GB of space, so I installed Pycharm and Python into Data(D:).
I'd really appreciate it if anyone could help me with this problem, it just makes me crazy how I tried everything fixing this.. seems like no one had ever had such a dumb problem.
Anyways, have a great day dear StackOverflow Community!
This is the error code:
C:\Users\User\PycharmProjects\Ersters\venv\Scripts\python.exe C:/Users/User/PycharmProjects/Ersters/Ersters.py
Automatic generator started, please wait.
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\Ersters\venv\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the management file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/Ersters/Ersters.py", line 15, in <module>
driver = webdriver.Chrome(options=options, executable_path=r'C:\Users\User\Desktop\Python\chromedriver.exe')
File "C:\Users\User\PycharmProjects\Ersters\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\User\PycharmProjects\Ersters\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1

Related

locusts-plugins: FileNotFoundError: [WinError 2] The system cannot find the file specified

I've installed the locusts-plugins along with the other required modules as shown in the setup.py:
"locust>=1.4.3",
"psycogreen",
"psycopg2-binary",
"websocket-client",
"python-dateutil",
"pymongo",
"confluent-kafka",
"selenium>=4.0.0.b2",
"lxml",
"opencensus-ext-azure"
But when I attempt to run any of the examples using the webdrivers I get the error:
File "c:\users\mjohns33\pycharmprojects\pythonproject\venv\lib\site-packages\gevent\subprocess.py", line 1270, in _execute_child
hp, ht, pid, tid = CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
2021-04-12T20:11:44Z <Greenlet at 0x55012d0: > failed with FileNotFoundError
I have the standalone server running and chromedriver in the path, is there something I'm missing?
Thanks for the full callstack. The command that it is complaining about is killall, which is not available on Windows.
I've only ever run WebdriverUser on Mac and Linux. It might work if you just comment out that line (c:\users\mjohns33\pycharmprojects\pythonproject\venv\lib\site-packages\locust_plugins\users\webdriver.py, line 127)
(and manually kill chromedriver as needed)
I figured out that the locust-plugins is all-inclusive, meaning you don't want to install selenium or any other modules. Python, locust and locust-plugins, that's it.
I still see new errors but just having what's needed clears up a lot of these issues.

Python 3.6: FileNotFoundError: [WinError 2] The system cannot find the file specified when running PDF-DIFF tool

I have a Windows 10 x64 based PC. I am trying to get this PDF-DIFF Python tool here: https://github.com/JoshData/pdf-diff
to run and it hits this error when it is running a line from Python Lib file called 'subprocess.py' file.
I posted this issue with full screenshots of the error and still waiting for response:
https://github.com/JoshData/pdf-diff/issues/30
Just to note that before installation of this github tool I :
1) installed Python 3.6 (tried both 32 bit and 64) and currently have 32 bit
2) installed Microsoft Visual Studio 14.0 Build tools (C++ build tools)
3) in command prompt ran command: pip install lxml so that I could have
the xml libraries downloaded and satisfy the tool's requirements
4) additionally have checked other stackoverflow threads suggesting that 'file not found' error is due to 'COMSPEC' variable being set differently in regedit vs. Python's subprocess.py.
In windows key registry, 'ComSpec' key set to: %SystemRoot%\system32\cmd.exe;
In python subprocess call is being made as such (last line is 997):
if shell:
startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = _winapi.SW_HIDE
comspec = os.environ.get("COMSPEC", "cmd.exe")
args = '{} /c "{}"'.format (comspec, args)
#Start the process
try:
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
# no special security
None, None,
int(not close_fds),
creationflags,
env,
os.fspath(cwd) if cwd is not None else
None,
startupinfo)
I'm out of ideas, and feel the program requirements are satisfied.
So, when I run the command in the prompt to get my two PDF files compared and output comparison spit out:
C:\Python36\Scripts\pdf_diff>pdf-diff 683000.pdf 17368000.pdf > comparison_output.png
*I immediately get error shown below:
Traceback (most recent call last):
File "C:\Python36\Scripts\pdf_diff\pdf-diff-script.py", line 11, in
load_entry_point('pdf-diff==0.9.0', 'console_scripts', 'pdf-diff')()
File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 496, in main
changes = compute_changes(args.files[0], args.files[1], top_margin=float(args.top_margin), bottom_margin=float(args.bottom_margin))
File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 14, in compute_changes
docs = [serialize_pdf(0, pdf_fn_1, top_margin, bottom_margin), serialize_pdf(1, pdf_fn_2, top_margin, bottom_margin)]
File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 29, in serialize_pdf
for run in box_generator:
File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 102, in mark_eol_hyphens
for next_box in boxes:
File "C:\Python36\lib\site-packages\pdf_diff-0.9.0-py3.6.egg\pdf_diff\command_line.py", line 64, in pdf_to_bboxes
xml = subprocess.check_output(["pdftotext", "-bbox", fn, "/dev/stdout"])
File "C:\Python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Python36\lib\subprocess.py", line 403, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Python36\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "C:\Python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I believe I found out the problem here. In the process of installing different versions of Python, namely 2.7 and 3.6 I broke something. I believe it could be the importing of different modules for the PDF-diff program. The PDF-DIFF program, according to manual is coded for Python 3. So, I believe the issue above was a versioning issue. I have for now removed Python 3.6 from my machine as I need 2.7 for other projects.

WebRTC not building for Windows

Whenever I try build WebRTC for Windows, I get this error when running gclient runhooks:
________ running 'C:\path\to\depot_tools\python276_bin\python.exe src/build
/landmines.py' in 'C:\path\to\webrtc\src\chromium' Please follow the instructions
at http://www.chromium.org/developers/how-tos/bui ld-instructions-windows
Traceback (most recent call last):
File "src/build/landmines.py", line 215, in <module>
sys.exit(main())
File "src/build/landmines.py", line 202, in main
gyp_environment.SetEnvironment()
File "C:\path\to\webrtc\src\chromium\src\build\gyp_environment.py", line 33, in
SetEnvironment
vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
File "C:\path\to\webrtc\src\chromium\src\build\vs_toolchain.py", line 34, in
SetEnvironmentAndGetRuntimeDllDirs
Update()
File "C:\path\to\webrtc\src\chromium\src\build\vs_toolchain.py", line 179, in
Update
subprocess.check_call(get_toolchain_args)
File "C:\path\to\depot_tools\python276_bin\lib\subprocess.py", line 540, in
check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\path\\to\\depot_tools\\python276_bin\\python.exe',
'C:\\path\\to\\depot_tools\\win_toolchain\\get_toolchain_if_necessary.py', '--output-json',
'C:\\path\\to\\webrtc\\src\\chromium\\src\\build\\win_toolchain.json',
'ee7d718ec60c2dc5d255bbe325909c2021a7efef']' returned non-zero exit status 1
Error: Command C:\path\to\depot_tools\python276_bin\python.exe src/build/landmines.py returned non-zero exit status 1 in C:\path\to\webrtc\src\chromium
Hook ''C:\path\to\depot_tools\python276_bin\python.exe' src/build/landmines.py' took 68.55 secs
Error: Command C:\path\to\depot_tools\python276_bin\python.exe - u src/sync_chromium.py --target-revision 271c6cca48a6cef32c0f3add3b17b700707deec 5 returned non-zero exit status 2 in C:\path\to\webrtc
Hook ''C:\path\to\depot_tools\python276_bin\python.exe' -u src/sync_chromium.py --target-revision 271c6cca48a6cef32c0f3add3b17b700707deec5' took 3842.34 secs
I'm using 64-bit Windows 7 with VS 2013 installed. I've already tried setting the following variables:
GYP_DEFINES='windows_sdk_path="C:\path\to\windows\sdk" platform=win
component=shared_library'
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_GENERATORS=msvs
GYP_MSVS_VERSION=2013
Attempting to build chromium also gives the same error. Fetching with nohooks works fine, it's just when I try gclient sync or runhooks that the error occurs. I've also tried building with ninja, and that fails as well. I've got all SDKs and such all up to date. Any help with this would be greatly appreciated.
I have found this possible solution at Google Code
as per braveyao#webrtc.org's sugestion
Supporting msvs is not the focus of Chromium. You can try ninja which
should always work. Also you could try to set the
"GYP_GENERATORS=msvs-ninja,ninja". Then you could build with ninja and
debug with VS2013.
Also, chromium is now 64bit only so you need to change GYP_DEFINES aswell
so your envirnment variables should be:
GYP_DEFINES=target_arch=x64
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_GENERATORS=msvs-ninja,ninja
GYP_MSVS_VERSION=2013
Of course replace 2013 if that's not the version of Visual Studio you have installed
you may need to delete what you already have downloaded and do a fresh fetch webrtc after that change if you thinkered with it
I should also add that the Windows must be english version (it's ok if you after install some other language pack but it must be originally english) - i have a PT-PT version at home and that one always gives an error with some python file when running gclient sync - at work though i originally had english version and installed the PT-PT language pack but it works fine
This is what worked for me. Does that work for you?

App crashing after too many missed heartbeats

I have an app that is distributing load on a bunch of workers. So far all workers are running on the same VM, have not needed to scale up yet.
My problem is that, like every 3-4 days, the worker crashes with the error message below - no contact between the client and the rabbitmq server in 1200 secs (I guess).
Traceback (most recent call last):
File "/var/www/vhosts/niklas/workers/builder.py", line 170, in <module>
BuildWorker().main()
File "/var/www/vhosts/niklas/lib/worker.py", line 29, in main
self.msgs.ch.start_consuming()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 722, in start_consuming
self.connection.process_data_events()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 93, in process_data_events
self.process_timeouts()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 99, in process_timeouts
self._call_timeout_method(self._timeouts.pop(timeout_id))
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 164, in _call_timeout_method
timeout_value['method']()
File "/usr/local/lib/python2.6/dist-packages/pika/heartbeat.py", line 85, in send_and_check
return self._close_connection()
File "/usr/local/lib/python2.6/dist-packages/pika/heartbeat.py", line 106, in _close_connection
HeartbeatChecker._STALE_CONNECTION % duration)
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 75, in close
self.process_data_events()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 91, in process_data_events
self._handle_timeout()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 198, in _handle_timeout
self._on_connection_closed(None, True)
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 235, in _on_connection_closed
raise exceptions.AMQPConnectionError(*self.closing)
pika.exceptions.AMQPConnectionError: (320, 'Too Many Missed Heartbeats, No reply in 1200 seconds')
My question is, what could possibly cause this?
This only happen to ~1 out of three workers, the others are running fine without any error message or warning (again, all workers and rabbitmq-server on the same VM).
I'm using the standard method in Python library pika, start_consuming(), to retrieve new requests. The code is way to big too attach here, and considering the error message, it seems to be out of my code or a system issue.
I'm using:
Python Pika 0.9.8
Rabbitmq 3.0.0
Debian 6.0
All workers are started inside screen
VM hosted at Linode, 512MB memory
We experienced a similar problem due to a bug (#236) in pika 0.9.8.
https://github.com/pika/pika/pull/236
This should be fixed in 0.9.9 or can be resolved by patching your pika library with the source code attached to the linked issue on github.
(Pika was closing a connection on 2 cumulative missed heartbeats rather than 2 consecutive ones).

websphere jython scripts cannot access AdminTask

We have an auto-deployment script that uses wsadmin and jython. The script appears to work as expected however after 6-7 redeployments the AdminTask object becomes unavilable, resulting in the following error when we attempt to use that object:
WASX7209I: Connected to process "server1" on node ukdlniqa41Node01 using SOAP connector; The type of process is: UnManagedProcess
WASX8011W: AdminTask object is not available.
...
Traceback (innermost last):
File "<string>", line 251, in ?
File "<string>", line 14, in main
File "<string>", line 38, in initialize
NameError: AdminTask
My question is, what would cause this AdminTask object to become unavailable? (it remains unavailable until we restart the server instance)
AdminTask may be available if one of the previous tasks does not finish properly. This happens often especially if your server is in development mode. I would suggest gathering Deployment Mustgather as per http://www-01.ibm.com/support/docview.wss?rs=180&context=SSCR4XA&q1=MustGatherDocument&uid=swg21199344&loc=en_US&cs=utf-8&lang=en and submitting the results to IBM.