Can not execute Robot Framework Properly (No module name Robot) - python

I had update Robot Framework into the newer version
Here are pip list that I had already download
Package Version
------------------------------- -----------
Appium-Python-Client 0.49
certifi 2020.6.20
chardet 3.0.4
decorator 4.4.2
django-robots 4.0
docutils 0.16
idna 2.10
kitchen 1.2.6
numpy 1.19.1
Pillow 7.2.0
pip 19.0.3
Pygments 2.6.1
PyPubSub 3.3.0
pywin32 228
requests 2.24.0
robot 20071211
robotframework 3.2.1
robotframework-appiumlibrary 1.5.0.4
robotframework-databaselibrary 1.2.4
robotframework-pythonlibcore 2.1.0
robotframework-requests 0.7.1
robotframework-ride 1.7.3.1
robotframework-selenium2library 3.0.0
robotframework-seleniumlibrary 3.3.1
robotframeworklexer 1.1
selenium 3.141.0
setuptools 40.8.0
six 1.15.0
urllib3 1.25.10
wxPython 4.0.7.post2
You are using pip version 19.0.3, however version 20.2.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Python that I chosen is 3.7.4
However, I need to executes the script, which it should be execute normally. However, I found that it caught error
Traceback (most recent call last):
File "d:\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "d:\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Scripts\robot.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'robot'
that I don't understand that cause of error.
I have already got robot files as well

Have you found a solution yet? I doubt if your command to execute robot is correct.
robot <Path to robot file> will execute it.
for example robot Tests/my_robot_test.robot and if you have tags assigned, you can run specific tag test cases with robot -i <tag_id> Tests/my_robot_test.robot

Related

synology NAS, pip issue, python libraries

