NameError: name 'pyver' is not defined

Ned Deily nad at acm.org
Thu Mar 6 09:26:34 CET 2014


In article <be63ef8b-c37b-4cbb-93ac-edb72f64aa41 at googlegroups.com>,
 ?AIOE??OE?I <shulamitmi3 at gmail.com> wrote:
> We have python 2.6 & 3.2 installed on Sun solaris.
> When running py utility, we get the below error:
> 
> "NameError: global name 'execfile' is not defined"
> 
> 
> > p4convert-cvs.py
> EXCEPTION: [Errno 17] File exists: './LOGS'
> Traceback (most recent call last):
>   File "p4convert-cvs.py", line 134, in <module>
>     cvstop4lib.readconfig(configfile=args.config)
>   File "/bzqchome/bzq/ccbzq/mb_ccbzq/Perforce/p4convert/cvstop4lib.py", line 
>   61, in readconfig
>     execfile(configfile,globals()) # read in the config file - must be valid 
>     Python, evaluated in the context of this file
> NameError: global name 'execfile' is not defined

execfile() no long exists in Python 3 so chances are you are trying to 
run a Python 3 program with Python 2.  Try running the script explicitly 
under Python 2:

  python2.6 p4convert-cvs.py

You may have inadvertently done a "make install" with Python 3.2 that 
has created a link from "python" to "python3.2".  Later versions of 
Python 3 are a little more careful about reserving "python" for Python 2 
and "python3" for Python 3, although some distributions (notably Arch 
Linux) do it differently.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list