Python Shell Script Running but Not running when calling it via crontab - python

Problem: I am trying to run a shell script which contains python script from Debian Linux env which is running properly but when I am calling it via crontab it is giving me an error below.
error
Traceback (most recent call last):
File "/home/samsunguk/env/lib/python3.5/site-packages/oauth2client/clientsecrets.py", line 121, in _loadfile
with open(filename, 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: './client_secrets.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/samsunguk/env/lib/python3.5/site-packages/pydrive/auth.py", line 386, in LoadClientConfigFile
client_type, client_info = clientsecrets.loadfile(client_config_file)
File "/home/samsunguk/env/lib/python3.5/site-packages/oauth2client/clientsecrets.py", line 165, in loadfile
return _loadfile(filename)
File "/home/samsunguk/env/lib/python3.5/site-packages/oauth2client/clientsecrets.py", line 125, in _loadfile
exc.strerror, exc.errno)
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 "/home/samsunguk/segmentTrendsandTraits/segmentTrend.py", line 193, in <module>
extract_data(60, "csv_output_all_data_segments_BAAAM.csv", "output_data_segments_Last60days.csv", "output_data_segments_Last60days.xlsx")
File "/home/samsunguk/segmentTrendsandTraits/segmentTrend.py", line 185, in extract_data
gauth.LocalWebserverAuth()
File "/home/samsunguk/env/lib/python3.5/site-packages/pydrive/auth.py", line 113, in _decorated
self.GetFlow()
File "/home/samsunguk/env/lib/python3.5/site-packages/pydrive/auth.py", line 443, in GetFlow
self.LoadClientConfig()
File "/home/samsunguk/env/lib/python3.5/site-packages/pydrive/auth.py", line 366, in LoadClientConfig
self.LoadClientConfigFile()
File "/home/samsunguk/env/lib/python3.5/site-packages/pydrive/auth.py", line 388, in LoadClientConfigFile
raise InvalidConfigError('Invalid client secrets file %s' % error)
pydrive.settings.InvalidConfigError: Invalid client secrets file ('Error opening file', './client_secrets.json', 'No such file or directory', 2)
My python script has google authorization credentials.
Can anyone help me why I am getting this error?

Related

Python script Traceback

Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/psutil/_common.py", line 399, in wrapper
return cache[key]
~~~~~^^^^^
KeyError: (('/proc',), frozenset())
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/psutil/_pslinux.py", line 285, in
set_scputimes_ntuple("/proc")
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/psutil/_common.py", line 401, in wrapper
ret = cache[key] = fun(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/psutil/_pslinux.py", line 268, in set_scputimes_ntuple
with open_binary('%s/stat' % procfs_path) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/psutil/_common.py", line 728, in open_binary
return open(fname, "rb", buffering=FILE_READ_BUFFER_SIZE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/proc/stat'
Traceback (most recent call last):
File "/data/data/com.termux/files/home/YouTube-Viewer/youtube_viewer.py", line 33, in
from fake_headers import Headers, browsers
ModuleNotFoundError: No module named 'fake_headers'
What's problem ? I don't know

py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:25333)

I was running a server within a docker container, the package and image were provided by others so I can't access the code but only the tar.gz package, and I have no idea what services this container is providing.
It worked right several days ago and was not working since one restart, then I restarted it several times trying to get it to run, but it still has the same error. Is there any chance to make it run without touching the code since I cannot? Here is the error description:
P29 2022-05-25 10:59:24,923 INFO [lib_dataserver_exp.py:137] backend config: backend.conf
P29 2022-05-25 10:59:25,046 INFO [data_server.py:134] starting helper: java -Xmx32g -Dmoqi.logfile=helper -jar /root/fm-package/backend/backend.jar -c /root/fm-package/backend/backend.conf helper
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 958, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 1096, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/fabric/main.py", line 763, in main
*args, **kwargs
File "/opt/conda/lib/python3.6/site-packages/fabric/tasks.py", line 427, in execute
results['<local-only>'] = task.run(*args, **new_kwargs)
File "/opt/conda/lib/python3.6/site-packages/fabric/tasks.py", line 174, in run
return self.wrapped(*args, **kwargs)
File "/builds/fingerprint-core/fingerprint-matching/fm_lib/data_server/lib_dataserver_exp.py", line 151, in start_dataserver
File "/builds/fingerprint-core/fingerprint-matching/fm_lib/data_server/data_server.py", line 648, in __init__
File "/builds/fingerprint-core/fingerprint-matching/fm_lib/data_server/data_server.py", line 140, in __init__
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 1284, in __call__
answer = self.gateway_client.send_command(command)
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 1012, in send_command
connection = self._get_connection()
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 960, in _get_connection
connection = self._create_connection()
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 966, in _create_connection
connection.start()
File "/opt/conda/lib/python3.6/site-packages/py4j/java_gateway.py", line 1108, in start
raise Py4JNetworkError(msg, e)
py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:25333)
failed to send log to fluentd

