robot framework library JSONlibrary import error - python

I am having issues with importing JSONlibrary and I am not sure where it fails.
I'm getting the following errors:
[ ERROR ] Error in file 'C:\Users\path\to\file.robot' on line 12: Importing test library 'JSONLibrary' failed: SyntaxError: no viable alternative at input 'from' (__init__.py, line 1367)
Traceback (most recent call last):
File "C:\Users\path\to\Python\Python37-32\Lib\site-packages\JSONLibrary\__init__.py", line 2, in <module>
from .JSONLibraryKeywords import JSONLibraryKeywords
File "C:\Users\path\to\Python\Python37-32\Lib\site-packages\JSONLibrary\JSONLibraryKeywords.py", line 7, in <module>
from jsonpath_rw_ext import parse
File "C:\Users\path\to\Python\Python37-32\Lib\site-packages\jsonpath_rw_ext\__init__.py", line 17, in <module>
__version__ = pbr.version.VersionInfo(
File "C:\Users\path\to\Python\Python37-32\Lib\site-packages\pbr\version.py", line 467, in version_string
return self.semantic_version().brief_string()
File "C:\Users\path\to\Python\Python37-32\Lib\site-packages\pbr\version.py", line 462, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "C:\Users\path\to\Python\Python37-32\Lib\site-packages\pbr\version.py", line 439, in _get_version_from_pkg_resources
import pkg_resources
I tried to pip reinstall robotframework-jsonlibrary and pkg_resources, but it still does not work. It seems that some of the code may be in python 2?
Currently using Robot Framework 3.2.2 (Python 3.7.9 on win32) and pip list:
appdirs 1.4.4
certifi 2020.6.20
chardet 3.0.4
configparser 5.0.0
coverage 5.3
decorator 4.4.2
distlib 0.3.1
filelock 3.0.12
idna 2.10
importlib-metadata 1.7.0
jsonpath-rw 1.4.0
jsonpath-rw-ext 1.2.2
pbr 5.5.0
pip 20.1.1
pluggy 0.13.1
ply 3.11
py 1.9.0
requests 2.24.0
robotframework 3.2.2
robotframework-jsonlibrary 0.3.1
robotframework-requests 0.7.1
setuptools 50.3.0
six 1.15.0
tox 3.0.0
urllib3 1.25.10
virtualenv 20.0.31
zipp 3.1.0

Related

Unable to run pycel example

I have tried run the pycel example in a clean virtualenv, after installing pycel package from source. The result is:
(py_cel) C:\Users\pena\Downloads\pycel\example>python --version
Python 3.9.7
(py_cel) C:\Users\pena\Downloads\pycel\example>pip list
Package Version
---------------- -------
decorator 5.1.1
et-xmlfile 1.1.0
networkx 2.4
numpy 1.23.4
openpyxl 3.2.0b1
pip 22.3.1
pycel 1.0b23
python-dateutil 2.8.2
ruamel.yaml 0.17.21
ruamel.yaml.clib 0.2.7
setuptools 65.5.1
six 1.16.0
wheel 0.38.4
(py_cel) C:\Users\pena\Downloads\pycel\example>python example.py
Loading C:\Users\pena\Downloads\pycel\example\example.xlsx...
C:\Users\pena\Documents\Heis\documentator\environ\py_cel\lib\site-packages\openpyxl-3.2.0b1-py3.9.egg\openpyxl\worksheet\_reader.py:332: UserWarning: Unknown extension is not supported and will be removed
warn(msg)
Traceback (most recent call last):
File "C:\Users\pena\Downloads\pycel\example\example.py", line 40, in <module>
excel = ExcelCompiler(filename=fname)
File "C:\Users\pena\Documents\Heis\documentator\environ\py_cel\lib\site-packages\pycel-1.0b23-py3.9.egg\pycel\excelcompiler.py", line 69, in __init__
self.excel.load()
File "C:\Users\pena\Documents\Heis\documentator\environ\py_cel\lib\site-packages\pycel-1.0b23-py3.9.egg\pycel\excelwrapper.py", line 241, in load
self.load_array_formulas()
File "C:\Users\pena\Documents\Heis\documentator\environ\py_cel\lib\site-packages\pycel-1.0b23-py3.9.egg\pycel\excelwrapper.py", line 246, in load_array_formulas
for address, props in ws.formula_attributes.items():
AttributeError: 'Worksheet' object has no attribute 'formula_attributes'
I would like to know how to run this example. Thanks.

I keep getting ModuleNotFoundError where is the issue?

So, I'm trying to install and use the google-images-download repo both through: pip install google-images-download and pip install git+https://github.com/Joeclinton1/google-images-download.git
I've tried installing it as SU as well. In PyCharm when I view packages I do see it but when I try this code:
from google_images_download import google_images_download
#instantiate the class
response = google_images_download.googleimagesdownload()
arguments = {"keywords":"aeroplane, school bus, dog in front of house",
"limit":10,"print_urls":False}
paths = response.download(arguments)
#print complete paths to the downloaded images
print(paths)
it gives this error continuously:
Traceback (most recent call last):
File "/Users/*x*/Desktop/SchoolPython/PythonUVA/Webscrape.py", line 1, in <module>
from google_images_download import google_images_download
ModuleNotFoundError: No module named 'google_images_download'
I think it might not be looking in the right filepath or library but any other repo I tried previously did work.
Any help is greatly appreciated.
*edit for versions
(3.9UVA) MacBook-Pro-van-Flavia:Webscrape.py flavia$ which pip
/Users/flavia/PycharmProjects/3.9UVA/bin/pip
(3.9UVA) MacBook-Pro-van-Flavia:Webscrape.py flavia$ which python
/Users/flavia/PycharmProjects/3.9UVA/bin/python
(3.9UVA) MacBook-Pro-van-Flavia:Webscrape.py flavia$ pip list
Package Version
---------------------- -----------
async-generator 1.10
attrs 21.4.0
certifi 2022.5.18.1
cffi 1.15.0
charset-normalizer 2.0.12
cryptography 37.0.2
google-images-download 2.8.0
h11 0.13.0
idna 3.3
outcome 1.1.0
Pillow 9.1.1
pip 21.3.1
pycparser 2.21
pyOpenSSL 22.0.0
PySocks 1.7.1
requests 2.27.1
selenium 4.2.0
setuptools 60.2.0
sniffio 1.2.0
sortedcontainers 2.4.0
trio 0.20.0
trio-websocket 0.9.2
urllib3 1.26.9
wheel 0.37.1
wsproto 1.1.0

Matplotlib style.use('tex') error in MacOS

Firstly apologies for the similarity to other questions, but I believe this is a different issue from all the previous questions/answers I have found. Please refer me to other questions if you think I'm wrong, but please also read the full question to check I haven't already tried the solution provided in the other question.
I had a working setup using Conda and matplotlib to do data-processing and plot figure with latex formatted captions etc, due to some lingering issues I did a full clean install. Trying to recreate my environment from before produces this error, unsure exactly what version of Catalina I was running pre-reboot but the Big Sur version I'm now running is 11.2.1.
Code required to reproduce the issue (running in a miniconda environment, full package list at the end):
import matplotlib.pyplot as plt
plt.style.use('tex')
I have confirmed the following:
tex and latex are both installed and work, both are found by "which" and both run, version information:
tex: Version 3.14159265 (TeX Live 2020)
latex: pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020)
dvipng is installed and runs (v 1.17)
Ghostscript is installed and runs (v 9.50)
The above are all present in PATH, as well as os.environ['PATH']:
latex, tex, dvipng are in /Library/TeX/texbin/
gs is in /usr/local/bin
Full error output:
Traceback (most recent call last):
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/style/core.py", line 121, in use
rc = rc_params_from_file(style, use_default_template=False)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 883, in rc_params_from_file
config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 812, in _rc_params_in_file
with _open_file_or_url(fname) as fd:
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 790, in _open_file_or_url
with open(fname, encoding=encoding) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'tex'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/style/core.py", line 124, in use
raise IOError(
OSError: 'tex' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles
Questions I have:
How can I have the following sequence of outputs:
os.environ['PATH'] and sys.path both show '/Library/TeX/texbin'
os.path.isfile('/Library/TeX/texbin/tex') -> True
os.path.isfile('tex') -> False
Why is Matplotlib trying to open the tex executable as if its a (utf-8) text file ?
What other things should I try / verify ?
Thanks in advance !
Full Conda list output:
# Name Version Build Channel
blas 1.0 mkl
ca-certificates 2020.12.5 h033912b_0 conda-forge
cairo 1.16.0 h0ab9d94_1001 conda-forge
certifi 2020.12.5 py38h50d1736_1 conda-forge
curl 7.71.1 hb0a8c7a_1
cycler 0.10.0 py38_0
fontconfig 2.13.1 hd23ceaa_1004 conda-forge
freetype 2.10.4 ha233b18_0
gettext 0.19.8.1 h7937167_1005 conda-forge
glib 2.67.4 hdf23fa2_1
gmp 6.1.2 h0a44026_1000 conda-forge
graphite2 1.3.13 h12caacf_1001 conda-forge
harfbuzz 1.8.8 hb8d4a28_0
icu 58.2 h0a44026_1000 conda-forge
intel-openmp 2019.4 233
jpeg 9b he5867d9_2
kiwisolver 1.3.1 py38h23ab428_0
krb5 1.18.2 h75d18d8_0
lcms2 2.11 h92f6f08_0
libcurl 7.71.1 h8a08a2b_1
libcxx 10.0.0 1
libedit 3.1.20191231 h1de35cc_1
libffi 3.3 hb1e8313_2
libgfortran 3.0.1 h93005f0_2
libiconv 1.16 haf1e3a3_0 conda-forge
libpng 1.6.37 ha441bb4_0
libssh2 1.9.0 h52ee1ee_6 conda-forge
libtiff 4.1.0 hcb84e12_1
libxml2 2.9.10 h7cdb67c_3
lz4-c 1.9.3 h23ab428_0
matplotlib 3.3.4 py38hecd8cb5_0
matplotlib-base 3.3.4 py38h8b3ea08_0
mkl 2019.4 233
mkl-service 2.3.0 py38h9ed2024_0
mkl_fft 1.3.0 py38ha059aab_0
mkl_random 1.1.1 py38h959d312_0
mpfr 4.0.2 h44b798e_0 conda-forge
ncurses 6.2 h0a44026_1
numpy 1.19.2 py38h456fd55_0
numpy-base 1.19.2 py38hcfb5961_0
olefile 0.46 py_0
openjpeg 2.3.1 h254dc36_3 conda-forge
openssl 1.1.1j hbcf498f_0 conda-forge
ordered-set 4.0.2 pypi_0 pypi
pandas 1.2.3 py38hb2f4e1b_0
pcre 8.44 h4a8c4bd_0 conda-forge
pillow 8.1.2 py38h5270095_0
pip 21.0.1 py38hecd8cb5_0
pixman 0.38.0 h01d97ff_1003 conda-forge
poppler 0.81.0 h2ef9dbd_1
poppler-data 0.4.10 0 conda-forge
pyparsing 2.4.7 pyhd3eb1b0_0
python 3.8.8 h88f2d9e_4
python-dateutil 2.8.1 pyhd3eb1b0_0
python_abi 3.8 1_cp38 conda-forge
pytz 2021.1 pyhd3eb1b0_0
readline 8.1 h9ed2024_0
scipy 1.6.1 py38h2515648_0
seaborn 0.11.1 pyhd3eb1b0_0
setuptools 52.0.0 py38hecd8cb5_0
six 1.15.0 py38hecd8cb5_0
sqlite 3.33.0 hffcf06c_0
texlive-core 20180414 ha09c46f_0
tk 8.6.10 hb0a8c7a_0
tornado 6.1 py38h9ed2024_0
wheel 0.36.2 pyhd3eb1b0_0
xz 5.2.5 h1de35cc_0
zlib 1.2.11 h1de35cc_3
zstd 1.4.5 h41d2c2f_0
UPDATE:
Tried using
plt.rcParams.update({
"text.usetex": True})
And producing a simple plot, the following error occurs:
Traceback (most recent call last):
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/texmanager.py", line 275, in _run_checked_subprocess
report = subprocess.check_output(command,
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '/Users/will_gerrard/.matplotlib/tex.cache/d2acc2706db635f7f7afe7dc80ac47f1.tex']' returned non-zero exit status 1.
Here is the full report generated by latex:
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/will_gerrard/opt/miniconda3/envs/plotting/bin:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf/web2c:/Users/will_gerrard/opt/miniconda3/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf/web2c.
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
kpathsea: Running mktexfmt latex.fmt
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/will_gerrard/opt/miniconda3/envs/plotting/bin:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf/web2c:/Users/will_gerrard/opt/miniconda3/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf/web2c.
/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/mktexfmt: kpsewhich -var-value=TEXMFROOT failed, aborting early.
BEGIN failed--compilation aborted at /Users/will_gerrard/opt/miniconda3/envs/plotting/bin/mktexfmt line 25.
I can't find the format file `latex.fmt'!

Unable to run daphne from inside virtualenv

I am trying to run daphne installed inside the virtualenv and the following are the errors:
Traceback (most recent call last):
File "/path-to-virtualenv/bin/daphne", line 7, in <module>
from daphne.cli import CommandLineInterface
File "/path-to-virtualenv/local/lib/python3.6/dist-packages/daphne/cli.py", line 7, in <module>
from .server import Server
File "/path-to-virtualenv/local/lib/python3.6/dist-packages/daphne/server.py", line 4, in <module>
from twisted.internet import asyncioreactor # isort:skip
ModuleNotFoundError: No module named 'twisted.internet'
Environment:
1. mac osx mojave
2. python 3.6.5
When I try to import the module twisted.internet after activating the virtualenv, it works without any problem.
When I try to run daphne without using the virtualenv (global install), it works without throwing any errors as shown.
Following are the packages installed (by pip install -U channels):
asgiref 2.3.2
async-timeout 3.0.0
attrs 18.2.0
autobahn 18.9.2
Automat 0.7.0
channels 2.1.3
constantly 15.1.0
daphne 2.2.2
Django 2.1.2
hyperlink 18.0.0
idna 2.7
incremental 17.5.0
pip 18.0
PyHamcrest 1.9.0
pytz 2018.5
setuptools 40.4.3
six 1.11.0
txaio 18.8.1
wheel 0.32.0

ExtendedSelenium2Library - failed: ImportError: No module named keywords

I am running from a batch file that basically runs the robot.bat command.
Any suggestion on why would that be an issue and how to solve it? I see the packages are installed correctly. This is the first time I am attempting to run a test.
$ ./bin/run-windows.bat
>C:\Users\kondalar\workspace\rafa\cra-ui-qa>robot.bat --pythonpath C:/Users/kondalar/apps/conda/envs/robot-cray-ui-test2 --critical Critical --outputdir ..\report --variablefile C:/Users/kondalar/workspace/rafa/cra-ui-qa/config/windows-local-config.py C:/Users/kondalar/workspace/rafa/cra-ui-qa/cases/01*
[ ERROR ] Error in file 'C:\Users\kondalar\workspace\rafa\cra-ui-qa\resources\project-import.robot': Importing test library 'C:/Users/kondalar/apps/conda/envs/robot-cray-ui-test2/Lib/site-packages/ExtendedSelenium2Library' failed: ImportError: No module named keywords
Traceback (most recent call last):
File "C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2\Lib\site-packages\ExtendedSelenium2Library\__init__.py", line 27, in <module>
from ExtendedSelenium2Library.keywords import ExtendedElementKeywords
File "C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2\Lib\site-packages\ExtendedSelenium2Library\keywords\__init__.py", line 24, in <module>
from ExtendedSelenium2Library.keywords.extendedelement import ExtendedElementKeywords
File "C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2\Lib\site-packages\ExtendedSelenium2Library\keywords\extendedelement.py", line 27, in <module>
from Selenium2Library.keywords import _ElementKeywords
PYTHONPATH:
C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2
C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2
C:\Users\kondalar\apps\conda\envs\robot-ui-test\python27.zip
C:\Users\kondalar\apps\conda\envs\robot-ui-test\DLLs
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib\plat-win
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib\lib-tk
C:\Users\kondalar\apps\conda\envs\robot-ui-test
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib\site-packages
$ conda list
>packages in environment at C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2:
certifi 2017.11.5 py27h03b45e1_0
chardet 3.0.4 <pip>
coverage 4.4.2 <pip>
decorator 4.1.2 <pip>
idna 2.6 <pip>
jsonpath-rw 1.4.0 <pip>
jsonpath-rw-ext 1.1.3 <pip>
pbr 3.1.1 <pip>
pip 9.0.1 py27hdaa76b4_4
pluggy 0.6.0 <pip>
ply 3.10 <pip>
py 1.5.2 <pip>
python 2.7.13 h1b6d89f_16
requests 2.18.4 <pip>
robotframework 3.0.2 <pip>
robotframework-databaselibrary 1.0.1 <pip>
robotframework-debuglibrary 0.8.1 <pip>
robotframework-extendedselenium2library 0.9.1 <pip>
robotframework-jsonlibrary 0.2 <pip>
robotframework-requests 0.4.7 <pip>
robotframework-selenium2library 3.0.0 <pip>
robotframework-seleniumlibrary 3.0.0 <pip>
selenium 3.8.0 <pip>
ExtendedSelenium2Library doesn't support SeleniumLibrary version 3. It's trying to import things that are in Selenium2Library which no longer exists with version 3.

Categories

Resources