pyRevit icon indicating copy to clipboard operation
pyRevit copied to clipboard

Error: IronPython Traceback

Open iamian33 opened this issue 2 years ago • 10 comments

🙏 Please use the search in the issue section before filing a new issue


🐞 Describe the bug

our company has a new IT with their new protocols. Now I cannot run PyRevit with R2024, 22 and 23 are fine. I get this error ... image IronPython Traceback

Tried installing the latest pyRevit version and pyRevit_4.8.12.22247_signed

This outside IT cannot understand how to fix things and their understanding of basic Autodesk products is limited.
They tried 👉 pyrevit attach master 2711 --installed with no success.

If someone can provide direction that I can pass on to our IT, I would be most grateful ... missing my _tools

Ian

If you have installed pyRevit, and the installation completed with no errors but pyRevit doesn't load, please run the command below in terminal / command line. This should fix the issue on your machine, however, please continue filing the issue with instructions below.

👉 pyrevit attach master 2711 --installed

If it does not work, try to disable your revit addins, all of them. Then, one at a time, reactivate them and restart Revit to figure out which one is interacting badly with pyRevit and Report.

♻️ To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

⏲️ Expected behavior

A clear and concise description of what you expected to happen.

🖼 Screenshots of the issue

If applicable, add screenshots to help explain your problem.

