Re: [Tutor] python 2.7.1

2012-09-06 Thread Alan Gauld
On 20/08/12 05:47, john wrote: print"hello world"#this is just something to say >>> /Users/jonathan/Documents/hello.py You don;t run Python scripts from the python prompt. You only type Python co0mmands there. You could import your file which wiull run it but the effect is slightly diff

Re: [Tutor] python 2.7.1

2012-09-06 Thread Peter Otten
john wrote: > print "hello world" #this is just something to say /Users/jonathan/Documents/hello.py > File "", line 1 > /Users/jonathan/Documents/hello.py > ^ > SyntaxError: invalid syntax > > what am i doing wrong? The >>> prompt indicates that you have already started the inter

Re: [Tutor] python 2.7.1

2012-09-06 Thread Dave Angel
On 08/20/2012 12:47 AM, john wrote: > print "hello world" #this is just something to say > > > > > /Users/jonathan/Documents/hello.py > File "", line 1 > /Users/jonathan/Documents/hello.py > ^ > SyntaxError: invalid syntax > > what am i doing wrong? > > > it would help if you showe

Re: [Tutor] Python 2.7.1 interpreter

2010-12-30 Thread Frank Chang
I wanted to thank Steven D'Aprano and Allan Gauld for solving my Python 2.7.1 interpreter question in Tutor Digest Vol. 82 Issue 121. Thank you for yor help. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://

Re: [Tutor] Python 2.7.1 interpreter question

2010-12-29 Thread Steven D'Aprano
Frank Chang wrote: When I use the Python 2.7.1 interpreter I get the following traceback : F:\shedskin\shedskin-0.7>python automata_test2.py Traceback (most recent call last): File "automata_test2.py", line 23, in list(automata.find_all_matches('nice', 1, m)) AttributeError: 'modul

Re: [Tutor] Python 2.7.1 interpreter question

2010-12-29 Thread Alan Gauld
"Frank Chang" wrote automata.py. The pastebin url for automata.py is: http://pastebin.com/embed_iframe.php?i=J9MRPibX"; style="border:none;width:100%"> list(automata.find_all_matches('nice', 1, m)) AttributeError: 'module' object has no attribute 'find_all_matches' find_all_matches() i

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-29 Thread Steven D'Aprano
Alan Gauld wrote: "Frank Chang" wrote I apologize for the cut and paste mangling. Is there a better method than copy-pasting for including 20 or more lines of python source code in the tutor posts? Thank you. Long listings are usually better in pastebin - where the indentation is clear

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-29 Thread Alan Gauld
"Frank Chang" wrote I apologize for the cut and paste mangling. Is there a better method than copy-pasting for including 20 or more lines of python source code in the tutor posts? Thank you. Long listings are usually better in pastebin - where the indentation is clear and we get synta

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-29 Thread Frank Chang
I asked the Shedskin developers about this issue and they are currently adding support for __call__ . They recommend renaming the class Matcher __call__ method ,for example as next, and then explicitly call it on line 148 as lookup_func.next(match). I followed their suggestion and the Sh

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-28 Thread Stefan Behnel
Frank Chang, 28.12.2010 22:35: Good afternoon. I want to thank everyone who helped me fix the global name 'levinshtein_automata' is not defined error. When I run the Shedskin 0.7 Python to C+++ compiler on the same python program, I receive the error message * Error * automata_test.py

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-28 Thread bob gailer
On 12/28/2010 4:35 PM, Frank Chang wrote: Good afternoon. I want to thank everyone who helped me fix the global name 'levinshtein_automata' is not defined error. When I run the Shedskin 0.7 Python to C+++ compiler on the same python program, I receive the error message * Error * autom

Re: [Tutor] Python 2.7.1 interpreter passing function pointer as function argument and Shedskin 0.7

2010-12-28 Thread Alan Gauld
"Frank Chang" wrote When I run the Shedskin 0.7 Python to C+++ compiler on the same python program, I receive the error message * Error * automata_test.py:148 : unbound identifier 'lookup_func'. lookup_func is a python function pointer passed as an argument to a python function. I

Re: [Tutor] Python 2.7.1 interpreter complains about NameError: global name 'levenshtein_automata' is not defined

2010-12-27 Thread Alan Gauld
"Frank Chang" wrote Good morning, I am using Python 2.7.1 on Windows XP Service Pack 3. Here is the program where the Python interpreter complains about NameError: global name 'levenshtein_automata' is not defined. The others have answered the specific question, however I think you have a

Re: [Tutor] Python 2.7.1 interpreter complains about NameError: global name 'levenshtein_automata' is not defined

2010-12-27 Thread bob gailer
See my comment following line 145: On 12/27/2010 8:25 PM, Frank Chang wrote: Good morning, I am using Python 2.7.1 on Windows XP Service Pack 3. Here is the program where the Python interpreter complains about NameError: global name 'levenshtein_automata' is not defined. The python 2,7.

Re: [Tutor] Python 2.7.1 interpreter complains about NameError: global name 'levenshtein_automata' is not defined

2010-12-27 Thread Serdar Tumgoren
It appears that you've defined "levenshtein_automata" as a method on your DFA class, but you did not reference the class instance in your call by prefixing "self". Instead, you're trying to call a globally defined function named "levenshtein_automata" -- which because it is not defined, is throwing