Pyscreenshot doesn't work with PyQt5(Pyinstaller) - python

When I am running my app from IDE, it works great, but if I run app built with PyInstaller, pyscreenshot.grab works like MainWindow.show(). I tried 3 different backends(PyQt5; PIL; default) and none of them work. If you dont understood me, you can watch video
If I close window, an error appears:
Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.py", line 926, in _bootstrap_inner
File "threading.py", line 870, in run
File "main1.py", line 96, in main
File "lib\site-packages\pyscreenshot\__init__.py", line 31, in grab
File "lib\site-packages\pyscreenshot\loader.py", line 145, in backend_grab
File "lib\site-packages\pyscreenshot\loader.py", line 136, in force
File "lib\site-packages\pyscreenshot\childproc.py", line 39, in childprocess_grab
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\AppData\\Local\\Temp\\pyscreenshotmrgm1pkk\\screenshot.png'
P.S. I am using dev version of PyInstaller, because I need TensorFlow support

Using PIL.ImageGrab.grab() instead of ps.grab() fixed problem

Related

issue with hubble-pi camera capture

I have recently tried to install and get working a program developed to use with a telescope. It is called hubble-pi and can be found here. https://github.com/RemovedMoney326/Hubble-Pi
The program runs but when i click the capture button I get this issue. I have reached out to the dev but he has not replied and that was over a month ago. If anyone could assist in figuring out a solution that be awesome.
Im a beginner when it comes to python so be easy. This is also happening on boot up as this is the first thing im doing when turning on my RPI. I am running this on a RPI 4 2gb.
Python 3.7.3 (/usr/bin/python3)
>>> %Run AstroCam.py
Start
Capture
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/AstroCameraApp/PythonScripts/AstroCam.py", line 60, in camHandler
camera.resolution = DynamicCaptureResolution #set photo size
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 2282, in _set_resolution
self._enable_camera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1976, in _enable_camera
self._camera.enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 724, in enable
prefix="Failed to enable component")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable component: Out of resources
I just hit this same error with another Picamera IMX477 app, and found a fix.
Set gpu-mem=192 in /boot/config.txt, reboot, and 4032x3040 starts working.
This is for Pi-4, 2GB running Buster. Bullseye is a different animal.

client_secrets.json not found in pyiinstaller

so I have this program in python that I want to use pyinstaller to make into an executable. It runs perfectly on its own and pyinstaller makes the executable fine but when I run the executable I get this:
Traceback (most recent call last):
File "site-packages/pydrive/auth.py", line 386, in LoadClientConfigFile
File "site-packages/oauth2client/clientsecrets.py", line 165, in loadfile
File "site-packages/oauth2client/clientsecrets.py", line 125, in _loadfile
oauth2client.clientsecrets.InvalidClientSecretsError: ('Error opening file',
'client_secrets.json', 'No such file or directory', 2)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "updating.py", line 17, in <module>
File "site-packages/pydrive/auth.py", line 113, in _decorated
File "site-packages/pydrive/auth.py", line 443, in GetFlow
File "site-packages/pydrive/auth.py", line 366, in LoadClientConfig
File "site-packages/pydrive/auth.py", line 388, in LoadClientConfigFile
pydrive.settings.InvalidConfigError: Invalid client secrets file ('Error
opening file', 'client_secrets.json', 'No such file or directory', 2)
[34574] Failed to execute script updating
Why does this work on its own but pyinstaller doesn't catch anything until the executable is ran? I can't seem to find an answer otherwise.
Notable Info:
I'm running a Mac OS X, Mojave 10.14.2, Python Version 3.7.2.
The client_secrets.json is from a Google Drive API, v3
The file is in my directory just like all my other files, in the same spot.
Thanks!!

Tensorflow download_and_convert_mnist_m.py No such file or directory: '~/dsn_data/mnist_m/mnist_m_train'

I have a weird error message using the download_and_convert_mnist_m.py script from github https://github.com/tensorflow/models/tree/master/research/domain_adaptation/datasets.
The command I am using from the models/research/ folder is
python domain_adaptation/datasets/download_and_convert_mnist_m.py --dataset_dir=~/dsn_data/
The error message is
Traceback (most recent call last):
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 237, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 233, in main
run(FLAGS.dataset_dir)
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 201, in run
os.path.join(dataset_dir, 'mnist_m', 'mnist_m_train'))
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 177, in _get_filenames
for filename in os.listdir(dataset_dir):
OSError: [Errno 2] No such file or directory: '~/dsn_data/mnist_m/mnist_m_train'
I tried several ways:
without creating the path before and without having the data before
create the path before and let it empty
download and unpack data from https://drive.google.com/drive/folders/0B_tExHiYS-0vR2dNZEU4NGlSSW8 at the specified path as described here https://github.com/tensorflow/models/tree/master/research/domain_adaptation
I use
Ubuntu 16.04
Python 2.7
tensorflow 1.4.1
What else can I do.. looks like an pretty simple error but I have no more ideas.
I solved it. The correct command is without the equal sign.
python domain_adaptation/datasets/download_and_convert_mnist_m.py --dataset_dir=~/dsn_data/

Python error ValueError: substring not found

I have no experience with python and I am installing a mongodb tools from https://github.com/rueckstiess/mtools. After installation and launch the application I got below exception errors. It seems that there is a grama issue but I am not sure about it. Is it caused by python version? I am using python 2.7. How can I know which version fix this problem?
# mlaunch init --single
Traceback (most recent call last):
File "/usr/local/bin/mlaunch", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 1438, in main
tool.run()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 260, in run
getattr(self, self.args['command'])()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 280, in init
current_version = self.getMongoDVersion()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 475, in getMongoDVersion
if current_version.rindex('v') > 0:
ValueError: substring not found

Marmalade deploy - deployment.py, line 62, in SetOpt

I got a mac book pro retina and I'am trying to create a project from the .mkb file: but I got this error
Building project: /Users/sergioandreotti/Downloads/twins/template/marmalade/FeedtheTwins.mkb
Traceback (most recent call last):
File "/Developer/Marmalade/6.1/s3e/makefile_builder/mkb.py", line 209, in <module>
run()
File "/Developer/Marmalade/6.1/s3e/makefile_builder/mkb.py", line 137, in run
main(sys.argv)
File "/Developer/Marmalade/6.1/s3e/makefile_builder/mkb.py", line 32, in main
exit_code = mkb_main.run(argv)
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 3461, in run
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 3619, in run2
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 2697, in process_mkb_for_platform
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 690, in process
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 2602, in process_file
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 2124, in process
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 2124, in <lambda>
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 1971, in process
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/mkb_main.py", line 1130, in process_deployment_line
File "/p4/sdkbuild/sdk/main/s3e/makefile_builder/deployment.py", line 62, in SetOpt
NameError: global name 'output' is not defined
Press enter to continue...
I ve found this solution: https://devnet.madewithmarmalade.com/questions/2784/mkb-fails-to-build.html
but I don't think it's the best solution.
it's working for building the project but I got other problems when I have to deploy with the Marmalade deploy tool.
Sometimes deploy fails and the error in the error log is the same "global name 'output' is not defined"
I m not able to save my configuration in the .mkb, because if I do this, next time I reload the configuration, the deploy fails.
it was my fault, I had marmalade 6.1.1 installed instead of 6.1.2.
6.1.1 doensn't provide retina support and in the .mkb there was the tag "Enable 4-inch Retina Support" set.

Categories