Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError on Windows 10 #455

Closed
thomasbridge74 opened this issue Aug 19, 2019 · 3 comments · Fixed by #456
Closed

FileNotFoundError on Windows 10 #455

thomasbridge74 opened this issue Aug 19, 2019 · 3 comments · Fixed by #456

Comments

@thomasbridge74
Copy link
Contributor

ISSUE TYPE
  • Bug Report
TEMPLATE USING

Error does not appear to be template specific (unless the index file counts)

SAMPLE COMMAND OUTPUT
SUMMARY

It would appear that the templates files are not copied when installing in Windows from a local copy of the repository.

STEPS TO REPRODUCE

On a Windows 10 desktop with git bash

git clone https://github.com/networktocode/ntc-templates.git
py -3 -m pip install ntc-templates/ --user

Then in a python console (having set up the variable topology):_

top_parsed = parse_output(platform="cisco_ios", command="show ip eigrp topology", data=topology)
EXPECTED RESULTS

I expected it to find the find the template from the index and proceed.

ACTUAL RESULTS
top_parsed = parse_output(platform="cisco_ios", command="show ip eigrp topology", data=topology)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\<USERHOMEDIR>\AppData\Roaming\Python\Python35\site-packages\ntc_templates\parse.py", line 28, in parse_output
    cli_table = clitable.CliTable('index', template_dir)
  File "C:\<USERHOMEDIR>\AppData\Roaming\Python\Python35\site-packages\clitable.py", line 184, in Wrapper
    return func(main_obj, *args, **kwargs)  # pylint: disable=E1102
  File "C:\<USERHOMEDIR>\AppData\Roaming\Python\Python35\site-packages\clitable.py", line 205, in __init__
    self.ReadIndex(index_file)
  File "C:\<USERHOMEDIR>\AppData\Roaming\Python\Python35\site-packages\clitable.py", line 220, in ReadIndex
    self.index = IndexTable(self._PreParse, self._PreCompile, fullpath)
  File "C:\<USERHOMEDIR>\AppData\Roaming\Python\Python35\site-packages\clitable.py", line 73, in __init__
    self._index_handle = open(self._index_file, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\<USERHOMEDIR>\\AppData\\Roaming\\Python\\Python35\\site-packages\\ntc_templates\\templates\\index'

Comments

I investigated the contents of my user site-packages folder and there were no templates installed. I'm not an expert with python packaging, but I suspect the issue might be that the templates folder is symlinked which would work on Macs + Linux but is probably causing Windows to not copy the template files into the relevant folder.

@jmcgill298
Copy link
Contributor

Thanks for reporting this @thomasbridge74. Can you try using the parse branch of this project and install with the -e option?

@thomasbridge74
Copy link
Contributor Author

thomasbridge74 commented Aug 20, 2019

Hi @jmcgill298 - that does appear to have done the trick.

py -3.5 -m pip install --user -e .

Resolves the issue. I assume you'll merge the branch back into the master tree at some point.

@jmcgill298
Copy link
Contributor

Thanks for confirming; I have submitted #456

jmcgill298 added a commit that referenced this issue Sep 26, 2019
…dows - Fixes #455 (#456)

* Update template directory search to pseudo-work with Windows
charlesmonson pushed a commit to charlesmonson/ntc-templates that referenced this issue Oct 11, 2019
…dows - Fixes networktocode#455 (networktocode#456)

* Update template directory search to pseudo-work with Windows
thomasblass pushed a commit to thomasblass/ntc-templates that referenced this issue Oct 25, 2020
…dows - Fixes networktocode#455 (networktocode#456)

* Update template directory search to pseudo-work with Windows
jvanderaa pushed a commit that referenced this issue Nov 10, 2021
…dows - Fixes #455 (#456)

* Update template directory search to pseudo-work with Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants