(May-03-2021, 07:51 PM)herwin Wrote: gives the above-mentioned error code (if the file path has a black space it).Do
In the new code
print(prg)
print(repr(prg))
then you see if there is a space.It's normal when read from file eg csv to use
strip()
so there no space at beginning or end.>>> path = r'C:\code\file.csv ' # Looks ok,but are not >>> print(path) C:\code\file.csv >>> >>> # To see all >>> print(repr(path)) 'C:\\code\\file.csv ' >>> >>> # Fix >>> path.strip() 'C:\\code\\file.csv'