Lib folders clash with pyrevit

After creating lib files I get the different errors:

Traceback (most recent call last):
 File "L:\0_8_REVIT\09_S3A_Tools\S3A_Tools.extension\\07_Andere Tools.Panel\Verwijder Rooms.pushbutton\verwijder", line 5, in <module>
 File "C:\Users\PieterL\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\", line 35, in <module>
 File "C:\Users\PieterL\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\", line 25, in <module>
 File "C:\Users\PieterL\AppData\Roaming\pyRevit-Master\pyrevitlib\rpw\utils\", line 32, in <module>
ImportError: cannot import Enum from System
IronPython Traceback:
Traceback (most recent call last):
 File "L:\0_8_REVIT\09_S3A_Tools\S3A_Tools.extension\\04_Views en Sheets.Panel\Views en Sheets 1.stack\Kopieer Views.pushbutton\Kopieer", line 6, in <module>
 File "C:\Users\PieterL\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\", line 94, in <module>
 File "C:\Users\PieterL\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\", line 26, in <module>
AttributeError: 'module' object has no attribute 'Linq'

Different tools give different errors

My lib consists of subfolders. In those folders I have an init-file and some python files with definitions. In scripts where I don’t use pyrevit libraries there are no issues.

What could be the problem?

Hi @PieterL_TM,
Could it be that your folders or modules (in the lib folder) are called the same as the modules inside pyrevitlib, or any other library loaded by pyrevit?

I usually get these strange import errors when I accidentally call my python modules (even outside pyrevit) like the built in ones like logging (and it always takes me hours to debug and fix :rofl: )

try these imports instead of whatever it is you have… Would help to see your imports for the relevant script

import clr
from System.Collections.Generic import List
from System.Linq import Enumerable

So here’s the status right now:
I deleted my lib and went through the process of creating lib folders again, I think I did it the exact same way as I did before, however now it seems to work fine and I get no errors.

I don’t know what the issue was, because I don’t know what I did differently the second time. :sweat_smile:

Thanks for the suggestions! If anyone knows what I could have done wrong, feel free to let me know.

No one can help you find what you’ve done wrong since you didn’t post a single line of code, or even a picture with the folders and modules structure.

We don’t have any crystall ball (yet :wink: ), so it’s impossible to help without more context from your part.

Anyway, I’m glad you sorted it out!