Archive

I Get Error When I Run Python setup.py install

When I install using command python c:\temp\ZSI-2.0\setup.py -q install I get this error:

 

Traceback (most recent call last):

  File "c:\temp\ZSI-2.0\setup.py", line 16, in ?

    major = cf.getint('version', 'major')

  File "E:\Python24\lib\ConfigParser.py", line 321, in getint

    return self._get(section, int, option)

  File "E:\Python24\lib\ConfigParser.py", line 318, in _get

    return conv(self.get(section, option))

  File "E:\Python24\lib\ConfigParser.py", line 511, in get

    raise NoSectionError(section)

ConfigParser.NoSectionError: No section: 'version'


So here is the solution:

You will get this error when you run the setup.py using a fully qualified directory path and python is executed in a directory other than the location of setup.py. 

 

I added the following lines to the beginning of the setup.py script:

 

#scriptPath added in order to run installer independent of the cwd

#========================================

import os

scriptPath = os.path.dirname(sys.argv[0])

os.chdir(scriptPath)

#========================================