On Tue, Jan 29, 2013 at 1:55 AM, Ronny Pfannschmidt
<ronny.pfannschm...@gmx.de> wrote:
> Hi Kirk,
>
> you need to check for
> __name__ == '__main__' before the last line
>
> rpython does load code by importing
> and the last line will always run the program,
> guard it with a condition, and it will work fine
>
> best, Ronny
>
>
>
> On 01/29/2013 12:50 AM, Kirk Liberty wrote:
>>
>> ronny,
>>
>> Well the fan control command turned out not to be in rpython, so it
>> failed to translate, but it still stopped the fan first. Here's an
>> example of a program that would not translate because it just enters
>> an infinite loop.
>>
>> from time import sleep
>> def main(argv):
>>    while True:
>>      print "looping"
>>      sleep(1)
>>    return 0
>> def target(driver,args):
>>    return main,None
>> main(1)
>>
>> command to translate>  python ~/pypy/translator/goal/translate.py
>> --batch --output loop loop.py
>>
>> Regards,
>> Kirk
>>
>> On Mon, Jan 28, 2013 at 6:35 PM, Ronny Pfannschmidt
>> <ronny.pfannschm...@gmx.de>  wrote:
>>>
>>> Hi Kirk,
>>>
>>> could you please provide more context?
>>>
>>> the translator does not execute the actual rpython program as code, just
>>> the
>>> surrounding imports (using python to metaprogramm the rpython)
>>>
>>> so its likely that the cpu fan off thing is a missunderstanding
>>>
>>> best, Ronny
>>>
>>>
>>> On 01/28/2013 11:37 PM, Kirk Liberty wrote:
>>>>
>>>>
>>>> Hello all,
>>>>
>>>> Is it possible to use PyPy's translation tool without having it
>>>> execute the program? I think this would be important for programs with
>>>> infinite loops, or ones which could do potentially dangerous things
>>>> ie. when trying to translate a program to control a GPU fan, the fan
>>>> was commanded off during a high work load.
>>>>
>>>> Thank you,
>>>> Kirk
>>>> _______________________________________________
>>>> pypy-dev mailing list
>>>> pypy-dev@python.org
>>>> http://mail.python.org/mailman/listinfo/pypy-dev
>>>
>>>
>>>
>
> _______________________________________________
> pypy-dev mailing list
> pypy-dev@python.org
> http://mail.python.org/mailman/listinfo/pypy-dev

Hi Kirk.

Python is a meta-programming language for RPython, so no absolutely impossible.

That said, why would you want to translate such programs?
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to