NDAR / nda-tools

Python package for interacting with NDA web services. Used to validate, submit, and download data to and from NDA.
MIT License
48 stars 21 forks source link

ClientConfiguration misreports location of settings.cfg #79

Closed dmd closed 11 months ago

dmd commented 1 year ago

It took me an awfully long time to debug something, because ClientConfiguration misreports the location of the settings.cfg it uses.

If the -u/--username argument is not provided, downloadcmd prints something like:

-u/--username argument not provided. Using default value of 'johnsmith' which was saved in /home/jsmith/.NDATools/settings.cfg

However, that may not be true, if this else statement triggered.

dmd commented 1 year ago

80 is a simple PR to resolve this.

nicholst commented 1 year ago

I too noticed this; when I omit the -u option it tells me

-u/--username argument not provided. Using default value of 'JOESMITH' which was saved in /Users/joesmith/.NDATools/settings.cfg

but then later, when I was having problems logging in told me

The password that was entered for user 'JOESMITH' is invalid ...
If your username was previously entered incorrectly, you may update it in your settings.cfg located at 
/Users/joesmith/anaconda3/envs/py3/lib/python3.11/site-packages/NDATools/clientscripts/config/settings.cfg
Enter your NIMH Data Archives password:

and it is, indeed, in that later location deep in my anaconda install.

dmd commented 1 year ago

It is an additional bug that downloadcmd would be altering a file in site-packages. Programs should not be altering files in their installation like that!

gregmagdits commented 11 months ago

This has been addressed in the most recent version of the tools, 0.2.26. We also modified the logic so that the client doesn't attempt to modify the files in the site-packages dir, as @dmd pointed out above.