[BangPypers] Weird Try..Except Error
Nikunj.Badjatya at emc.com
Nikunj.Badjatya at emc.com
Fri Nov 25 13:14:07 CET 2011
Hi All,
Thanks for the info.
I had Python27 and Python32 both installed togethar.
In Windows the PATH env variable, I had set Python27 exe and lib path.
But When I do
C:\> Python [PressEnter]
I get 2.7
But when I run
C:\> script.py [PressEnter]
The script is running with Python3.2 , thts weird because I have set my Path variable with Pytho27 exe and lib.
Which is causing the problem.
Thanks
Nikunj
From: Hussain Bohra [mailto:hussainbohra_30 at yahoo.com]
Sent: Friday, November 25, 2011 5:34 PM
To: Badjatya, Nikunj
Subject: Re: [BangPypers] Weird Try..Except Error
Hi Nikunj,
> print("ERROR {0}".format(err_msg))
> print("INFO Please verify the presence of above module, and restart the installation")
When I see your print statements, it seems you are using python 3 instead of python 2.x
> except ImportError, err_msg:
This statement will throw compile time error in python 3, should be written as except ImportError as err_msg:
Can you re-check your python version ?
Thanks and Regards,
Hussain Bohra
________________________________
From: "Nikunj.Badjatya at emc.com" <Nikunj.Badjatya at emc.com>
To: bangpypers at python.org
Sent: Friday, 25 November 2011 5:12 PM
Subject: [BangPypers] Weird Try..Except Error
Hi All,
Please look at the snippet below.
When I am running my module its giving me following error.
Using : Python 2.7, windows Env.
{{{
# User defined modules
try:
from scripts import precheck
from scripts import input
from scripts import validate
from scripts import logsetup
from scripts.constants import *
except ImportError, err_msg: ==> line 38
print("ERROR {0}".format(err_msg))
print("INFO Please verify the presence of above module, and restart the installation")
sys.exit(1)
}}}
{{{
Output:
C:\> install.py -f input.xml
File " C:\>install.py", line 38
except ImportError, err_msg:
^
SyntaxError: invalid syntax
}}}
I checked the comma and spacing and didn't find any problem.
Any idea.?
Thanks
Nikunj
_______________________________________________
BangPypers mailing list
BangPypers at python.org<mailto:BangPypers at python.org>
http://mail.python.org/mailman/listinfo/bangpypers
More information about the BangPypers
mailing list