Hi
I’m trying to create a script where I should be able to link an external pdf file to a revit object witha a specific Name, parameter value that I can find into PDF pages; for example, a Light Fixtures with Product Number: 0000012 has a data spec saved in a folder (or website). Using PyPDF2 I’m able to find 0000012 and associate that document to a specific Light.
But the error is always the same: no module named PyPDF2 (because this library is already installed in Python but not callable from PyRevit).
Is there a way to use external library with PyRevit?
Without adressing the issue you raised, because I think you need to go with the basics of python and pyRevit before:
your boiler plate is a mess. me being totally honest
you are mixing ways to import stuff in Dynamo and in pyRevit; You need to pick one
if you use import whatever don’t use from whatever import TheStuff
in the first one you already import everything, it is like doing from whatever import * which is bad practice
Organize your imports from general to particular
declare your variable like doc and uidoc after imports
and to address your issue, I would start by asking myself why I need pyPDF2 and if it is IronPython friendly.
You’re right for all
it is a basic script as template from I move, change, delete parts in order to clean it and obtain the wished result. However, the rest of the script is not available because is WIp and it isn’t the point of discussion. My question it is only " is there a way to install library already existing like PyPDF2 into PyRevit folders and call it as the other ones?"
if it is ironpython friendly, yes.
either using the lib folder and having the module installed in there
or point to the library by adding the path to the module from your script