mpenning / ciscoconfparse

Parse, Audit, Query, Build, and Modify Arista / Cisco / Juniper / Palo Alto / F5 configurations.
http://www.pennington.net/py/ciscoconfparse/
GNU General Public License v3.0
793 stars 220 forks source link

Import issues on 3.4.3 with CiscoConfParse > 1.2.14. #32

Closed jgsawyers closed 9 years ago

jgsawyers commented 9 years ago

CiscoConfParse 1.2.15 and greater appear to have issues importing correctly in Python 3.4.3 under Windows 7. Rolling back, 1.2.14 is the last version that appears to work as expected. Example below using 1.2.17.

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

>>> from ciscoconfparse import CiscoConfParse
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from ciscoconfparse import CiscoConfParse
ImportError: cannot import name 'CiscoConfParse'

>>> from ciscoconfparse import ciscoconfparse
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    from ciscoconfparse import ciscoconfparse
  File "C:\Users\user\virtuals\test_env\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 8, in <module>
    from models_cisco import IOSHostnameLine, IOSRouteLine, IOSIntfLine
ImportError: No module named 'models_cisco'
mpenning commented 9 years ago

Thank you for reporting this problem... I can replicate the issue with Python 3.4.3 in Windows Vista as well.

I confirmed that Python 2.7 + ciscoconfparsein Windows does not have this problem; at this point, my best workaround is to go with Python 2.7 in Windows.

ccp_1_2_17_windows

Python3.4 + ciscoconfparse also works in linux.

I'm still trying to parse what exactly broke this... sadly there is no Travis-CI Windows support.

mpenning commented 9 years ago

This problem was introduced by setup.py commit 72240ce89b76143a3383e730ce16054cf66a9e0a when I disabled the use_2to3 flag.

Reverting that change fixes the problem on my system; please test on your system and let me know. I took the liberty of pushing version 1.2.18 to pypi, since I know it fixes Py34 + ciscoconfparse problems in Windows Vista.

ccp_1_2_18_windows

jgsawyers commented 9 years ago

1.2.18 confirmed working here on Windows 7 with 3.4.3 via pypi. Thanks for the quick response!