I think you have an old version. I have

import os, optparse, sys
import m5
from m5.objects import *
from m5.util import *
addToPath('./configs')
addToPath('../common')

and it works

On 4/12/12, Nilay Vaish <[email protected]> wrote:
> Amber, these are python errors. I think you would be better off by trying
> to figure out yourself what python is trying to do. You would atleast
> learn some python in the process. If you don't want to do that, there are
> example scripts provided in configs/examples/ directory. You can look at
> those and do some pattern matching to figure what is going on wrong in
> your script.
>
> --
> Nilay
>
> On Thu, 12 Apr 2012, Amber Sami Kubesch wrote:
>
>> I had actually tried that too but didn't put in my email because I thought
>> it might have been dumb to try.
>>
>> When I have this at the beginning of cmp.py:
>>
>> #cmp.py
>>
>> # Simple configuration script
>>
>> import m5
>>
>> from m5.objects import *
>>
>> import os, optparse, sys
>>
>> from m5.util import *
>>
>> m5.addToPath('./configs')
>>
>> m5.addToPath('../common')
>>
>> import Simulation
>>
>> from Caches import *
>>
>> import Mybench
>>
>>
>>
>> I get this error:
>>
>> gem5 compiled Apr 10 2012 12:46:06
>> gem5 started Apr 12 2012 08:40:22
>> gem5 executing on cluster.csl.cornell.edu
>> command line: build/ARM_SE/gem5.opt configs/example/cmp.py
>> Traceback (most recent call last):
>>  File "<string>", line 1, in <module>
>>  File
>> "/ufs/cluster/amber/Gem5_Stuff/gem5-stable-b9ba22cb23f2/src/python/m5/main.py",
>> line 356, in main
>>    exec filecode in scope
>>  File "configs/example/cmp.py", line 8, in <module>
>>    m5.addToPath('./configs')
>> AttributeError: 'module' object has no attribute 'addToPath'
>>
>> If I switch the order of the two addToPath lines, it just complains about
>> the whichever came first.  So, when I have:
>>
>> m5.addToPath('../common')
>>
>> m5.addToPath('./configs')
>>
>>
>> I get this output:
>>
>> gem5 compiled Apr 10 2012 12:46:06
>> gem5 started Apr 12 2012 08:38:22
>> gem5 executing on cluster.csl.cornell.edu
>> command line: build/ARM_SE/gem5.opt configs/example/cmp.py
>> Traceback (most recent call last):
>>  File "<string>", line 1, in <module>
>>  File
>> "/ufs/cluster/amber/Gem5_Stuff/gem5-stable-b9ba22cb23f2/src/python/m5/main.py",
>> line 356, in main
>>    exec filecode in scope
>>  File "configs/example/cmp.py", line 8, in <module>
>>    m5.addToPath('../common')
>> AttributeError: 'module' object has no attribute 'addToPath'
>>
>>
>> Thanks for all the responses to this question.
>>
>> -Amber
>>
>>
>> On Thu, Apr 12, 2012 at 1:10 AM, Mahmood Naderan
>> <[email protected]>wrote:
>>
>>> You have in include two directories and not one
>>>
>>> from m5.util import *
>>> addToPath('./configs')
>>> addToPath('../common')
>>>
>>>
>>>
>>> On 4/12/12, Amber Sami Kubesch <[email protected]> wrote:
>>>> I've added these lines to the beginning of Mybench.py:
>>>>
>>>>
>>>> #Mybench.py
>>>>
>>>> import m5
>>>>
>>>> from m5.objects import LiveProcess
>>>>
>>>>
>>>> and now I've tried a few different things with cmp.py but I'm still
>>> running
>>>> into problems.
>>>>
>>>>
>>>> When I had this at the beginning of cmp.py:
>>>>
>>>>
>>>> #cmp.py
>>>>
>>>> mport m5
>>>>
>>>> from m5.objects import *
>>>>
>>>> import os, optparse, sys
>>>>
>>>> from m5.util import addToPath
>>>>
>>>> addToPath('../common')
>>>>
>>>> import Simulation
>>>>
>>>> from Caches import *
>>>>
>>>> import Mybench
>>>>
>>>>
>>>> I got the error:
>>>>
>>>>
>>>> command line: build/ARM_SE/gem5.opt configs/example/cmp.py
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>   File "<string>", line 1, in <module>
>>>>
>>>>   File
>>>>
>>> "/ufs/cluster/amber/Gem5_Stuff/gem5-stable-b9ba22cb23f2/src/python/m5/main.py",
>>>> line 356, in main
>>>>
>>>>     exec filecode in scope
>>>>
>>>>   File "configs/example/cmp.py", line 11, in <module>
>>>>
>>>>     import Mybench
>>>>
>>>>   File "configs/example/Mybench.py", line 6, in <module>
>>>>
>>>>     perlbench.executable =  binary_dir+'400.perlbench_base.alpha-gcc'
>>>>
>>>> NameError: name 'binary_dir' is not defined
>>>>
>>>>
>>>> I realized that the line was originally m5.addToPath('./configs'), so
>>>> changing addToPath('../common') to m5.addToPath('../common'), I get this
>>>> error:
>>>>
>>>>
>>>> gem5 compiled Apr 10 2012 12:46:06
>>>>
>>>> gem5 started Apr 11 2012 17:53:47
>>>>
>>>> gem5 executing on cluster.csl.cornell.edu
>>>>
>>>> command line: build/ARM_SE/gem5.opt configs/example/cmp.py
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>   File "<string>", line 1, in <module>
>>>>
>>>>   File
>>>>
>>> "/ufs/cluster/amber/Gem5_Stuff/gem5-stable-b9ba22cb23f2/src/python/m5/main.py",
>>>> line 356, in main
>>>>
>>>>     exec filecode in scope
>>>>
>>>>   File "configs/example/cmp.py", line 8, in <module>
>>>>
>>>>     m5.addToPath('../common')
>>>>
>>>> AttributeError: 'module' object has no attribute 'addToPath'
>>>>
>>>>
>>>> Which seems similar to the original error.
>>>>
>>>>
>>>> Any other things I could try?
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Amber
>>>>
>>>>
>>>> On Wed, Apr 11, 2012 at 11:02 AM, Ali Saidi <[email protected]> wrote:
>>>>
>>>>> **
>>>>>
>>>>> You probably also need an import m5 line at the top as well.
>>>>>
>>>>> Ali
>>>>>
>>>>>
>>>>>
>>>>> On 11.04.2012 07:45, Mahmood Naderan wrote:
>>>>>
>>>>> the script in the website is old. You have to do
>>>>> addToPath('../common')
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> gem5-users mailing list
>>>>> [email protected]
>>>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>>>>
>>>>
>>>
>>>
>>> --
>>> --
>>> // Naderan *Mahmood;
>>> _______________________________________________
>>> gem5-users mailing list
>>> [email protected]
>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>>
>>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>


-- 
--
// Naderan *Mahmood;
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to