Python xlrd/xlwt/xlutils not working despite installation

Dear all,

I am writing a simple python node to export some data to excel. I have seen it is possible to use COM, but python experts would not recommend it in professional python forums out there. I have previously used the xlrd, xlwt and xlutils packages for python, but i cannot make them work in dynamo.

I have tried to add them to the PYTHONPATH environment variable, but I think I am doing something wrong, as I keep getting the same error:

“Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 33, in
ImportError: No module named xlwt”

Can anyone help, please?

Thanks in advance!
Adolfo

Hi @adolfo.nadal
I don’t usually mess with the PYTHONPATH, instead I just add the package location to the sys,path.
Did you pip install it?
Usually something like this would work:

import sys

your_pkg_dir = r"C:\Program Files (x86)\YourPythonFolder\Lib\site-packages\your_package\"
sys.path.append(your_pkg_dir)

import your_package

Are you sure that any of the listed modules work with ironPython? That’s what Dynamo is using. It looks like they are based purely on native C-python and will most likely not work with Dynamo…

1 Like

Dimitar,

Thanks for your reply and sorry I did not come to you as soon as I expected. I was really sick.

Coming back to the topic, that was my suspicion as well… that the modules would not work in the IronPython version of Dynamo (whether it differs from the actual “standard” ironPython version is out of my knowledge). I could not make it work, so I had to find a workaround through the IronPython console in Revit 2015.

So you think this is the problem, too?

All the best,
Adolfo

Dear Gui,

Thanks for your reply. I apologize that I could not reply earlier due to some serious health problems.

I did pip install the package, but the problem persisted. I did not try your solution, I will try it asap. Nevertheless, I have to point out that I recoded the whole script in for the IronPython console, finding similar problems.

I had to make it work with xlwriter in the end, which is not the preferred solution, but worked.

Thanks again, I will see whether I can make it work adding the package location to the sys.path as you suggest. I am also upgrading from Revit 2015 to Revit 2017, so it will take some time, I guess.

Best, and thanks again!
Adolfo