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 22 forks source link

vtcmd fails if log directory doesn't exist #12

Closed kdaily closed 4 years ago

kdaily commented 5 years ago

On first time installation, no directory at ${HOME}/NDAValidationResults/ exists to create a log file.

(nda-python3) [kdaily@tigger nda-tools]$ vtcmd -h
Traceback (most recent call last):
  File "/home/kdaily/.virtualenvs/nda-python3/bin/vtcmd", line 6, in <module>
    from NDATools.clientscripts.vtcmd import main
  File "/home/kdaily/.virtualenvs/nda-python3/lib/python3.7/site-packages/NDATools/clientscripts/vtcmd.py", line 2, in <module>
    from NDATools.Validation import Validation
  File "/home/kdaily/.virtualenvs/nda-python3/lib/python3.7/site-packages/NDATools/Validation.py", line 13, in <module>
    from NDATools.Utils import *
  File "/home/kdaily/.virtualenvs/nda-python3/lib/python3.7/site-packages/NDATools/Utils.py", line 16, in <module>
    logging.basicConfig(filename=log_file, level=logging.DEBUG, format="%(asctime)s:%(levelname)s:%(message)s")
  File "/usr/lib64/python3.7/logging/__init__.py", line 1900, in basicConfig
    h = FileHandler(filename, mode)
  File "/usr/lib64/python3.7/logging/__init__.py", line 1092, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python3.7/logging/__init__.py", line 1121, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/home/kdaily/NDAValidationResults/debug_log_20190624T092809.txt'
PatrickJReed commented 5 years ago

I got the same error....however

sudo mkdir /home/ubuntu/NDAValidationResults sudo chmod 777 /home/ubuntu/NDAValidationResults/

gets past the error, it's dirty, but working.

obenshaindw commented 5 years ago

The latest update to NDATools addresses this issue. @PatrickJReed, @kdaily, or @cw-dvr8 if you pip uninstall and remove the NDAValidationResults directory, then re-install and attempt to run one of the command-line scripts it should automatically create the directory now and the FileNotFoundError should no longer occur.

PatrickJReed commented 5 years ago

following the reinstall...

vtcmd -h Traceback (most recent call last): File "/usr/local/bin/vtcmd", line 7, in from NDATools.clientscripts.vtcmd import main File "/usr/local/lib/python2.7/dist-packages/NDATools/clientscripts/vtcmd.py", line 3, in from NDATools.Utils import * File "/usr/local/lib/python2.7/dist-packages/NDATools/Utils.py", line 18, in config = ClientConfiguration(os.path.join(os.path.expanduser('~'), '.NDATools/settings.cfg')) File "/usr/local/lib/python2.7/dist-packages/NDATools/Configuration.py", line 23, in init self.validation_api = self.config.get("Endpoints", "validation") File "/usr/lib/python2.7/ConfigParser.py", line 607, in get raise NoSectionError(section) ConfigParser.NoSectionError: No section: 'Endpoints'

obenshaindw commented 5 years ago

@PatrickJReed I introduced a bug in trying to fix the other one. We just released an updated version that addresses the issue. Tested locally on python2.7 and python3.6 with fresh installation (including removing the ~/.NDATools directory).

Please let me know if you continue to see an error with the latest version.