1
Vote

Weird error message

description

When I run an IronPyton script I get the following error message:

File "<string>", line 5, in <module>
TypeError: 'NoneType' object is not iterable

I could understand the error message, but instead of <string> should be a file name, isn´t it? The same for <module>, they looks like a tag that should be replaced by the module name.

It´s possible to fix it?

Tks in advance,

Mauro Assis

comments

Zooba wrote Jul 29 at 2:43 AM

That name is derived from how the code is started. If it's coming from exec then that's expected, but if compile is being used then there's a parameter for the file name.

How is your code being run? Is it in a .py file?

MauroAssis wrote Jul 29 at 10:51 AM

Tks for your fast answer.
In fact, I´m running using the WPF IronPythonConsoleControl, this way:
            pythonConsole.Pad.Console.RunStatements(code);
Where 'code' is a string variable.

However, the code references libaries that are .py files, and I get the same type of error messsage. I´d like to know where is the problem.

Mauro

Zooba wrote Jul 31 at 4:02 PM

If you're referencing libraries using "import" then you should see the filename (if those files are the ones causing the exceptions). If not, you're probably seeing a bug in IronPython and you should report it on their mailing list (see http://ironpython.net/support/).

Otherwise, if the code being passed in the code variable is throwing the exceptions, then "<string>" is exactly what you should expect to see here. I don't know how to use that control, but you will want to somehow precompile your code before running it - generally in Python the compile() function lets you associate a filename, while exec does not.