New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
itools ImportError: cannot import name XMLError #242
Comments
Original comment by cjpm (Bitbucket: cjpm, GitHub: Unknown): For more details, please, let me know. --CJPM |
Original comment by jdavidibp (Bitbucket: jdavidibp, GitHub: Unknown): To reproduce the problem just type "pip install itools". itools has a package named itools.xml, setuptols loads the module svn_utils.py which makes an "import xml" from the context of itools, which then imports itools.xml instead of the xml package from the standard library The fix would be to use absolute imports in svn_utils.py The fix in itools would be to rename itools.xml to something else, but that would break code using it. And anyway this is not really broken, as the absolute import itools.xml does not conflict with xml Thanks! |
Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco): I don't believe this issue is strictly an issue with setuptools. I suspect there's an issue with itools where 'xml' is being put on the path. No package should be putting modules on the path that conflict with stdlib modules. Nevertheless, the suggested fix is suitable as setuptools only supports Python 2.6 and later, so that will go out as 5.6. |
Original comment by jdavidibp (Bitbucket: jdavidibp, GitHub: Unknown): Actually itools does not put "xml" in the import path. It is just that "import xml" is called from inside the itools directory, at least when installing with pip. Like if you did "cd itools" and then "import xml" Anyway, thank you for fixing this so fast. |
Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco): Glad to help. I took a quick look at the project sdist (as downloaded from PyPI or the web site). It does indeed put all of its subpackages in the root, alongside setup.py. There is no itools directory in the sdist, so xml (and all other modules) are present in '.' when setup.py is invoked. As a result, sys.path[0] will contain the xml module at the top level and not in 'itools' at the time setup.py is invoked. If you want to work around this issue for other versions of setuptools, you'll want to |
Original comment by jdavidibp (Bitbucket: jdavidibp, GitHub: Unknown): Finally I remade the packaging of itools and now it works with "older" versions of setuptools too. Thanks! |
Originally reported by: Anonymous
Hi people,
Trying to install itools-0.75.1 spits out the following error
The problem is that when installing itools with setuptools. It seems that setuptools does an "import xml" from itools directory and wrongly gets the xml itools.
According of the itools maintainer, the ideal fix would be that the module "svn_utils.py" from setuptools had an "import from future absolute_import".
Someone could take a look into this?
Regards,
--CJPM
The text was updated successfully, but these errors were encountered: