Encountering an Error in Robot Framework after tests run - python

I am new to using Robot Framework, and have run into a problem while running tests on a Jenkins server. The tests are passing, and after the tests run I get the following message:
Output: /opt/bitnami/apps/jenkins/jenkins_home/jobs/Robot Test/workspace/robot/Results/output.xml
[ ERROR ] Reading XML source '/opt/bitnami/apps/jenkins/jenkins_home/jobs/Robot Test/workspace/robot/Results/output.xml' failed: ImportError: >No module named expat; use SimpleXMLTreeBuilder instead
I get this message regardless of what tests I run. I am not explicitly calling expat or any other xml module.
I am running Python 2.7.9 and Robot Framework 3.0.
If I run "pybot -o NONE" to cancel the logging the error goes away, but I do want the logging and do not know how to stop the error.
Thanks for any help you can offer.

In case it helps anyone who finds this, it appears that my issue was that some of the modules I installed using pip were not installed using "sudo". This led a few of them to install the module, but with errors. When I uninstalled them, and then reinstalled them with sudo, this error has not reappeared.

Related

VSCode doesn't recognize ConfluentKafkaLibrary to use in Robot Framework

I need to do a test automation in Robot Framework using Kafka topics. I'm trying to use the ConfluentKafkaLibrary library, but VSCode doesn't recognize it.
I already installed the commands:
pip install robotframework-confluentkafkalibrary
pip install confluent-kafka
Still, it keeps giving the error:
Unresolved library: ConfluentKafkaLibrary. Error generating libspec: Importing library 'ConfluentKafkaLibrary' failed: ModuleNotFoundError: No module named '_bz2' Consider adding the needed paths to the "robot.pythonpath" setting and calling the "Robot Framework: Clear caches and restart" action.
Does anyone know how to solve this problem?
IMAGE - error message
I already tried to reinstall all libraries.
I already tried to configure the robot.pythonpath.
I've restarted VSCode several times, after each step.

how to fix the "__path__ attribute not found" error for packages installed by pip installer?

I recently installed the opencv package using pip install and I wrote a small code to test it (cvtest.py). The code runs through the python idle shell but running it though the command prompt gives the error
Error while finding module specification for 'cvtest.py' (ModuleNotFoundError: __path__ attribute not found on 'cvtest' while trying to find 'cvtest.py')
I tried uninstalling and reinstalling both python and the package. looking up the system path using python -m site gives these results. I am the only user of my laptop.
sys.path = [
'C:\\Users\\Kareem Mostafa\\Desktop\\Assignments\\computer vision',
'G:\\Python37\\python37.zip',
'G:\\Python37\\DLLs',
'G:\\Python37\\lib',
'G:\\Python37',
'G:\\Python37\\lib\\site-packages',
This is the code I am using
import cv2
x=cv2.imread('backpack for sale.jpg',0)
cv2.imshow('x',x)
update: the problem is happening with all the py files I am having whether they require imports or not. apparently python is looking for _init_.py for all the files as if they are packages. Any idea what is going on?
For anyone else that had this problem (assuming kareemostafa has fixed it now!)
Removing the .py suffix on the python -m command fixes this problem, it appears -m only requires module names whereas running it directly as a python file (no -m option) requires the .py suffix
In your case python -m cvtest should be sufficient.

ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect

I downloaded a Python wrapper called rawpy recently using easy_install (pip install did not work). When I imported it and attempted to run code, this error appeared: "ImportError: DLL load failed: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail."
Could anyone offer a fix for this?
I looked at similar questions on SO and found that a common theme was that they had incorrect versions of whatever they were working with. I decided to switch to Python 3.5.3 over 2.7; this fixed the problem, but a new error "ImportError: No module named 'rawpy'" appeared. This is because the module is now in the incorrect directory. I was able to fix this by uninstalling and reinstalling the module using pip.

Heroku ImportError: No module named tweepy - but it's installed and runs fine locally

I've made a very simple Twitter bot in Python using the Tweepy library. Everything works beautifully locally and it tweets when I run the correct script exactly as it's supposed to. However, I'd like to automate this so that it tweets a couple of times a day, so have tried using the Heroku Scheduler for this.
I'm able to push to Heroku with no problems, but when I try to run the worker on Heroku I get this error message (which means of course the scheduler isn't working either since it's running the same process):
Running `worker` attached to terminal... up, run.8157
/app/.bash_profile: line 6: parts: command not found
Traceback (most recent call last):
File "/app/workspace/botlovesyou/lovescript.py", line 4, in <module>
import tweepy, time
ImportError: No module named tweepy
So, erm...what now? I've Googled and found this but am not sure how to actually fix it. This question looks deceptively similar but I don't have the other missing dependency that caused his issue.
I've tried running pip install tweepy again but of course it says 'Requirement already satisfied'. I've tried pip uninstalling it then pip installing it again - it reinstalls no problem, but I get the same error when it's on heroku. I've also tried installing the buildpack mentioned at the link above but it failed to build and wouldn't allow me to push so I removed it.
EDIT: I've now also tried git cloning and installing tweepy using setup.py. Again, installation ran with no errors but Heroku still says there's no module named Tweepy.
Tweepy is definitely installed in the site-packages directory. What am I missing?
Many thanks.
Problem resolved (this problem, anyway).
Install was aborting when it reached PIL in the requirements.txt file - it can't be installed via pip and was just skipping installing everything after it. I don't require PIL for this project so just removed it from requirements (I don't really know why it was in requirements in the first place, I think it was a nitrous.io preinstall). Very simple solution in this case.
Edited to add - on starting a new Python box on Nitrous, PIL was preinstalled correctly. So I think my initial install might have been corrupted.
Ugh. Edited again. Nitrous seems to have eaten PIL again, or maybe Heroku has. Same error. Again removed it from requirements.

Python3 not accessing requests module

I've installed the requests module for Python3 on my system, and appears to have installed completely fine. When I run a script involving use of said package on PyCham using Python3 interpreter, it runs without a problem. However, when executed outside this environment, this error pops up:
ImportError: no module named requests
This happens despite PATH containing Python34, which invokes correctly when call via cmd, and me double checking the installation via pip. Is there any possible area you could point me to that could resolve this problem?
Thanks in advance.
Maybe you have two Pythons installed. One is used by PyCharm (and it has requests) and second is used in cmd. Beside pip can be part of Python used by PyCharm not Python used in cmd.

Categories