简体   繁体   中英

ciscoconfparse in Python 3.4 module doesn't import correctly

I'm trying to install a python module called ciscoconfparse on Linux Mint 17. When I install it with pip with python 2, all works well when I try to import, but when I try it with pip3 (for Python 3.4), the module shows up in the install directory, but I can't import any parts of it.

I can find the module here

/usr/local/lib/python3.4/dist-packages/ciscoconfparse-1.1.1-py3.4.egg/ciscoconfparse

Inside this directory is the ciscoconfparse.py file, which has the CiscoConfParse class, but I can't import it with

from ciscoconfparse import CiscoConfParse

When I try to install, it looks like there is a few problems, but still says it has sucessfuly installed.

~/Downloads/ciscoconfparse-1.1.1 $ sudo pip3 install ciscoconfparse
Downloading/unpacking ciscoconfparse
  Downloading ciscoconfparse-1.1.1.tar.gz (76kB): 76kB downloaded
  Running setup.py (path:/tmp/pip_build_root/ciscoconfparse/setup.py) egg_info for package ciscoconfparse
    zip_safe flag not set; analyzing archive contents...

    Installed /tmp/pip_build_root/ciscoconfparse/setuptools_hg-0.4-py3.4.egg

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.orig' found under directory '*'
    warning: no previously-included files matching 'BUILD.ME' found under directory '*'
    warning: no previously-included files matching 'BITBUCKET_HG' found under directory '*'
    warning: no previously-included files matching '.hgrc' found under directory '*'
    warning: no previously-included files matching '*' found under directory '.hg'
    warning: no previously-included files matching '*' found under directory 'sphinx-doc'
Installing collected packages: ciscoconfparse
  Running setup.py install for ciscoconfparse

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.orig' found under directory '*'
    warning: no previously-included files matching 'BUILD.ME' found under directory '*'
    warning: no previously-included files matching 'BITBUCKET_HG' found under directory '*'
    warning: no previously-included files matching '.hgrc' found under directory '*'
    warning: no previously-included files matching '*' found under directory '.hg'
    warning: no previously-included files matching '*' found under directory 'sphinx-doc'
      File "/usr/local/lib/python3.4/dist-packages/ciscoconfparse/excldiff_test.py", line 31
        print diffs
                  ^
    SyntaxError: invalid syntax

Successfully installed ciscoconfparse
Cleaning up...

On the authors site, he says that it has been tested to work on Python > 3.2. I'm using Pycharm as an ide. So far it seems like I can either use a virtual environment with python3 and see if that changes anything, or I can drop the module into the module I'm making. Is there any reason the install may not be working? Or else what is the best way to include the module with my own project?

Is there any reason the install may not be working? Or else what is the best way to include the module with my own project?

ciscoconfparse version 1.1.1 failed in all Python3 versions due to broken relative imports.

Relative imports broke due to lack of compliance with PEP 366 in ciscoconfparse version 1.1.1 (and prior); to resolve this, ciscoconfparse added a __main__.py in the package. I manually tested this against Python2.7 and Python3.4.1; as far as I can tell, version 1.1.2 fixes the issues with Python3.

I had the same issue but it has been fixed on the latest version 1.1.3, https://pypi.python.org/pypi/ciscoconfparse/1.1.3 . Please try that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM