gitwarrior icon indicating copy to clipboard operation
gitwarrior copied to clipboard

configparser.NoSectionError: No section: 'Credentials'

Open a-t-0 opened this issue 4 years ago • 0 comments

Context

Hi, thank you for your work, using this to sync between GitHub issues and taskwarrior has been on my mind for a few years now. I just got round to giving it a start, noticed the code was written in python 2.7, in which I get errors on the installation of ConfigParser.

Reproducing

Hence, I decided to install it as python 3.x software. I used the following commands to do so (full changes and updated instructions can be found here:https://github.com/HiveMinds/gitwarrior) :

conda env create --file environment.yml
conda activate gitwarrior
python setup.py --help-commands
python setup.py build
python setup.py clean
2to3 -w build/scripts-3.9/gw
python setup.py install
python setup.py check

Output

and the gw list command then returns:

Traceback (most recent call last):
  File "/home/name/anaconda/envs/gitwarrior/bin/gw", line 4, in <module>
    __import__('pkg_resources').run_script('gitwarrior==0.1', 'gw')
  File "/home/name/anaconda/envs/gitwarrior/lib/python3.9/site-packages/pkg_resources/__init__.py", line 656, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/name/anaconda/envs/gitwarrior/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1460, in run_script
    exec(script_code, namespace, namespace)
  File "/home/name/anaconda/envs/gitwarrior/lib/python3.9/site-packages/gitwarrior-0.1-py3.9.egg/EGG-INFO/scripts/gw", line 69, in <module>
  File "/home/name/anaconda/envs/gitwarrior/lib/python3.9/site-packages/gitwarrior-0.1-py3.9.egg/gitwarrior/__init__.py", line 80, in __init__
  File "/home/name/anaconda/envs/gitwarrior/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
  File "/home/name/anaconda/envs/gitwarrior/lib/python3.9/configparser.py", line 1152, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'Credentials'

Troubleshooting

This post seems to suggest that the path towards the configuration file may be incorrect due to backslashes instead of forward slashes. My guess would be that my conversion from python 2.7 to 3.x led to this issue, however I have not yet verified this guess.

An alternative suggestion may be found here which seems to imply that I did not specify the path towards the configurations file correctly. Hence I tried:

gw --config=/home/name/.gitwarriorrc

However, that yields the same error. However, I think that may be because the /home/name/.gitwarriorrc file does not yet exist on my device. Looking at:

def read_config(filename=None):
	if not filename: filename = "%s/.gitwarriorrc" % os.getenv("HOME")
	cfg = ConfigParser()
	cfg.read(filename)
	return cfg

and:

config = read_config(options.config)

I think this indeed seems likely. Hence, I would like to ask:

Question

  1. What should be contained in the .gitwarriorrc file?
  2. Suppose that is not the issue, would you happen to see how I could overcome this issue? I did not yet resolve it.

Ps. Once the installation works with a single set of commands, I'd like (send you a pull request, if you like), and to include the hook in: https://github.com/HiveMinds/tw-install (once I've completed setting up the CI with build status on that repo)

a-t-0 avatar Dec 27 '21 17:12 a-t-0