Python error ValueError: substring not found - python

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

Related

How can I solve Python IDLE3 start problem?

friends...
I've just installed IDLE3 package for Python (running Python 3.8)...
When I try to start it there is a message like this:
[ibmsys01#gustavo-ubuntu ~/zPDT]$ idle
** Invalid host: ('192.168.0.17', 57676)
Traceback (most recent call last):
File "/usr/bin/idle", line 5, in <module>
main()
File "/usr/lib/python3.8/idlelib/pyshell.py", line 1516, in main
shell = flist.open_shell()
File "/usr/lib/python3.8/idlelib/pyshell.py", line 331, in open_shell
if not self.pyshell.begin():
File "/usr/lib/python3.8/idlelib/pyshell.py", line 1049, in begin
client = self.interp.start_subprocess()
File "/usr/lib/python3.8/idlelib/pyshell.py", line 465, in start_subprocess
self.rpcclt.accept()
File "/usr/lib/python3.8/idlelib/rpc.py", line 544, in accept
raise OSError
OSError
[ibmsys01#gustavo-ubuntu ~/zPDT]$
I haven't found any reference to this error. Has any of you seen it before? Can you please help get through it?
My environment is:
Linux Ubuntu 20.04 LTS
Python 3.8.5
IDLE3
An additional detail: invoking "idle" or "idle3" gives me the same error.
Can you please help me get through this?
Thank you and best regards.
Gustavo.

Pyscreenshot doesn't work with PyQt5(Pyinstaller)

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

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/

AWS-CLI throwing unexpected Python based 'Session' error

I have been using AWS CLI on Ubuntu for a month. But today AWS CLI is throwing a python error, I haven't seen before:
sashank#sashank:~$ aws configure
Traceback (most recent call last):
File "/usr/local/bin/aws", line 27, in <module>
sys.exit(main())
File "/usr/local/bin/aws", line 23, in main
return awscli.clidriver.main()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 48, in main
return driver.main()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 173, in main
parser = self._create_parser()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 154, in _create_parser
command_table['help'] = self.create_help_command()
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 149, in create_help_command
cli_data.get('help_usage', None))
File "/usr/local/lib/python2.7/dist-packages/awscli/help.py", line 259, in __init__
HelpCommand.__init__(self, session, session.provider,
AttributeError: 'Session' object has no attribute 'provider'
I have tried purging AWS CLI and removing all package files and re-installing, but error persists. Plz help!! Thanks.
Probably you have upgraded your virtualenv/setuptools and now your utility is screwed up. It happened to me with a wrongly set Chef that upgraded those two packages and, after that, the utility stopped working.

Categories