Openstack Trove - Polling request timed out

We are trying to deploy OpenStack environment for our application and while deploying trove service we are facing the below error:
File "/usr/lib/python3/dist-packages/trove/common/utils.py", line 207, in wait_for_task
return polling_task.wait()
File "/usr/lib/python3/dist-packages/eventlet/event.py", line 125, in wait
result = hub.switch()
File "/usr/lib/python3/dist-packages/eventlet/hubs/hub.py", line 313, in switch
return self.greenlet.switch()
File "/usr/lib/python3/dist-packages/oslo_service/loopingcall.py", line 154, in _run_loop
idle = idle_for_func(result, self._elapsed(watch))
File "/usr/lib/python3/dist-packages/oslo_service/loopingcall.py", line 349, in _idle_for
raise LoopingCallTimeOut(
oslo_service.loopingcall.LoopingCallTimeOut:
Looping call timed out after 870.99 seconds
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/trove/taskmanager/models.py", line 434, in wait_for_instance
utils.poll_until(self._service_is_active,
File "/usr/lib/python3/dist-packages/trove/common/utils.py", line 223, in poll_until
return wait_for_task(task)
File "/usr/lib/python3/dist-packages/trove/common/utils.py", line 209, in wait_for_task
raise exception.PollTimeOut
trove.common.exception.PollTimeOut: Polling request timed out.```

Python SpeechRegonition

I write a little program which writes the audio to text. But it throws an error and I don't know how to fix it.
import speech_recognition as sr
file_name = "halloWelt.wav"
speech_engine = sr.Recognizer()
with sr.AudioFile(file_name) as file:
data = speech_engine.record()
text = speech_engine.recognize_google(data, language='de-DE')
print(text)
The error:
Traceback (most recent call last):
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition\__init__.py", line 203, in __enter__
self.audio_reader = wave.open(self.filename_or_fileobject, "rb")
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\wave.py", line 509, in open
return Wave_read(f)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\wave.py", line 163, in __init__
self.initfp(f)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\wave.py", line 130, in initfp
raise Error('file does not start with RIFF id')
wave.Error: file does not start with RIFF id
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition\__init__.py", line 208, in __enter__
self.audio_reader = aifc.open(self.filename_or_fileobject, "rb")
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\aifc.py", line 917, in open
return Aifc_read(f)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\aifc.py", line 352, in __init__
self.initfp(file_object)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\aifc.py", line 316, in initfp
raise Error('file does not start with FORM id')
aifc.Error: file does not start with FORM id
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition\__init__.py", line 234, in __enter__
self.audio_reader = aifc.open(aiff_file, "rb")
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\aifc.py", line 917, in open
return Aifc_read(f)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\aifc.py", line 358, in __init__
self.initfp(f)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\aifc.py", line 314, in initfp
chunk = Chunk(file)
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\chunk.py", line 63, in __init__
raise EOFError
EOFError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\\OneDrive\Dokumente\Programming\Python\Lets code\speech.py", line 6, in <module>
with sr.AudioFile(file_name) as file:
File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\speech_recognition\__init__.py", line 236, in __enter__
raise ValueError("Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format")
ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format

python can't show my installed librery packages

devignesh#devignesh:~/soup$ pip list
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2556, in version
return self._version
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2663, in __getattr__
raise AttributeError(attr)
AttributeError: _version
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/basecommand.py", line 141, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/list.py", line 143, in run
self.output_package_listing(packages, options)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/list.py", line 208, in output_package_listing
data, header = format_for_columns(packages, options)
File "/usr/local/lib/python3.5/dist-packages/pip/_internal/commands/list.py", line 274, in format_for_columns
row = [proj.project_name, proj.version]
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2561, in version
raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/home/devignesh/.local/lib/python3.5/site-packages))
devignesh#devignesh:~/soup$

Categories

Resources