Class is implemented in both places when using py2app - python

I am trying to make a standalone application using py2app with python3:
python3 setup.py py2app --packages=PyQt5
Everything seems to work just fine. But when one launches the application, the following errors are caught in Mac console:
14/04/16 13:27:27,688 app[98583]: objc[98583]: Class RunLoopModeTracker
is implemented in both
/Users/muammar/github/app/dist/app.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
and /usr/local/Cellar/qt5/5.6.0/lib/QtCore.framework/Versions/5/QtCore.
One of the two will be used. Which one is undefined.
That is also reported for the classes: NotificationReceiver, QCocoaPageLayoutDelegate and others.
I read elsewhere, that placing a qt.conf file next to the application as suggested here should solve the problem. But actually it does not work in my case. Does anybody know how to avoid this problem?.

For those having this problem, I fix it by doing the following:
python3 setup.py py2app --packages=PyQt5
cp -R /usr/local/Cellar/qt5/5.6.0/plugins dist/mya.app/Contents/PlugIns
macdeployqt dist/my.app
The problem is gone, and it works everything OK.

Related

OSError: Starting path not found (dotenv-0.21.0-py3.9.egg)

I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, which has an older python version, it gives me the following error:
Does anyone know how to fix this error?
I tried to install dotenv via pip manually, but it doesn't work.
I think you should use Pylaucher, to start Pylaucher you must Use Shebang (#) in The Script Run Pylauncher Command. Then you will be able to run multiple versions of python in Windows without getting errors. There are too many methods you can use; I strongly suggest this one since has once worked for me.

Cannot find module "qfi" for running JdeRobot drone_cat_mouse exercise from source

I want to run JdeRobot drone_cat_mouse on my Ubuntu 20.04. I'm using ROS Noetic and has faithfully followed these installation instructions. Everything it told me to test was working properly.
When I first ran roslaunch drone_cat_mouse.launch, there was an import error for teleopWidget and sensorsWidget which I fixed by using relative imports. Then I had an error No module named qfi.
Unlike teleopWidget and sensorsWidget, I couldn't find the qfi module in the JdeRobot/drones source code. So I googled it, and the only relevant result that popped up was this, which led to this link. They said to:
sudo touch /usr/lib/python2.7/dist-packages/qfi/__init__.py
But I ran that command and this happened!
Not even pip has a "qfi" module!
So I thought to check JdeRobot's entire repository. Turns out it was in JdeRobot/base, and that repo is not maintained anymore!
After further digging, there was this issue which basically tells us forget about it and move to the web release! But I can't, circumstances forced me to use the source code option (deliverables are drone_cat_mouse.world and my_solution.py, it's impossible for me to get the former in the docker web version and the latter's format is different between the source code version and the web version).
In a nutshell, how do I fix this qfi module problem so that I can run the exercises from source like these people?
I'm just stupid, as usual. all I need to do was clone https://github.com/JdeRobot/ThirdParty, get the qfi module, copy it to
~/catkin_ws/src/drones/rqt_drone_teleop/src/rqt_vel_teleop/ and replace all qfi imports with its relative import version. All common sense
No errors in terminal, gazebo runs, but somehow the rqt widget for drone vision never appears.
Forget it, I'm giving up on this dumpster fire of a program.
Edit: I did another fresh install, followed the steps, noticed troubleshooting for qfi which required qmake, but same end result
If you're trying to launch drone_cat_mouse there is an issue with the namespace of the RQT widget that occurs when you try to launch it.
Namely, the topics that exist for drone_cat_mouse are prefixed by cat/ or mouse/. But RQT will try to access these topics without the prefix and run into an error. Alternatively, since you have a local install, you can try to run the code manually by running
python my_solution.py
Just make sure the change the area where the DroneWrapper class was called in the following manner:
HAL = DroneWrapper('drone', 'cat/')
Here 'drone' is the name of the node you are creating and 'cat/' is the namespace given to the DroneWrapper Class.

pytest - Windows fatal exception: code 0x8001010d

I am trying to run a GUI test using pytest and pywinauto. When I run the code normally, it does not complain.
However, when I am doing it via pytest, it throws a bunch of errors:
Windows fatal exception: code 0x8001010d
Note that the code still executes without problems and the cases are marked as passed. It is just that the output is polluted with these weird Windows exceptions.
What is the reason for this. Should I be concerned?
def test_01():
app = Application(backend='uia')
app.start(PATH_TO_MY_APP)
main = app.window(title_re="MY_APP")
main.wait('visible', timeout=8) # error occurs here
time.sleep(0.5)
win_title = f"MY_APP - New Project"
assert win_title.upper() == main.texts()[0].upper() # error occurs here
This is an effect of a change introduced with pytest 5.0.0. From the release notes:
#5440: The faulthandler standard library module is now enabled by default to help users diagnose crashes in C modules.
This functionality was provided by integrating the external pytest-faulthandler plugin into the core, so users should remove that plugin from their requirements if used.
For more information see the docs: https://docs.pytest.org/en/stable/usage.html#fault-handler
You can mute these errors as follows:
pytest -p no:faulthandler
I had the same problem with Python 3.7.7 32-bit and pytest 5.x.x. It was solved by downgrading pytest to v.4.0.0:
python -m pip install pytest==4.0
Perhaps all Python versions are not compatible with the newest pytest version(s).
My workaround for now is to install pytest==4.6.11
With 5.0.0 the problem occurs the first time.
W10 box.
Have this problem using pytest 6.2.5 and pytest-qt 4.0.2.
I tried np8's idea: still got a horrible crash (without message).
I tried Felix Zumstein's idea: still got a horrible crash (without message).
Per this thread it appears the issue (in 'Doze) is a crap DLL.
What's strange is that pytest-qt and the qtbot fixture seem to work very well... until I get to this one test. So I have concluded that I have done something too complicated in terms of mocking and patching for this crap 'Doze DLL to cope with.
For example, I mocked out two methods on a QMainWindow subclass which is created at the start of the test. But removing these mocks did not solve the problem.
I have so far spent about 2 hours trying to understand what specific feature of this test is so problematic. I am in fact trying to verify the functioning of a method on my main window class which "manufactures" menu items (QWidgets.QAction) based on about 4 parameters.
At this stage I basically have no idea what this "problem feature" is, but it might be the business of inspecting and examining the returned QAction object.

Failure to install ndg-httpsclient or maybe I'm doing the solution wrong

I'm new to python and have a little experience with VS, C# and WPF.
My question might seem similar to some asked questions, but I tried several of the suggested solutions (that worked for others), and yet it doesn't work for me.
I'm trying to build a simple WPF application that will send http requests.
The solution structure is as follows:
Solution MyApp
Project 1 <This is the startup project>
GUImodul.py
queryStringBuilder.py
<This project uses IronPython env for the WPF support>
Project 2
QuerySender.py (includes two classes)
<This project uses Python 3.4 env, only in this one I managed installing the "requests" package which I need for sending the query>
When I try to run this I get an error "No module named ndg.httpsclient.ssl_peer_verification", even though I only import from project 2 a class that doesn't contain any import from "requests" (it only creates an instance of the other class there that does have such import).
When I try to install ndg-httpsclient using pip, I get "Command python setup.py egg_info failed with error code 1".
Things I tried so far:
Adding "-X:FullFrames" to the debug properties of both projects
(re)installing steuptools with from ez_setup.zip
As said - ndg-httpsclient is installed for Python34
Using the "import requests" command only within the class NOT imported to Project1 (the one with IronPython env)
Tried installing a newer(?) version of urllib3
So...
I just might be doing something fundamentally wrong in this solution, which in this case I wish someone to help me understand what it is.
Otherwise, any idea what can I try next to make this thing work?
If you read the fine print, ndg-httpsclient is incompatible with Python 3, as it was developed for Python2.7 . That's probabably the root cause.
RE: Why is Python 3.0 not backward compatible?

Python raising _ExpectedFailure for unittests with #unittest.expectedFailure

I have two systems running the same set of Django unittests. Some of the tests use the #unittest.expectedFailure decorator.
On one system, these are running fine and reporting at the end of the test run OK (expected failures=10, unexpected successes=2).
On the other system, the same tests error, but raise _ExpectedFailure and _UnexpectedSuccess without tracebacks.
Has anyone seen this behavior before? Is it a configuration issue? Both systems are running Python 2.7, Django 1.3, and have unittest and unittest2 installed.
I have the problem and I got it to work by deleting the /usr/local/lib/python2.7 and then reinstalling everything from scratch.
The reason for this I believe is that python may not have cleared it's python object and cache files(*.pyc, *.pyo) from it's working directory. That is, not YOUR project's directory but where python actually runs from.
Not sure if that's it but it worked for me!!

Categories

Resources