TheBigW / DRC

Digital Room Correction plugin for rhythmbox
GNU General Public License v3.0
39 stars 1 forks source link

error on using tools-drc #2

Closed fossfreedom closed 9 years ago

fossfreedom commented 9 years ago

saw this error when using the tools-drc menu option:

 File "/usr/lib/rhythmbox/plugins/DRC/DRCConfig.py", line 35, in load
    cfgFile = open(self.cfgFileName,'r')
FileNotFoundError: [Errno 2] No such file or directory: '/home/dad/.cache/rhythmbox/DRC/DRC.xml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rhythmbox/plugins/DRC/DRC_rb3compat.py", line 740, in _activate
    self._connect_func(action, None, self._connect_args)
  File "/usr/lib/rhythmbox/plugins/DRC/DRCUi.py", line 501, in show_ui
    self.initUI()
  File "/usr/lib/rhythmbox/plugins/DRC/DRCUi.py", line 172, in initUI
    aCfg = DRCConfig()
  File "/usr/lib/rhythmbox/plugins/DRC/DRCConfig.py", line 32, in __init__
    self.load()
  File "/usr/lib/rhythmbox/plugins/DRC/DRCConfig.py", line 44, in load
    self.save()
  File "/usr/lib/rhythmbox/plugins/DRC/DRCConfig.py", line 48, in save
    Serializer.write(self.cfgFileName, self)
  File "/usr/lib/rhythmbox/plugins/DRC/XMLSerializer.py", line 58, in write
    ET.ElementTree(rootElem).write( fileName )
  File "lxml.etree.pyx", line 1949, in lxml.etree._ElementTree.write (src/lxml/lxml.etree.c:55919)
  File "serializer.pxi", line 477, in lxml.etree._tofilelike (src/lxml/lxml.etree.c:117874)
  File "serializer.pxi", line 523, in lxml.etree._create_output_buffer (src/lxml/lxml.etree.c:118373)
  File "serializer.pxi", line 512, in lxml.etree._create_output_buffer (src/lxml/lxml.etree.c:118218)
FileNotFoundError: [Errno 2] No such file or directory

can confirm that the folder /home/dad/.cache/rhythmbox/DRC does not exist. Had a quick look at the code - may test that the folder exists - if not create it

if not os.path.exists(directory):
    os.makedirs(directory)

before opening the file.

TheBigW commented 9 years ago

thanks for already posting the code -> done :)