Anthony, thank you.
On Sunday, April 6, 2014 8:26:33 PM UTC-4, Anthony wrote:
>
> # Here is the change
>> if found_it:
>> print 'Now I\'m going to change it to "pwned."'
>> i_am_global = new_val
>>
>
> Above you assign a value to i_am_global. Because you have not explicitly
>
> # Here is the change
> if found_it:
> print 'Now I\'m going to change it to "pwned."'
> i_am_global = new_val
>
Above you assign a value to i_am_global. Because you have not explicitly
declared i_am_global as a global variable, it is automatically defined as
being lo
Ach! My sample was a simplified version of the file that is actually
failing.
Here is the actual code. Explanatory comments on line 3 and line 43
delineated with ## #.
This fails every time on my system, Python 2.7.3 on Debian Wheezy.
I wrote this to demonstrate the exact point made by Anthon
On Friday, April 4, 2014 5:51:11 PM UTC-4, Cliff Kachinske wrote:
>
> If I write a python module like this:
>
> # born_to_fail.py
> foo = 'bar'
> def main():
> print foo
> if __name__=='__main__': main()
>
>
The above shouldn't produce an error, but the following will:
foo = 'bar'
def main():
# born_to_fail.py
foo ='bar'
defmain():
printfoo
if__name__=='__main__':main()
If I run your code using
python born_to_fail.py
I get as output
bar
Best regards,
Stefaan.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source c
5 matches
Mail list logo