1

Here's the full issue syntax:

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

I saw some common solutions but they don't seem to work...I slightly changed the actual pathname for security purposes but here's the code:

import pandas

data = pandas.read_excel("C:\Users\something\PycharmProjects\pythonproject\Test.xlsx")

Here are other versions that failed to work:

  1. data = pandas.read_excel(r"C:\Users\something\PycharmProjects\pythonproject\Test.xlsx")

  2. data = pandas.read_excel(r'C:\Users\something\PycharmProjects\pythonproject\Test.xlsx')

  3. data = pandas.read_excel(r'C:/Users/something/PycharmProjects/pythonproject/Test.xlsx')

  4. data = pandas.read_excel("C:\\Users\\something\\PycharmProjects\\pythonproject\\Test.xlsx")

  5. Rename the "Users" folder; I don't even see the option to rename the folder to avoid the \U issue.

  6. Moved all relevant files to a non-"Users" folder to avoid the \U problem but that didn't work either. I started getting a "_ main _" module not found error.

Any help is greatly appreciated!!

Pulsar3000
  • 11
  • 1
  • Are you sure the problem is in the filename and not the content of the file? Showing the entire error trace would help. – Mark Ransom Jul 07 '21 at 00:44

0 Answers0