It's come to my attention that gem5 doesn't work with Python 2.7. (Now that I know to look for it, I see that others on the mailing list have discovered this already, but I hadn't noticed before.) The python initialization dies before we even get to the user script:
% build/ALPHA_SE/gem5.debug Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'main' The culprit is where we run "m5.main()" via PyRun_String(): http://repo.gem5.org/gem5/file/690417d95f6d/src/sim/init.cc#l230 If I add this line: diff --git a/src/sim/init.cc b/src/sim/init.cc --- a/src/sim/init.cc +++ b/src/sim/init.cc @@ -227,6 +227,7 @@ */ const char * __attribute__((weak)) m5MainCommands[] = { "import m5", + "print dir(m5)", "m5.main()", 0 // sentinel is required }; then I get: % build/ALPHA_SE/gem5.debug ['__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', 'internal'] Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'module' object has no attribute 'main' So strangely it is importing the module, and the 'internal' submodule is there, but none of the other contents show up. I'm wondering if something got changed with the import logic that makes Nate's internal importer script not work right. I don't see anything significant on the "what's new in 2.7" page though ( http://docs.python.org/dev/whatsnew/2.7.html). They do mention support for a new "importlib" but they don't mention breaking any of the older interfaces. I'm just throwing this out to see if anyone is willing to see if they can get farther, or has any ideas on what might be wrong, or has suggestions on how to debug this further. And of course by "anyone" I mostly mean "Nate" ;-), though it would be great if someone else wanted to learn about python embedding and the module import process. Steve _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
