I want to run a python script, say train_rnn_wdcnn_loads.py
in jupyter notebook from Anaconda in Win 10.
But I constantly get this error:
ipykernel_launcher.py: error: the following arguments are required: -data_path
(I'm new in Python and still figuring out how argparse works)
The code are:
import argparse
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
parser.add_argument('-data_path', required=True)
args = parser.parse_args()
I have tried to make it works with:
parser.add_argument('-data_path', required=True, default="C:\\Users\\Firdaus\\Desktop\\data")
or from this answer:
args = parser.parse_args(data_path="C:\\Users\\Firdaus\\Desktop\\data")
and it still didn't work.
When I run the script via command line, python train_rnn_wdcnn_loads.py -data_path C:\\Users\\Firdaus\\Desktop\\data
it works but still facing error in another python script.
Using TensorFlow backend.
1614364082.0161884
loading data ...
Traceback (most recent call last):
File "train_rnn_wdcnn_loads.py", line 107, in <module>
source_data = CWRUBearingData(data_path, experiment, source,
File "C:\Users\Firdaus\AppData\Local\Programs\Python\Python38\lib\site-packages\utils\cwru_data_loader.py", line 114, in __init__
for l in self.loads:
TypeError: 'NoneType' object is not iterable
How to run the script without error?