Re: Invalid syntax error

2012-03-10 Thread Ian Kelly
On Sat, Mar 10, 2012 at 6:17 AM, Günther Dietrich wrote: > In article > <46758542-1bd6-43fe-8e80-bcf14b7d8...@pi6g2000pbc.googlegroups.com>, >  sl33k wrote: > >>I'm trying project euler problem 3 and I've hit the wall with this >>error. What could be the problem here? >> >> l=[] > num=6008514

Re: Invalid syntax error

2012-03-10 Thread Günther Dietrich
In article <46758542-1bd6-43fe-8e80-bcf14b7d8...@pi6g2000pbc.googlegroups.com>, sl33k wrote: >I'm trying project euler problem 3 and I've hit the wall with this >error. What could be the problem here? > > l=[] num=600851475143 i=1 while i<=num: >... if num%i==0: >...

Re: Invalid syntax error

2012-03-10 Thread liuerfire Wang
在 2012年3月10日星期六UTC+8下午8时34分35秒,sl33k写道: > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > > l=[] > >>> num=600851475143 > >>> i=1 > >>> while i<=num: > ... if num%i==0: > ... l.append(i) > ... i+=1 > ... print max(l) >

Re: Invalid syntax error

2012-03-10 Thread Ahsan
Just checked my version. Its showing 2.6.5. >>> sys.version '2.6.5 (r265:79063, Apr 16 2010, 13:09:56) \n[GCC 4.4.3]' -- http://mail.python.org/mailman/listinfo/python-list

Re: Invalid syntax error

2012-03-10 Thread Vlastimil Brom
2012/3/10 sl33k : > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > >  l=[] num=600851475143 i=1 while i<=num: > ...     if num%i==0: > ...         l.append(i) > ...     i+=1 > ... print max(l) >  File "", line 5 >    prin

Re: Invalid syntax error

2012-03-10 Thread Andrew Berg
On 3/10/2012 6:34 AM, sl33k wrote: > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > > l=[] num=600851475143 i=1 while i<=num: > ... if num%i==0: > ... l.append(i) > ... i+=1 > ... print max(l) > File "

Re: Invalid syntax error

2012-03-10 Thread Amit Sethi
Its an indentation error -- A-M-I-T S|S -- http://mail.python.org/mailman/listinfo/python-list

Invalid syntax error

2012-03-10 Thread sl33k
I'm trying project euler problem 3 and I've hit the wall with this error. What could be the problem here? l=[] >>> num=600851475143 >>> i=1 >>> while i<=num: ... if num%i==0: ... l.append(i) ... i+=1 ... print max(l) File "", line 5 print max(l) ^ SyntaxError: invali

Re: Invalid Syntax Error

2010-01-14 Thread Benjamin Kaplan
How about you just isolate the first few lines On Thu, Jan 14, 2010 at 2:43 PM, Ray Holt wrote: > try: >     #open file stream >     file = open(file_name, "w" > except IOError: >     print "There was an error writing to", file_name >     sys.exit() Notice anything now? Something missing perhaps

Re: Invalid Syntax Error

2010-01-14 Thread MRAB
Ray Holt wrote: Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, "w" [snip] Missing ")". -- http://mail.python.org/mailman/listinfo/py

Invalid Syntax Error

2010-01-14 Thread Ray Holt
Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, "w" except IOError: print "There was an error writing to", file_name sys.exit() pri

Re: Invalid syntax error

2009-12-20 Thread Todd A. Jacobs
On Sun, Dec 20, 2009 at 08:40:05AM -0500, Ray Holt wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c You need to pass either a string literal or a variable. If you're passing a string, like you

Re: Invalid syntax error

2009-12-20 Thread D'Arcy J.M. Cain
On Sun, 20 Dec 2009 08:40:05 -0500 "Ray Holt" wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c is You forgot the quotes around the string. I am not on Windows but I think the followi

Re: Invalid syntax error

2009-12-20 Thread Xavier Ho
Putting quotemarks "" around the path would be a good start, I think. Cheers, Xav On Sun, Dec 20, 2009 at 11:40 PM, Ray Holt wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c is > inv

Invalid syntax error

