How to deal with run-time errors in subprocess.call

Occurrence event

[Stada] Script that will call you when Pokemon GO is released When I tried to plagiarize the above article and execute the script with cron The following error occurs when executing a command in the subprocess module of python

python poke_check.py 
Traceback (most recent call last):
  File "poke_check.py", line 47, in <module>
    start()
  File "poke_check.py", line 43, in start
    subprocess.call("echo 'not open'")
  File "/usr/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Cause / Solution

http://stackoverflow.com/questions/18962785/oserror-errno-2-no-such-file-or-directory-while-using-python-subprocess-in-dj

Solved by the stackoverflow article above.

It seems that a flag is required when passing the command to be executed as a character string.

subprocess.call("(Command you want to execute)", shell=True)

Recommended Posts

How to deal with run-time errors in subprocess.call
How to deal with DistributionNotFound errors
How to deal with enum compatibility errors
For beginners, how to deal with common errors in keras
[Python] How to deal with module errors
How to deal with memory leaks in matplotlib.pyplot
How to deal with errors when hitting pip ②
How to deal with pyenv initialization failure in fish 3.1.0
How to deal with Executing transaction: failed in Anaconda
How to deal with imbalanced data
How to deal with imbalanced data
[AWS] How to deal with "Invalid codepoint" error in CloudSearch
How to deal with python installation error in pyenv (BUILD FAILED)
How to deal with errors when installing whitenoise and deploying to Heroku
How to deal with errors when installing Python and pip with choco
[REAPER] How to play with Reascript in Python
can't pickle annoy. How to deal with Annoy objects
How to deal with module'tensorflow' has no attribute'〇〇'
How to deal with SessionNotCreatedException when using Selenium
How to use tkinter with python in pyenv
How to deal with garbled characters in json of Django REST Framework
How to deal with old Python versions in Cloud9 made by others
[EC2] How to deal with errors that selenium cannot execute (No module named selenium)
How to deal with "No module named'〇〇'" error in Jupyter Notebook | Install with! Pip!
How to convert / restore a string with [] in python
How to do hash calculation with salt in Python
Explain in detail how to make sounds with python
How to deal with Django's Template Does Not Exist
How to do zero-padding in one line with OpenCV
How to load files in Google Drive with Google Colaboratory
How to access with cache when reading_json in pandas
[Python] How to deal with pandas read_html read error
How to resolve SSL module errors in Anaconda environment
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to develop in Python
2 ways to deal with SessionNotCreatedException
How to Delete with SQLAlchemy?
How to embed multiple embeds in one message with Discord.py
[TensorFlow 2 / Keras] How to run learning with CTC Loss in Keras
[Automatic test] How to start making automatic test during runtime with Airtest
How to output a document in pdf format with Sphinx
How to extract any appointment in Google Calendar with Python
How to check ORM behavior in one file with django
[Django] How to give input values in advance with ModelForm
How to manipulate the DOM in an iframe with Selenium
[Linux] How to deal with garbled characters when viewing files
A story about how to deal with the CORS problem
How to create dataframes and mess with elements in pandas
How to deal with UnicodeDecodeError when executing google image download
Try HeloWorld in your own language (with How to & code)
How to log in to AtCoder with Python and submit automatically
[VLC] How to deal with the problem that it is not in the foreground during playback
How to cancel RT with tweepy
[Python] How to do PCA in Python
How to handle session in SQLAlchemy
Python: How to use async with
How to use classes in Theano