I just wrote the following Python
file, which is called mypython.py
. The relevant code:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Parameter Processing')
parser.add_argument('--dataset', type=str, default='CIFAR10', help='dataset')
args = parser.parse_args()
main(args)
And I have a file whose name is "run.sh", which contains:
python mypython.py \
--dataset=CIFAR100
When I run the command bash run.sh
I get the next error:
usage: mypython.py [-h] [--dataset DATASET]
mypython.py: error: unrecognized arguments:
run.sh: line 2: --dataset=CIFAR100: command not found
So what's the problem? How can I solve it?
--dataset CIFAR100
doesn't work too.....
You have an invisible NBSP (non-breaking space) right after the backslash in your run.sh
. Delete this invalid character, or just recreate the file and it should run fine.
It is usually inserted when you type AltGr+\
, which happens very often around backslashes.
I reproduced your exact problem in my own editor, but it displayed the character to me (PyCharm).