2009-12-20 Thread Ray Holt
Why am I getting an invalid syntax error on the following: os.chdir(c:\\Python_Modules). The error message says the colon after c is invalid syntax. Why is it saying this when I am trying to change directory to c:\Python_Modules. Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

RE: WMI - invalid syntax error?

2006-01-03 Thread Tim Golden
[py] | I may end up looking into some other way of getting the list of | processesthis is real screwy. Just in case you hadn't found it under your own steam, this link may help: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442477 TJG

Re: WMI - invalid syntax error?

2006-01-03 Thread py
py wrote: > I am going to try typing up that simple function into a new py file and > put it on a diff. PC and try it. I tried my current code on another > computer and had the same issue...but I am wondering if I start anew if > it will help. ok, i am not sure whats going on. I created a simple

Re: WMI - invalid syntax error?

2006-01-03 Thread py
The problem only seems to occur when importing the file and using it that way. It works the first time, but not the second, third, etc. If I run the same commands via the interpreter I have no problem. I may end up looking into some other way of getting the list of processesthis is real scre

RE: WMI - invalid syntax error?

2006-01-03 Thread Tim Golden
[py] | Sent: 30 December 2005 16:15 | To: python-list@python.org | Subject: Re: WMI - invalid syntax error? | | py wrote: | >Something must be happening somewhere causing it | > to get fouled up. I'm gonna try on a different PC. | | I tried on another PC, same problem. | | Al

Re: WMI - invalid syntax error?

2005-12-30 Thread py
py wrote: >Something must be happening somewhere causing it > to get fouled up. I'm gonna try on a different PC. I tried on another PC, same problem. Also, I added "reload(wmi)" before I create an instance of wmi.WMI just to see what happens, so I hve... import wmi def ppn(machine=None): t

Re: WMI - invalid syntax error?

2005-12-30 Thread py
Tim Golden wrote: > > import wmi > wmi._DEBUG = True > > c = wmi.WMI () > # This will print a moniker looking something like this: > # > winmgmts:{impersonationLevel=Impersonate,authenticationLevel=Default}/ro > ot/cimv2 > > > and let me know what comes out. I ran it twice, first it worked, seco

RE: WMI - invalid syntax error?

2005-12-30 Thread Tim Golden
[py] | Tim Golden wrote: | > Could you just post (or send by private email if you prefer) | > the exact script you're running? If you want to send it | > privately, please us mail timgolden.me.uk. | | I am truly unsure what the problem could be, and the fact that the | error says "invalid syntax"

Re: WMI - invalid syntax error?

2005-12-30 Thread py
Tim Golden wrote: > Could you just post (or send by private email if you prefer) > the exact script you're running? If you want to send it > privately, please us mail timgolden.me.uk. I am truly unsure what the problem could be, and the fact that the error says "invalid syntax" ...just doesn't ma

RE: WMI - invalid syntax error?

2005-12-30 Thread Tim Golden
[py] > import wmi > # the ip of my own local desktop > machine = "1.2.3.4" > try: > w = wmi.WMI(machine) # also tried, wmi.WMI(computer=machine) > except Exception, e: > print "ERROR:", e . . > c:>python > >>> from MyScript import * > >>> ERROR: -0x7ffbfe1c - Invalid syntax . . > here's t

Re: WMI - invalid syntax error?

2005-12-30 Thread py
one more note, I am using WMI v0.6 however, I also tried it with the latest version 1.0 rc2. -- http://mail.python.org/mailman/listinfo/python-list

Re: WMI - invalid syntax error?

2005-12-30 Thread py
here's the trace... File "MyScript.py", line 10, wmiObj = wmi.WMI(machine) File "wmi.py", line 519, in __init__ handle_com_error (error_info) File "wmi.py", line 131, in handle_com_error raise x_wmi, "\n".join (exception_string) x_wmi: -0x7ffbfe1c - Invalid syntax -- http://mai

WMI - invalid syntax error?

2005-12-30 Thread py
MI(machine) # also tried, wmi.WMI(computer=machine) except Exception, e: print "ERROR:", e c:>python >> from MyScript import * >>> ERROR: -0x7ffbfe1c - Invalid syntax >> import wmi >> w = wmi.WMI("1.2.3.4") >> So when I import the scr