google / textfsm

Python module for parsing semi-structured text into python tables.
Apache License 2.0
1.09k stars 168 forks source link

Exclude some imports so clitable will work on windows #82

Closed ktbyers closed 3 years ago

ktbyers commented 4 years ago

ntc-templates and Netmiko both use clitable, but the import of terminal.py (via texttable.py) breaks support on windows (even though there is no code in terminal.py that needs executed given what we are doing).

So this fixes this behavior.

This improves on the PR in:

https://github.com/google/textfsm/pull/68

Where fcntl was moved to the try/except.

ktbyers commented 4 years ago

This change:

      if token == '':

is because Python now generates a syntax warning on the previous code.

PseudotsugaMenziesii commented 4 years ago

@ktbyers you are my hero! I was just beating my head against a wall helping a coworker install and use Napalm only to hit this wall. Looks like I'll be manually adding a try/except block to terminal.py for the time being. That said, I will still use this as an excuse to have my employer support Linux workstations...

ktbyers commented 3 years ago

@harro Any possibility of including this PR and cutting a new release?

This issue causes a lot of pain in upstream libraries that use TextFSM including: NAPALM, ntc-templates, juniper pyez, and Nornir.

Regards, Kirk

b-marcum commented 3 years ago

Google, please merge!

mjbear commented 3 years ago

Google, please merge!

Agreed. It indeed does affect several upstream projects/libraries that utilize TextFSM.

Thank you! -Mike