hackebrot / cibopath

:mag: Search Cookiecutters on GitHub
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

Fedora 23 setup #4

Closed iandouglas closed 8 years ago

iandouglas commented 8 years ago

I've got Python 3.5 installed on Fedora 23, but when I run your setup instructions from PyPi, I get an error about being unable to access .cibopathrc in my $HOME folder.

$ sudo pip3.5 install cibopath
... (snipped)
Successfully installed aiohttp-0.21.6 chardet-2.3.0 cibopath-0.1.0 click-6.6

$ cibopath config github.username iandouglas
Traceback (most recent call last):
  File "/usr/bin/cibopath", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 1057, in invoke
    Command.invoke(self, ctx)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.5/site-packages/cibopath/cli.py", line 30, in cli
    ctx.obj = UserConfig(config_file)
  File "/usr/lib/python3.5/site-packages/cibopath/user_config.py", line 13, in __init__
    self._config = self._load_config()
  File "/usr/lib/python3.5/site-packages/cibopath/user_config.py", line 24, in _load_config
    with self.file_path.open('r', encoding='utf8') as config_file:
  File "/usr/lib64/python3.5/pathlib.py", line 1136, in open
    opener=self._opener)
  File "/usr/lib64/python3.5/pathlib.py", line 992, in _opener
    return self._accessor.open(self, flags, mode)
  File "/usr/lib64/python3.5/pathlib.py", line 371, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: '/home/id/.cibopathrc'
hackebrot commented 8 years ago

Hi @iandouglas! 👋

Did you follow the config instructions?

iandouglas commented 8 years ago

@hackebrot considering the very first instruction is cibopath config github.username <your-username> which I pasted above, yes.

iandouglas commented 8 years ago

My presumption is that the 'config' steps would create that file, but the exception that's thrown above indicates it's merely looking for the file and not finding it.

From what I've traced in cly.py and user_config.py is that it's looking for my .cibopathrc file before even interpreting my instructions, this feels like a chicken-and-egg problem since my rc file hasn't been created by the tool yet.

in user_config.py:

24         with self.file_path.open('r', encoding='utf8') as config_file:
25             config.read_file(config_file)

... perhaps this needs a try/except around it in case the file isn't found, and handled more gracefully?

hackebrot commented 8 years ago

Right, my bad. I can reproduce the issue.

As a workaround you can $ touch ~/.cibopathrc for now.

hackebrot commented 8 years ago

Should be fixed now!