ImportError: No module named 'src'
patsevanton opened this issue · 9 comments
user@amd-e-450:$ python3 -V$ pip3 install json2xml
Python 3.5.2
user@amd-e-450:
Collecting json2xml
Downloading json2xml-1.1.0.tar.gz
Collecting BeautifulSoup4==4.4.1 (from json2xml)
Downloading beautifulsoup4-4.4.1-py3-none-any.whl (81kB)
100% |████████████████████████████████| 81kB 410kB/s
Collecting dict2xml==1.3 (from json2xml)
Downloading dict2xml-1.3.tar.gz
Collecting simplejson==3.6.5 (from json2xml)
Downloading simplejson-3.6.5.tar.gz (73kB)
100% |████████████████████████████████| 81kB 684kB/s
Collecting six==1.9.0 (from json2xml)
Downloading six-1.9.0-py2.py3-none-any.whl
Collecting requests==2.9.1 (from json2xml)
Downloading requests-2.9.1-py2.py3-none-any.whl (501kB)
100% |████████████████████████████████| 501kB 477kB/s
Building wheels for collected packages: json2xml, dict2xml, simplejson
Running setup.py bdist_wheel for json2xml ... done
Stored in directory: /home/user/.cache/pip/wheels/4e/5e/51/252d1138579cf48debd311667fa57b25b0ff50177447e1906b
Running setup.py bdist_wheel for dict2xml ... done
Stored in directory: /home/user/.cache/pip/wheels/e6/3e/13/d3f21cf1b95a03d8d940813562b85a3a1e173774ca226c63c4
Running setup.py bdist_wheel for simplejson ... done
Stored in directory: /home/user/.cache/pip/wheels/81/9e/4e/c7a8c0ce2d1e19874582fd21ae83eecf21d826582a54729394
Successfully built json2xml dict2xml simplejson
Installing collected packages: BeautifulSoup4, six, dict2xml, simplejson, requests, json2xml
Successfully installed BeautifulSoup4-4.4.1 dict2xml-1.3 json2xml-1.1.0 requests-2.9.1 simplejson-3.6.5 six-1.9.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
user@amd-e-450:$ vi 1.py$ mc
user@amd-e-450:
user@amd-e-450:$$ python3 1.py
user@amd-e-450:
Traceback (most recent call last):
File "1.py", line 1, in
from src.json2xml import Json2xml
ImportError: No module named 'src'
user@amd-e-450:~$ cat 1.py
from src.json2xml import Json2xml
data = Json2xml.fromjsonfile('examples/example.json').data
data_object = Json2xml(data)
data_object.json2xml() #xml output
Changed file:
user@amd-e-450:~$ python3 1.py
Traceback (most recent call last):
File "1.py", line 1, in
from json2xml import Json2xml
ImportError: cannot import name 'Json2xml'
user@amd-e-450:~$ cat 1.py
from json2xml import Json2xml
data = Json2xml.fromjsonfile('examples/example.json').data
data_object = Json2xml(data)
data_object.json2xml() #xml output
Ah, the issue is with pypi, the older version was uploaded, hence you got the error. I just released the latest 1.2.3 version. Please update the code using
pip install --upgrade json2xml
And all the examples would just work.
@patsevanton Let me know if it works for you now.
@vinitkumar How check version after
pip install --upgrade json2xml
?
You can do pip freeze
. It will show you the version of all the packages installed.
Also, you can run pip freeze | grep 'json2xml
. It will give output like this.
json2xml==1.2.3
[vagrant@vpn ~]$ pip install --upgrade json2xml
Requirement already up-to-date: json2xml in /usr/lib/python2.7/site-packages
Requirement already up-to-date: BeautifulSoup4==4.4.1 in /usr/lib64/python2.7/site-packages (from json2xml)
Requirement already up-to-date: dict2xml==1.3 in /usr/lib/python2.7/site-packages (from json2xml)
Requirement already up-to-date: simplejson==3.6.5 in /usr/lib/python2.7/site-packages (from json2xml)
Requirement already up-to-date: six==1.9.0 in /usr/lib/python2.7/site-packages (from json2xml)
Requirement already up-to-date: requests==2.9.1 in /usr/lib/python2.7/site-packages (from json2xml)
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[vagrant@vpn ~]$ pip freeze | grep 'json2xml'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
json2xml==1.1.0
[vagrant@vpn ~]$ pip3 install --upgrade json2xml
Requirement already up-to-date: json2xml in /usr/lib/python3.4/site-packages
Requirement already up-to-date: BeautifulSoup4==4.4.1 in /usr/lib64/python3.4/site-packages (from json2xml)
Requirement already up-to-date: dict2xml==1.3 in /usr/lib/python3.4/site-packages (from json2xml)
Requirement already up-to-date: simplejson==3.6.5 in /usr/lib/python3.4/site-packages (from json2xml)
Requirement already up-to-date: six==1.9.0 in /usr/lib/python3.4/site-packages (from json2xml)
Requirement already up-to-date: requests==2.9.1 in /usr/lib/python3.4/site-packages (from json2xml)
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[vagrant@vpn ~]$ pip3 freeze | grep 'json2xml'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
json2xml==1.1.0
[vagrant@vpn ~]$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
Okay, Looks like some issue with pypi. For now, use this:
pip install git+https://github.com/vinitkumar/json2xml.git
Or you can just clone the project and run python setup.py install
@patsevanton Does it work for you now?
I dont check. Thanks.