🖥️ Hardware and Software Setup (please complete the following information):

  • OS: [e.g. iOS]
  • pyRevit Version [e.g. 22]
  • pyRevit Environment: Open a command prompt 🖥 and run the command below. Replace these lines with the results. Take a look at this markdown guide and wrap the command results in ``` when pasting here for correct formatting.

👉 pyrevit env

Additional context

Add any other context about the problem here.

iamian33 avatar Feb 16 '24 21:02 iamian33

Hi, please make sure to install the latest version (4.8.14) and post the error it gives you; it should be different from the one you posted (if any).

Also, please follow and fill the issue template in order to provide us as much info as possible to help you.

sanzoghenzo avatar Feb 16 '24 23:02 sanzoghenzo

Hi and thanks for your response. I have installed 4.8.14.2406: image

Unfortunately CMD is disabled by our IT. This is a new PC running Windows 11.
Please forgive my very limited programming ability but I cannot locate the issue template.
Ian

iamian33 avatar Feb 17 '24 16:02 iamian33

This is a common error, see here for possible resolutions.

sanzoghenzo avatar Feb 17 '24 18:02 sanzoghenzo

Andrea.

We tried your suggestions with no success. Please see the attached email from my IT. It is strange how PyRevit attaches to my R22 an R23 but not R24. Maybe you have other suggestions??

Ian

iamian33 avatar Feb 22 '24 14:02 iamian33

Apologies,

PyRevit does not attach to any of my Revit installs (22, 23 or 24)

I am certain that there’s an IT protocol killing it.

Hope you have more suggested solutions.

Ian

iamian33 avatar Feb 22 '24 15:02 iamian33

HI @iamian33 , when replying by email, please delete the previous messages from the text, so that the GitHub discussion stays clean.

Also, I don't see any attached email, github issues doesn't work like an email. Paste the contents of the message in the discussion.

That being said, does your company use SentinelOne protection by any chance?

sanzoghenzo avatar Feb 22 '24 15:02 sanzoghenzo

Thanks for the guidance. Please see below the information I received from my IT regarding the unsuccessful efforts made to install PyRevit:

I followed the steps and ran the commands, unfortunately it did not work.

and this command

pyrevit attach master 2711 --installed

I also ran these commands: pyrevit attach core 2711 --installed --allusers

pyrevit attach master 2711 --installed --allusers

pyrevit env

Here is a screenshot of the error:

Here are the responses to the questions in the email if issue persists:

OS: Windows 11 Business

pyREVIT Version: 4.8.12.22247

pyRevit Environment:

==> Registered Clones (full git repos)

==> Registered Clones (deployed from archive/image)

master | Deploy: "basepublic" | Branch: "master" | Version: "4.8.12.22247+0031" | Path: "C:\Users\IanShafer\AppData\Roaming\pyRevit-Master"

==> Attachments

master | Product: "Autodesk Revit 2024" | Engine: DEFAULT (2711) | Path: "C:\Users\IanShafer\AppData\Roaming\pyRevit-Master" | AllUsers

master | Product: "Autodesk Revit 2023" | Engine: DEFAULT (2711) | Path: "C:\Users\IanShafer\AppData\Roaming\pyRevit-Master" | AllUsers

master | Product: "Autodesk Revit 2022" | Engine: DEFAULT (2711) | Path: "C:\Users\IanShafer\AppData\Roaming\pyRevit-Master" | AllUsers

==> Installed Extensions

==> Default Extension Search Path

C:\Users\IanShafer\AppData\Roaming\pyRevit\Extensions

==> Extension Search Paths

==> Extension Sources - Default

https://github.com/eirannejad/pyRevit/raw/master/extensions/extensions.json https://url.emailprotection.link/?bMq2pSZpLfHKZSFzJ8VS7wbRJVSBZU8rgV9oJEFJGVP5d2FQO4hkzo9MD8nia5yfwlrnUQYrqKGA20rpvphsQ8sxnpjFBNWTrRmgoguH__RKeJSWMtaXH1iTCulbkZtRC

==> Extension Sources - Additional

==> Installed Revits

Autodesk Revit 2024 | Version: 24.2.0.63 | Build: 20231029_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2024"

Autodesk Revit 2023 | Version: 23.1.30.97 | Build: 20230828_1515(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2023"

Autodesk Revit 2022 | Version: 22.1.50.17 | Build: 20230915_1530(x64) | Language: 1033 | Path: "C:\Program Files\Autodesk\Revit 2022"

==> Running Revit Instances

==> User Environment

Microsoft Windows 10 [Version 10.0.22621]

Executing User: AzureAD\IanShafer

Active User: AzureAD\IanShafer

Admin Access: No

%APPDATA%: "C:\Users\IanShafer\AppData\Roaming"

Latest Installed .Net Framework: 4.8

No .Net Target Packs are installed.

No .Ne-Core Target Packs are installed.

pyRevit CLI v4.8.12.22247+0031

Screenshot:

I also tried solutions from the links below but it did not work:

https://github.com/eirannejad/pyRevit/issues/2055#issuecomment-1900674214 https://url.emailprotection.link/?bzMz3FCBUzbjwxQJzijwLikiYECagw2J0QEydGKZdO-4Ddz3DxxrAQt3VpjFp1KoxGmtChwaphtWpz7ItVwS9OMbsUOgZFOj5uudHjAK0NNDratgRW1EDTLVKAvLtILq-

https://discourse.pyrevitlabs.io/t/error-message-loading-pyrevit-in-2023/948/2 https://url.emailprotection.link/?bM1tPvZPZbm-Nvya5WB6wiN4fayFn_AiFa30OB4u4mGWEmQnSTqCv6jmb3fdLBHHa-WlnxGZj0wfAweysTH4iGK7uaFY4jO2srXx1afAcVEMv6KajlPprT8zZqIJDQRKH

https://discourse.pyrevitlabs.io/t/error-message-loading-pyrevit-in-2023/948/21 https://url.emailprotection.link/?bhw5iBVGbOdlpA0HXeLxbgSReRcWo18672HliyFx4OuVYkL_qzXjqQpkleeO7Go_MrsCaVDi-p9KXMNxCenUjwwbgWK741-A7_AbxDwugaPbOVwX0DceSeWA5DF1tAC4i

Running the command “pyrevit attached” gave the result:

Running the command “pyrevit clones” gave the result:

This might be helpful to the community to help resolve the issue.

Thanks,

Ian

iamian33 avatar Feb 22 '24 19:02 iamian33

please, use the "view on GitHub" link at the bottom of the email message and post your info directly there, we lost all the pictures!

sanzoghenzo avatar Feb 22 '24 20:02 sanzoghenzo

Hello, we have the same exact problem. All machines in our company have the problem with Pyrevit not working for Revit 2024. This is extremely frustrating and our IT department have been working out for months how to fix it without any luck. It makes all of us lose our hair this is so stressful because PyRevit is so convinient to use.

Has a solution been found ?

BIMGSE avatar Jun 10 '24 13:06 BIMGSE

We are having this issue in our company too. A lot of machine shows exactly the same error when lunching the Revit. The issue is caused by an incompatible dependency that was loaded before pyRevit. The idea is to clean out the addins and let pyRevit load first. We find a solution from an older issue which solves the issue. However, it takes a lot of effort to fix all our machines.

Here are the steps we took.

  1. Uninstall all pyRevit versions
  2. Go to C:\Users<your computer user name>\AppData\Roaming and delete all folders related to pyrevit, i.e. pyRevit, pyRevit-Master.
  3. Go to C:\Users<your computer user name>\AppData\Roaming\Autodesk\Revit\Addins<revit version>, move everything in this folder to a temp location.
  4. Go to C:\ProgramData\Autodesk\Revit\Addins<revit version>, move everything in this folder to another temp location.
  5. Reinstall pyRevit
  6. Go to C:\Users<your computer user name>\AppData\Roaming\Autodesk\Revit\Addins<revit version> and rename pyRevit.addin to 0_pyRevit.addin
  7. Run Revit and close.
  8. Reverse step 3 and step 4 to bring all .addin to the original location.

czwangxtt avatar Jun 27 '24 16:06 czwangxtt

I get the following when trying to use find all revisions sheets IronPython Traceback: Traceback (most recent call last): File "C:\Users\Ricardo\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\Revision.pulldown\Find All Revised Sheets.pushbutton\script.py", line 16, in File "C:\Users\Ricardo\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\revit\report.py", line 16, in print_revision AttributeError: 'Revision' object has no attribute 'NumberType'

Script Executor Traceback: System.MissingMemberException: 'Revision' object has no attribute 'NumberType' at IronPython.Runtime.Binding.PythonGetMemberBinder.FastErrorGet1.GetError(CallSite site, TSelfType target, CodeContext context) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at IronPython.Compiler.Ast.DynamicGetMemberExpression.GetMemberInstruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at IronPython.Compiler.PythonCallTargets.OriginalCallTarget3(PythonFunction function, Object arg0, Object arg1, Object arg2) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at Microsoft.Scripting.Interpreter.DynamicInstruction4.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime) help needed

richimenvic avatar Jul 11 '24 08:07 richimenvic

I have corrected the scrpit using chatgpt """Lists all sheets revised under any revision."""

from pyrevit import revit, DB from pyrevit import script

output = script.get_output()

def collect_revisions(): """Collect all revisions in the document.""" return DB.FilteredElementCollector(revit.doc)
.OfCategory(DB.BuiltInCategory.OST_Revisions)
.WhereElementIsNotElementType()

def collect_sheets(): """Collect all sheets in the document and sort them by sheet number.""" sheets_unsorted = DB.FilteredElementCollector(revit.doc)
.OfCategory(DB.BuiltInCategory.OST_Sheets)
.WhereElementIsNotElementType()
.ToElements() return sorted(sheets_unsorted, key=lambda x: x.SheetNumber)

def print_revision(rev, prefix='', print_id=True): """Print the details of a revision.""" rev_number_param = rev.LookupParameter('Revision Number') rev_number = rev_number_param.AsString() if rev_number_param else "No Number" rev_description_param = rev.LookupParameter('Description') rev_description = rev_description_param.AsString() if rev_description_param else "No Description" rev_date_param = rev.LookupParameter('Revision Date') rev_date = rev_date_param.AsString() if rev_date_param else "No Date" rev_id = rev.Id if print_id else "" output.print_md("{}- Revision Number: {}, Description: {}, Date: {}, ID: {}".format( prefix, rev_number, rev_description, rev_date, rev_id))

def print_sheet(sheet): """Print the details of a sheet.""" sheet_number = sheet.SheetNumber sheet_name_param = sheet.LookupParameter('Sheet Name') sheet_name = sheet_name_param.AsString() if sheet_name_param else "No Name" sheet_id = sheet.Id.IntegerValue output.print_md("Sheet Number: {}, Name: {}, [ID: {}]".format(sheet_number, sheet_name, sheet_id))

def main(): output.print_md('LIST OF REVISIONS:') revisions = collect_revisions() for rev in revisions: print_revision(rev)

output.print_md('*****\n\n\n###REVISED SHEETS:\n')
sheets = collect_sheets()
for sht in sheets:
    sheet_revs = set(sht.GetAllRevisionIds()).union(set(sht.GetAdditionalRevisionIds()))
    if sheet_revs:
        print_sheet(sht)
        for rev_id in sheet_revs:
            rev = revit.doc.GetElement(rev_id)
            print_revision(rev, prefix='\t\t', print_id=False)

main()

richimenvic avatar Jul 11 '24 08:07 richimenvic

don't know anything on programming but it worked

richimenvic avatar Jul 11 '24 08:07 richimenvic

I get the following when trying to use find all revisions sheets IronPython Traceback: Traceback (most recent call last): File "C:\Users\Ricardo\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\Revision.pulldown\Find All Revised Sheets.pushbutton\script.py", line 16, in File "C:\Users\Ricardo\AppData\Roaming\pyRevit-Master\pyrevitlib\pyrevit\revit\report.py", line 16, in print_revision AttributeError: 'Revision' object has no attribute 'NumberType'

Please create a new issue for this, it is a totally unrelated problem!

sanzoghenzo avatar Jul 11 '24 09:07 sanzoghenzo

Im going to close this issue since @iamian33 didn't reply in 5 months, and the solution provided is the one explained in the installation troubleshooting guide

sanzoghenzo avatar Jul 11 '24 10:07 sanzoghenzo