Closed Ridleh closed 2 months ago
Got a different, hopefully more helpful, error this time
Hmm, so far I have not had any luck in reproducing the issue. The second exception looks like it might be a Python error, something like this would produce the same exception:
class Test:
a, b = 1, 2, 3
Any chance you could try to output the Python traceback? Might point to the issue. For example:
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
var engine = Python.CreateEngine();
try {
engine.Execute("class Test:\n a, b = 1, 2, 3");
}
catch (Exception e) {
Console.WriteLine(engine.GetService<ExceptionOperations>().FormatException(e));
}
Any chance you could try to output the Python traceback? Might point to the issue
Yep, that helped me find the issue. One of the variable names had an apostrophe in it. After removing it I'm not getting either of the above issues anymore. Thanks for the help
Description
I have a python file called CardLookup that contains a class also called CardLookup that looks like this:
The class has over 300 variables in it that look like the above. This file was generated using a separate script.
In another file, I am trying to import this class and use a variable:![image](https://github.com/IronLanguages/ironpython3/assets/42791844/8472e67c-da5b-45a7-bbfd-fcab00239c7a)
However, I get an error whenever IronPython tries to import the class, " Index was outside the bounds of the array":![image](https://github.com/IronLanguages/ironpython3/assets/42791844/a5498f4d-3390-4859-9916-be2a22841b25)
I have similar files like CardLookup, where they only have one class inside that holds constants. Except none of them have over 300 variables. The second most is around 25 I think.
If I split the CardLookup class into smaller classes and import the one I need it works, so my hunch is the issue has something to deal with the number of variables a class has.
Steps to Reproduce
From Class import Class
Expected behavior: The import should succeed
Actual behavior: An exception is thrown
Version Information
I am using IronPython version 3.4.0, on Windows 11. Im running IronPython inside of a Godot game
The output of
sys.version
is: 3.4.0 (3.4.0.1000) [.NETFramework,Version=v4.6.2 on Mono 6.12.0 ((no/5ce143a1) (64-bit)]