New submission from Oscar <oscar.trejo-so...@digital.ai>:

Not sure if this is the right place to post this, but I stumble upon the 
following error.

I have the following directory structure

$ tree /F
Folder PATH listing
Volume serial number is C0000100 B8C8:3DC4
C:.
│   requirements.txt
│   run_repro.bat
│
└───testdriver
    │   jira_utils.py
    │   main.py
    │   __init__.py
    │
    └───xml
            xml_base.py
            __init__.py

and I am getting the following error when I run 

(venv) > C:\depot\bitbucket\python_bug
$ python testdriver\main.py
Traceback (most recent call last):
  File "testdriver\main.py", line 1, in <module>
    from testdriver.jira_utils import JiraUtils
  File "C:\depot\bitbucket\python_bug\testdriver\jira_utils.py", line 1, in 
<module>
    from jira import JIRA, JIRAError
  File "C:\depot\bitbucket\python_bug\venv\lib\site-packages\jira\__init__.py", 
line 10, in <module>
    from jira.client import JIRA  # noqa: E402
  File "C:\depot\bitbucket\python_bug\venv\lib\site-packages\jira\client.py", 
line 29, in <module>
    from pkg_resources import parse_version
  File 
"C:\depot\bitbucket\python_bug\venv\lib\site-packages\pkg_resources\__init__.py",
 line 32, in <module>
    import plistlib
  File "C:\Python37\Lib\plistlib.py", line 65, in <module>
    from xml.parsers.expat import ParserCreate
ModuleNotFoundError: No module named 'xml.parsers'

but if I run 
(venv) otrejoso@OTREJOSO-TLALOC C:\depot\bitbucket\python_bug
$ python -c "from testdriver.jira_utils import JiraUtils"

(venv) otrejoso@OTREJOSO-TLALOC C:\depot\bitbucket\python_bug

There is no error.

I wonder if this is some kind of bug with importing packages or is it a way to 
fix this by importing differently?

I have attached a zip file that should be able to repro the issue. It is pretty 
simple since it just imports packages.
There is a run_repro.bat script to make things easier to repro

Steps of bat script:
set PYTHONPATH=.
python testdriver\main.py
python -c "from testdriver.jira_utils import JiraUtils"

Note: the zip contains the minimal files that showed the issue on bigger scale 
project that we have.

Thanks in advance.

----------
files: error.zip
messages: 393669
nosy: otrejoso
priority: normal
severity: normal
status: open
title: Local import conflict with system import
versions: Python 3.7
Added file: https://bugs.python.org/file50042/error.zip

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44132>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to