1
path = input("Enter the path")
book = xlrd.open_workbook(path)

After giving path and running program, I am getting the following error:

OSError: [Errno 22] Invalid argument: '"D:\\\shreyatest1.xlsx"'

Path is: "D:\\shreyatest1.xlsx"

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Shreya Gaddam
  • 33
  • 1
  • 8

1 Answers1

1

The \\ character is how python represents an escaped \ in a string literal. When inputting a string from the console, there's no need (read: it's wrong) to use this notation. Just input the path as you see it - D:\shreyatest1.xlsx.

Mureinik
  • 297,002
  • 52
  • 306
  • 350