From: Norman B. <nor...@gm...> - 2009-08-19 14:52:17
|
Hello all, I am using swig 1.3.39 with Python 2.6 on windows Vista 32 bit complied with MSVS 2008 Standard Ed. The build is successful and I used the excellent directions provided by http://realmike.org/python/extending_python.htm Mike Fotsch as well as teh SWIG docs. However when I go to import the module, see below, I get the UnboundLocal. I did a search of the archives and some google search and found that this issue was supposed to be fixed in the swig 1.3.39 release ( see http://www.nabble.com/Python---py2exe-problem-td24460220.html ). >>> import pyuv Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pyuv.py", line 25, in <module> _pyuv = swig_import_helper() File "pyuv.py", line 24, in swig_import_helper return _mod UnboundLocalError: local variable '_mod' referenced before assignment >>> Here is the suspect code in my pyuv.py: from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_pyuv', [dirname(__file__)]) except ImportError: import _pyuv return _pyuv if fp is not None: try: _mod = imp.load_module('_pyuv', fp, pathname, description) finally: fp.close() return _mod *** line 24 _pyuv = swig_import_helper() *** line 25 del swig_import_helper else: import _pyuv del version_info try: _swig_property = property Thanks for the advice in advance. Norm |