How to Solve Error 22 (errno 22) : Invalid Arguement
Hello guys,
I am entirely new to programming, but I'm trying to do something with Python programming. I'm trying to run open file command in Sublime Text 3 and I've been having this error. Please see below:
Traceback (most recent call last):
File "C:\Users\Awesome God\Desktop\test.py", line 2, in
Any solution to this, please?
You are trying to open a directory as a file. Remove trailing \ from path to name the File. Also Backslahes needed to be escaped, or the string must be a raw string (e.g. r"here comes a windows path")
You also spelled Argument incorrectly :p
I am also facing a similar type of issue. I have a datetime value as string. i am trying to put that string as the title of a file. but it's showing invalid argument. Can anyone please help me? Thanks in advance !!
string=radar.metadata['start_datetime']
type(string) out: str
print(string) out: 2019-02-07T00:14:24Z
pyart.io.write_grid_mdv ( '{}.mdv' .format(string),grid,mdv_field_names=None, field_write_order=None)
out:
OSError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/pyart/io/mdv_grid.py in write_grid_mdv(filename, grid, mdv_field_names, field_write_order) 220 221 # write the file --> 222 mdv.write(filename) 223 224
~/anaconda3/lib/python3.7/site-packages/pyart/io/mdv_common.py in write(self, filename, debug) 450 self.fileptr = filename 451 else: --> 452 self.fileptr = open(filename, 'wb') 453 file_start = self.fileptr.tell() 454
OSError: [Errno 22] Invalid argument: '2019-02-07T00:14:24Z.mdv
On e.g. Windows : is not a valid char for a filename. Compare with e.g. c:\ where it has a special meaning