Error when using chrome driver when attempting to execute python script - python

Having issue trying to automate when using python script. I have access to repositories by GIT, where the python folders all use Python 2.7 syntax. I also have chrome driver as well(Using ubuntu). When I attempt to automate, I just get error, regarding python 2.7. Unsure if thats the issue.
I was given a python code, that would use chrome driver to test if I can automate with the python code that is scripted for use once executed. Using the command terminal, I get the following error:
traceback (most recent call last):
File "autotimesheet.py", line 254, in <module>
processPDCI(res)
File "autotimesheet.py", line 85, in processPDCI
driver = webdriver.Chrome('/home/myname/ChromeDriver')
File "/home/myname/.local/lib/python2.7/site-
packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/home/myName/.local/lib/python2.7/site-
packages/selenium/webdriver/common/service.py", line 86, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver'
executable may have wrong permissions. Please see
https://sites.google.com/a/chromium.org/chromedriver/home
So unsure how to solve it. Friend that is trying to help me is also stumped. I have use pip install selenium & pip install nose for set up. Unsure if I need to install anything else. So any guidance/help would be appreciated. Anything that is vague, I will try to provide better detail. Hopefully this question is related to this section of stackoverflow. Thanks for reading

just an update. I was able to automate the script. Here was the only step I did: In the autotimesheet.py, I change the line of code of this:
driver = webdriver.Chrome('/home/myname/ChromeDriver/)
to:
driver = webdriver.Chrome('/home/myname/ChromeDriver/chromedriver')
where the last part is the executable file. So it opened up chrome and started to automate. Now that I know this can automate, have to fix the issue with the repositories part. With my .profile, I have this:
export SELENIUM_CHROME_DRIVER=/home/myname/ChromeDriver/chromedriver.exe
So either I have to fix this, or its another path/directory or r/w issue. Thanks for the comments. I will resolve in a few hours once I can get this fix!
-----------UPDATE-----------
Being able to fix the automation python script issue, I have to tackle the last issue. I will still follow the comments, and will troubleshoot. My error for future reference if anyone has similar problem:
ERROR: tests.test_to_run.TestsToRun.test_run_this_test
Traceback (most recent call last):
File "/home/myName/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File
"/home/myname/Automation/pdci_keyword/python/tests/test_to_run.py",
line 25, in test_run_this_test
self.test_controller.insert_steps_from_script_into_list_array()
File
"/home/myName/Automation/pdci_keyword/python/lib/
web_interface/test_controller.py", line 337, in
insert_steps_from_script_into_list_array
self.process_msg_insert(data)
File
"/home/myName/Automation/pdci_keyword/python/lib/web_interface/
test_controller.py", line 200, in process_msg_insert

Related

Seahub fails to run initial start with ModuleNotFoundError

I'm currently trying to install seafile 7.1.4 on a Raspberry Pi 4 following the official guide (https://download.seafile.com/published/seafile-manual/deploy/using_mysql.md). The setup went smoothly, but when I try to start the seahub (./seahub start) for the first time I get the following error:
Traceback (most recent call last):
File "check_init_admin.py", line 351, in <module>
rpc = RPC()
File "check_init_admin.py", line 284, in __init__
import ccnet
ModuleNotFoundError: No module named 'ccnet'
I've been on google for the past two hours, but can't find a solution to this problem. What am I doing wrong?
I ran into the same issue. There's a bug in the 7.1.4 package. Seafile uses some local site packages. They (apparently) used to be under ${INSTALLPATH}/seafile/lib/python3.6/site-packages, now the are under ${INSTALLPATH}/seafile/lib/python3.7/site-packages
To fix:
open seahub.sh in the editor of your choice.
find the line that says:
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
change it to read:
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.7/site-packages:${INSTALLPATH}/seafile/lib64/python3.7/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH

Selenium showing an error on installation and using webdriver

I am new to python currently learning how to automate browser. When I try to use the chrome webdriver with selenium then it also shows me an error which says
Traceback (most recent call last):
File "C:\Users\Ashu\Desktop\Python\chromedriver_win32\t.py", line 3, in <module>
browser = webdriver.Chrome("C:\\Users\\Ashu\\Desktop\\Python\\chromedriver_win32\\chromedriver.exe")
File "C:\Users\Ashu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
self.service.start()
File "C:\Users\Ashu\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 104, in start
raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service C:\Users\Ashu\Desktop\Python\chromedriver_win32\chromedriver.exe
I also tried to do it with other browsers using their respective webdrivers but all of them are throwing the same error.
Anyone please help me to get this problem fixed.
Any help is appreciated.
Seems like you have a version of the requests package which is incompatible with the version of Selenium you're trying to install. From the first output, it says your version is newer than what is required, so try downgrading your requests package to version 2.0.0. You can do so with the following command:
pip install requests==2.0.0
Hope this helps!

antiSMASH download_databases.py error in subprocess call

I am trying to intall antiSMASH on my research group's server but hitting an issue with the final stage of downloading the relevant databases. The makers provide a script "download_databases.py" to do this for you (see code at https://bitbucket.org/antismash/antismash/src/718da23d059742048bf044a1ed663806051eb0b2/download_databases.py?at=master&fileviewer=file-view-default).
Sadly there seems to be some kind of access issue (I'm not root and sudo doesn't help).
Server is RedHat CentOS 7.2.1511
Command run is "python download_databases.py" in antismash directory. Output is below:
Creating checksum of Pfam-A.hmm.gz
Extraction of Pfam-A.hmm.gz finished successfully.
Traceback (most recent call last):
File "download_databases.py", line 221, in <module>
main()
File "download_databases.py", line 198, in main
compile_pfam(filename)
File "download_databases.py", line 161, in compile_pfam
execute(command)
File "download_databases.py", line 51, in execute
stderr=subprocess.PIPE)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Does anyone with experience of this have an idea of what I need to do? I've tried a local install of Python (2.7) where I have read/write access but that doesn't seem to help as the script is still looking elsewhere for the subprocess script (my own install is at the top of the PATH). Do I possibly need to install something extra with the local install or customise the install locations to include the subprocess etc stuff?
Thanks in advance. I'm no expert and really appreciate the help.
EDIT: Well I feel quite stupid now. Thanks to Hannu for suggesting I check $PATH and what binary the script was trying to execute. It turned out to be one of antiSMASH's dependencies (hmmpress) which I hadn't yet added to the $PATH on this machine. It hadn't occurred to me that it would be required prior to actually running antiSMASH.
Add print commands or something like that to your execute function and see what it tries to execute. The only explanation to get the error in that command is that the script or binary it tries to execute cannot be found.
Try adding a full path to your binary. That alone might solve the issue. Check that there are no typos in the command. Remember commands needs to be a list if it contains parameters, for example ["/usr/bin/foo/myprogram", "-a", "42", "-b", "/tmp/outputfile"] or whatever it is you need to pass to the program.