I recently acquired a NAS and trying to run a python script. Issue is that I cannot run the python script as a normal user (python script.py). Python is only running if I run as a sudo user (e.g., sudo python script.py)
When I run as a normal user, it does not detect the libraries such as pandas. But I do not want to run as a sudo because sudo would required a password.
I think the issue comes from the pip installation.
Do you know what could be the issue?
Greatly appreciate
In the terminal, when I run "pip list" as a normal user, it states 'ModuleNotFoundError: No module named 'pip._internal'
`
user#NAS:~$ pip list
Traceback (most recent call last):
File "/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal'
but when I run as a sudo:
user#NAS:~$ sudo pip list
Password:
Package Version
certifi 2022.6.15
charset-normalizer 2.1.1
idna 3.3
numpy 1.23.2
pandas 1.5.1
pip 22.3.1
pyasn1 0.4.5
pysmb 1.2.2
python-dateutil 2.8.2
pytz 2022.2.1
requests 2.28.1
setuptools 56.0.0
six 1.16.0
thread6 0.2.0
urllib3 1.26.12
wheel 0.38.4

ModuleNotFoundError: No module named 'keyboard, tried pip3 install, tried -pip list it is there

Some extra info:
I am on Windows 10, using latest Python version, using latest pip version, using Pycharm as my IDE. I am making a keylogger program for a project and I cannot seem to get keyboard module working.
Also:
C:\Users\Hp>pip --version
pip 20.2.2 from c:\users\hp\appdata\local\programs\python\python38-32\lib\site-packages\pip (python 3.8)
C:\Users\Hp>pip install keyboard
Requirement already satisfied: keyboard in c:\users\hp\appdata\local\programs\python\python38-32\lib\site-packages (0.13.5)
C:\Users\Hp>pip list
Package Version
altgraph 0.17
future 0.18.2
keyboard 0.13.5
pefile 2019.4.18
pip 20.2.2
PyInstaller 3.6
pywin32-ctypes 0.2.0
setuptools 41.2.0
The error message in PyCharm: C:\Users\Hp\Desktop\keylogger\venv\Scripts\python.exe C:/Users/Hp/AppData/Roaming/JetBrains/PyCharmCE2020.1/scratches/keylog.py
Traceback (most recent call last):
File "C:/Users/Hp/AppData/Roaming/JetBrains/PyCharmCE2020.1/scratches/keylog.py", line 2, in
import keyboard
ModuleNotFoundError: No module named 'keyboard'
Activate your virtual-environment
.\env\Scripts\activate
or
C:\Users\Hp\Desktop\keylogger\venv\Scripts\activate
Now install keyboard
pip install keyboard
#yedpodtrzitko already answered, I just want to make it clearer with solution-steps.

Error when upgrading Spyder to 4.0.1: ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'

I recently upgraded to Spyder 4.0.1 through Anaconda via conda update spyder. Now, when I try to boot up Spyder via Anaconda Navigator, the program automatically crashes with the following dump:
Traceback (most recent call last):
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 3718, in main
mainwindow = run_spyder(app, options, args)
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 3559, in run_spyder
main.setup()
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 1010, in setup
from spyder.plugins.ipythonconsole.plugin import IPythonConsole
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 52, in
from spyder.plugins.ipythonconsole.widgets import ClientWidget
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/plugins/ipythonconsole/widgets/__init__.py", line 16, in
from .debugging import DebuggingWidget
File "/Users/ed/anaconda/lib/python3.6/site-packages/spyder/plugins/ipythonconsole/widgets/debugging.py", line 22, in
from IPython.core.inputtransformer2 import TransformerManager
ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'
I couldn't find anybody with a similar error. I updated IPython, as someone suggested, but it did not resolve the problem. Any ideas?
... since none of this worked for me, here how I solved it:
check what IPython version you have via conda list
in my case i got a rather old version 5.8.0 instead of the most recent one
(at the time of writing 7.19.0... check available versions via conda search ipython)
since conda update ipython did not provide the most recent version, i decided
to manually run the command that installs the most recent version
(for me this was conda install -c conda-forge ipython=7.19.0)
that's it...
I had the same problem. Upgrading IPython via the following command line helped resolve the situation.
sudo conda update IPython -n xxx
where xxx is the name of the environment I was trying to run Spyder in.
I had this very same issue on Spyder 4.1.4. Turns out that not all the required packages were installed correctly when I installed Spyder.
I used the following in python to test IPython:
import IPython
print(IPython.__version__)
Turned out that I had 6.4.0 so I ran the following from the terminal:
!pip install --upgrade IPython
IPython 7.16.1 was installed with prompt_toolkit-3.0.5. I also got the following errors:
ERROR: spyder 4.1.4 requires pyqt5<5.13; python_version >= "3", which is not installed.
ERROR: spyder 4.1.4 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
ERROR: jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 3.0.5 which is incompatible.
ERROR: spyder 4.1.4 has requirement jedi==0.17.1, but you'll have jedi 0.12.1 which is incompatible.
ERROR: spyder 4.1.4 has requirement parso==0.7.0, but you'll have parso 0.3.0 which is incompatible.
ERROR: spyder 4.1.4 has requirement qtconsole>=4.6.0, but you'll have qtconsole 4.3.1 which is incompatible.
ERROR: spyder-kernels 1.9.2 has requirement ipykernel>=5.1.3; python_version > "2", but you'll have ipykernel 4.8.2 which is incompatible.
ERROR: spyder-kernels 1.9.2 has requirement jupyter-client>=5.3.4, but you'll have jupyter-client 5.2.3 which is incompatible.
Installing the correct versions of the above packages in pip resolved my problem.
Update to python 3.7. I had the same problem. That solved it.
conda install python=3.7 anaconda=custom
I experienced the same problem. Just do conda update IPython. All good then!

Sheets API Python Error

I'm new to installing modules, etc, but believe I've done everything correctly and I'm getting errors. I'm following the instructions here:
https://developers.google.com/gdata/articles/python_client_lib#library
Steps:
1. downloaded Zip of gdata here:
https://github.com/google/gdata-python-client
2. unzipped and placed into my Scripts folder: C:\Python34\Scripts\gdata-python-client-master
3. went to cmd, above directory and installed: I did get a bunch of syntax errors (commas, etc), assuming this is why the next steps aren't working...
4. in python prompt, it says i have module:
[gdata 2.0.18 (c:\python34\lib\site-packages), google-api-python-client 1.4.2 (c:\python34\lib\site-packages), httplib2 0.9.2 (c:\python34\lib\site-packages), oauth2client 1.5.1 (c:\python34\lib\site-packages), pip 6.0.8 (c:\python34\lib\site-packages), pyasn1 0.1.9 (c:\python34\lib\site-packages), pyasn1-modules 0.0.8 (c:\python34\lib\site-packages), requests 2.7.0 (c:\python34\lib\site-packages), rsa 3.2.3 (c:\python34\lib\site-packages), setuptools 12.0.5 (c:\python34\lib\site-packages), simplejson 3.8.1 (c:\python34\lib\site-packages), six 1.10.0 (c:\python34\lib\site-packages), uritemplate 0.6 (c:\python34\lib\site-packages)]
5) But when I try to import gdata i get an error:
>>> import gdata.spreadsheet.service
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import gdata.spreadsheet.service
File "C:\Python34\lib\site-packages\gdata\__init__.py", line 26, in <module>
import atom
File "C:\Python34\lib\site-packages\atom\__init__.py", line 132, in <module>
CreateClassFromXMLString)
File "C:\Python34\lib\site-packages\atom\__init__.py", line 96, in mark_deprecated
optional_warn_function.func_name = f.func_name
AttributeError: 'function' object has no attribute 'func_name'
Any ideas?
Instead of trying to unzip to install, use pip:
http://pip.readthedocs.org/en/stable/installing/
You can install the library using pip install gdata:
https://pythonhosted.org/gdata/installation.html
Update: pip is a good way to install, but this was not actually the problem - the actual root problem was gdata compatibility with python2 vs. python3. The fix that worked is described here: https://github.com/google/gdata-python-client/issues/29
Specifically running this in the site-packages directory:
2to3 -w atom gdata
Be warned this will change many files, so having a backup or recovery strategy in place before beginning is strongly advised.

pip displays incorrect version of package

I am not sure if this is a bug, or if I am doing something wrong.
The situation is the following,
pip list -o
yields a list of outdated python packages along with what is suppose to be the current installed version.
The issue is that I am pretty sure that it is giving me the wrong information on at least some packages as I can verify, as in the example below, that the version of ipython that pip thinks is installed (2.0.0) is not the one that I get when I run ipython from the command prompt (version==2.1.0).
kolmogorov:~# pip list -o | head -15
Warning: cannot find svn location for PEAK-Rules==0.5a1.dev-r2707
Warning: cannot find svn location for prioritized-methods==0.2.2dev-20110830
scipy (Current: 0.13.2 Latest: 0.14.0)
plotly (Current: 1.0.30 Latest: 1.0.32)
SOAPpy (Current: 0.12.21 Latest: 0.12.22)
openpyxl (Current: 1.8.6 Latest: 2.0.3)
networkx (Current: 1.8.1 Latest: 1.9)
setuptools (Current: 3.4.1 Latest: 5.1)
brewer2mpl (Current: 1.3.2 Latest: 1.4)
repoze.who (Current: 1.0.19 Latest: 2.2)
pandas (Current: 0.13.1 Latest: 0.14.0)
pygeocoder (Current: 1.2.2 Latest: 1.2.5)
ipython (Current: 2.0.0 Latest: 2.1.0)
tornado (Current: 3.2 Latest: 3.2.2)
Could not find any downloads that satisfy the requirement vboxapi
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 156, in main
logger.fatal('Exception:\n%s' % format_exc())
File "/usr/lib/python2.7/dist-packages/pip/log.py", line 111, in fatal
self.log(self.FATAL, msg, *args, **kw)
File "/usr/lib/python2.7/dist-packages/pip/log.py", line 164, in log
consumer.flush()
IOError: [Errno 32] Broken pipe
kolmogorov:~# ipython
Python 2.7.7 (default, Jun 3 2014, 16:16:56)
Type "copyright", "credits" or "license" for more information.
IPython 2.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
My question is: Is there a way to have pip understand the correct version of the installed python packages?
You can run the following commands to see where the package is from:
which ipython
and:
pip show ipython
You may have two installations: one that was installed with pip install ipython and an installation via a separate tool (package manager on Linux or Ports/brew on Mac).
So the way to do this properly is a little bit more involved than what I anticipated, but I have to submit it as the proper answer as it actually resolves the issue.
Suppose the package version that is misunderstood by pip is pandas. So that the behavior you observe is that:
pip list --outdated
says that the version of pandas you have installed is 0.14.0; but when you inquire about the version of pandas in say ipython:
In [1]: import pandas
In [2]: pandas.__version__
Out[2]: '0.14.1'
In order to resolve this:
run pip show pandas; it should tell you about the location of the distribution, in my case /usr/local/lib/python2.7/dist-packages
redirect to that location cd /usr/local/lib/python2.7/dist-packages
run ls -lstrh pandas-0.14.*; you should see files associated with both your 0.14.1 version and the 0.14.0 one you want to get rid of
run rm -rf pandas-0.14.0*.egg-info pandas-0.14.0*.pth
That should be it!
pip show pandas
should now agree with what pandas.__version__

Categories