Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

vtcmd fails if log directory doesn't exist #12

Closed
kdaily opened this issue Jun 24, 2019 · 4 comments
Closed

vtcmd fails if log directory doesn't exist #12

kdaily opened this issue Jun 24, 2019 · 4 comments

Comments

@kdaily
Copy link

kdaily commented Jun 24, 2019

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
Copy link

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
Copy link
Contributor

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
Copy link

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
Copy link
Contributor

@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.

obenshaindw referenced this issue Oct 11, 2019
* Removed use of star operator to unpack objects in print statements
* Removed Python3 specific exceptions in favor of python2/3 compatible OSError and IOError exceptions
* Small PEP-8 fixes (spacing) - more to do.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants