Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Exception : System.Exception: PyRevitCPythonNotSupported #2508

Closed
4 of 5 tasks
jpenvose1 opened this issue Jan 10, 2025 · 2 comments
Closed
4 of 5 tasks

[Bug]: Exception : System.Exception: PyRevitCPythonNotSupported #2508

jpenvose1 opened this issue Jan 10, 2025 · 2 comments
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] IronPython3 issues regarding the IronPython 3(.4) engine Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}]

Comments

@jpenvose1
Copy link

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

from pyrevit.forms import SelectFromList

PyRevitCPythonNotSupported

⌨ Error/Debug Message

IronPython 3.4.1 (3.4.1.1000)
[.NETFramework,Version=v4.6.2 on .NET Framework 4.8.9282.0 (64-bit)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Exception : System.Exception: PyRevitCPythonNotSupported
   at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.HandleException(InterpretedFrame frame, Exception exception)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Runtime.Method.MethodBinding.SelfTarget(CallSite site, CodeContext context, Object target)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
   at IronPython.Compiler.Ast.CallExpression.Invoke0Instruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Runtime.Method.MethodBinding`1.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0)
   at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run7[T0,T1,T2,T3,T4,T5,T6,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
   at _check_name_wrapper$143(Closure , PythonFunction , Object , Object , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Runtime.Method.MethodBinding`1.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`6.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.Runtime.PythonContext.Call(CodeContext context, Object func, Object arg0)
   at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter(CodeContext context, Object importer, String fullName, PythonList path, Object& ret)
   at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext context, String fullName, PythonList path, Object& ret)
   at IronPython.Runtime.Importer.ImportNestedModule(CodeContext context, PythonModule module, ArraySegment`1 parts, PythonList path, String scopeModuleName)
   at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext context, Object from, ArraySegment`1 parts, Object root)
   at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)
   at IronPython.Modules.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`7.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run8[T0,T1,T2,T3,T4,T5,T6,T7,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
   at IronPython.Runtime.Importer.ImportLightThrow(CodeContext context, String fullName, PythonTuple from, Int32 level)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`5.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 Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
   at Microsoft.Scripting.Hosting.ScriptSource.ExecuteAndWrap(ScriptScope scope, ObjectHandle& exception)
>>>

♻️ To Reproduce

from pyrevit.forms import SelectFromList

Click "Run" in RevitPythonShell

⏲️ Expected behavior

No Results. Only error message

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

Windows 11

Revit 2023
PyRevit pyRevit_4.8.16.24121_signed

Additional context

No response

@jpenvose1 jpenvose1 added the Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] label Jan 10, 2025
@sanzoghenzo
Copy link
Contributor

sanzoghenzo commented Jan 10, 2025

Hi @jpenvose1,
the problem is that you're using RevitPythonShell, which ships with IronPython 3.4.1, while pyRevit 4.8.16 uses IronPython 3.4.0, and only checks for that specific version to enable the pyrevit.forms modules.

As a temporary workaround, you can change this line on your pyRevit folder

IRONPY340 = sys.version_info[:3] == (3, 4, 0)

to

IRONPY340 = sys.version_info[:2] == (3, 4)

@sanzoghenzo sanzoghenzo added Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}] IronPython3 issues regarding the IronPython 3(.4) engine labels Jan 10, 2025
@sanzoghenzo
Copy link
Contributor

This issue is already been fixed in the upcoming version, but IronPyhon 3.4 doesn't properly work on it (#2440).

For that reason, and because a workaround has been provided, I'm going to close this issue.

@sanzoghenzo sanzoghenzo closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug that stops user from using the tool or a major portion of pyRevit functionality [class] IronPython3 issues regarding the IronPython 3(.4) engine Misc Compatibility Compatibility issue with other third-party addons [class->Updated #{number}: {title}]
Projects
None yet
Development

No branches or pull requests

2 participants