![]() |
Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" (/thread-13977.html) |
Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" - mattroi261192 - Nov-09-2018 Hi everyone, I have trouble when I code python as below. I have a simple code: import xlrd file_location = "D:\Training\Python\Email\aa.xlsx" workbook = xlrd.open_workbook(file_location) sheet = workbook.sheet_by_index(0) print sheetAfter I run the program, it shows error: I tried installing xlrd 1.10 (latest version)and xlrd 1.0.0 version. Please help me to fix this problem. Thank all.
RE: Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" - ichabod801 - Nov-09-2018 Your file location string looks like it might be a problem. The backslashes will generally try to make the next character into a special character. Try one of the following: double all the backslashes (\\), switch to forward slashes (/), or make it a raw string by putting an r before it (r"D:\Training\..."). Otherwise that code is working for me in 2.7. RE: Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" - mattroi261192 - Nov-11-2018 (Nov-09-2018, 02:42 PM)ichabod801 Wrote: Your file location string looks like it might be a problem. The backslashes will generally try to make the next character into a special character. Try one of the following: double all the backslashes (\\), switch to forward slashes (/), or make it a raw string by putting an r before it (r"D:\Training\..."). Hi, I tried but it shows error as This class is C:\Program Files (x86)\Python\2_7_11\Lib\xml\etree\cElementTree.pyThanks RE: Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" - ichabod801 - Nov-11-2018 Please post the full error text when posting tracebacks. RE: Please help me error "AttributeError: 'module' object has no attribute 'ElementTree'" - mattroi261192 - Nov-11-2018 (Nov-11-2018, 03:30 AM)ichabod801 Wrote: Please post the full error text when posting tracebacks. Thanks for your support. I unchecked break exception. :( and my program is still running normally. I can't understand but I accepted :( |