Pyinstaller builds file but chokes on certain .dlls

When I run my py program it works the way I intended it to. If I am on a Linux box and build an executable using Pyinstaller, it builds without issue and executes without issue. I have scoured the Pyinstaller docs, git, etc. none of the posted fixes helped
I am still very new at python and feel like it might be a simple fix and might be over thinking the issue
Why can I no build a functional .exe on a windows based system using pyinstaller?
Windows 10 system
Pyinstaller version 3.2
Python version 3.5.2
This is a GUI program using appJar which is also up to date.
The file does build, but errors "Could not execute script"
EDIT
Not sure if this is best to edit in line like this but...
So studying the output and making adjustments, the issue seems to be appJar.py. For some reason it is missing assets, I am looking into it. The trouble is that I am still not used to looking at this kind of output and am not sure where to start.
C:\Users\_User_>C:\temp\fileCreatorGUI\fileCreatorGUI.exe
Traceback (most recent call last):
File "F:\Users\_User_\python_working\fileCreatorGUI.py", line 73, in <module>
app = gui()
File "C:\Users\_User_\AppData\Local\Programs\Python\Python35\lib\site-packages\appJar\appjar.py", line 509, in __init__
self.topLevel.wm_iconbitmap(self.appJarIcon)
File "C:\Users\_User_\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 1716, in wm_iconbitmap
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "C:\temp\fileCreatorGUI\appJar\resources\icons\favicon.ico" not defined
Failed to execute script fileCreatorGUI
Edit 2
See answer below, but I was barking up the wrong tree on this one,
The Pyinstaller output chokes on the .dll's:
api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
(There are like ~40 of these)
I added those .dll's to the python path, I declared them in the bianaries in the .spec file.
here is a truncated log:
2414 WARNING: Can not get binary dependencies for file: C:\Windows\system32\api-
ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\_USER_NAME\AppData\Local\Programs\Python\Python35-32\lib\site-pa
ckages\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\_USER_NAME\AppData\Local\Programs\Python\Python35-32\lib\site-pa
ckages\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
2423 WARNING: Can not get binary dependencies for file: C:\Windows\system32\api-
ms-win-crt-heap-l1-1-0.dll
I tried the fix listed here:
https://github.com/pyinstaller/pyinstaller/pull/1981
but it did not seem to make a difference.
Someone recommended adding the sys.path.insert() route but it did not make a difference either way
I also tried this in a VM with windows 7, clean install, no change. My next step is to try to use Wine in Debian, but I don't really want to go that route. Any help would be appreciated. Thank you
Turns out this was an appJar/packaging issue, the pyinstaller was not looking in the correct directory for the assets. per the dev of appJar, I commented out two lines of code in the appJar.py, lines 508-509:
if self.platform == self.WINDOWS:
self.topLevel.wm_iconbitmap(self.appJarIcon)
More on the specifics here: https://github.com/jarvisteach/appJar/issues/84
I probably can fix this by using the --path argument with pyinstaller but for the moment, the issue is fully resolved

Ipython installation on 3.3 x64 errors

I don't have experience in downloading libraries, so any help is appreciated. I've got a fresh install of Python3.3 and am trying to get IPython for 64bit Windows 7. The IPython .exe installer ran fine and completed normally, but I can't access the program. I looked through their documentation, and tried the commands there, but
$ python setup.py install
returns invalid syntax, highlighting "setup". I thought the fix might be in the distribute library mentioned on the page, so I went to go try and get that first. However, using the script from distribute's install page revealed it's own errors, namely
Traceback (most recent call last):
File "C:\Python33\distribute_setup.py", line 541, in <module>
sys.exit(main())
File "C:\Python33\distribute_setup.py", line 537, in main
tarball = download_setuptools(download_base=options.download_base)
File "C:\Python33\distribute_setup.py", line 200, in download_setuptools
log.warn("Downloading %s", url)
File "C:\Python33\lib\distutils\log.py", line 47, in warn
self._log(WARN, msg, args)
File "C:\Python33\lib\distutils\log.py", line 30, in _log
if stream.errors == 'strict':
AttributeError: errors
I've been at it for a couple hours now, and I'm fresh out of ideas. What next?
It looks like you ran into Python bug 12967. You need to run distribute_setup.py outside of IDLE (i.e. in a command prompt).

Categories