tilboerner / depx

Examine and visualize dependencies used by Python modules 🔍
Other
19 stars 3 forks source link

Fix template.html path #25

Closed fabiocerqueira closed 5 years ago

fabiocerqueira commented 5 years ago

Using absolute path to avoid exceptions if use depx in another folder

$ depx depx --format html
Traceback (most recent call last):
  File "/usr/local/var/pyenv/versions/depx36/bin/depx", line 9, in <module>
    load_entry_point('depx', 'console_scripts', 'depx')()
  File "/usr/local/var/pyenv/versions/3.6.4/envs/depx36/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/var/pyenv/versions/3.6.4/envs/depx36/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/var/pyenv/versions/3.6.4/envs/depx36/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/var/pyenv/versions/3.6.4/envs/depx36/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/fabio/testing/depx/depx/cli.py", line 43, in main
    click.echo(export_to(graph=graph, path=path, dependencies=deps))
  File "/Users/fabio/testing/depx/depx/graph.py", line 25, in to_html
    with open('depx/template.html') as file_:
FileNotFoundError: [Errno 2] No such file or directory: 'depx/template.html'
fabiocerqueira commented 5 years ago

ok, py3.4 and py3.5 failed, I'll check it later

This was the problem with py3.4 and py3.5. The built-in open() function wasn't able to open a file from a PathLike object https://docs.python.org/3/whatsnew/3.6.html#pep-519-adding-a-file-system-path-protocol