← Back to team overview

openlp-core team mailing list archive

[Bug 1390917] [NEW] Traceback when copying or creating a theme with background image on Windows

 

Public bug reported:

Reproducable on Windows with the 2.1.1 beta

When copying a theme with background image I get this traceback:
Traceback (most recent call last):
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 298, in on_copy_theme
    self.clone_theme_data(theme_data, new_theme_name)
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 314, in clone_theme_data
    self.save_theme(theme_data, save_from, save_to)
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 632, in save_theme
    self._write_theme(theme, image_from, image_to)
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 666, in _write_theme
    shutil.copyfile(str(image_from).encode(encoding), str(image_to).encode(encoding))
  File "c:\python33\lib\shutil.py", line 92, in copyfile
    if _samefile(src, dst):
  File "c:\python33\lib\shutil.py", line 77, in _samefile
    return os.path.samefile(src, dst)
  File "c:\python33\lib\ntpath.py", line 603, in samefile
    return _getfinalpathname(f1) == _getfinalpathname(f2)
TypeError: must be str, not bytes

When createing a new theme with background image I get this traceback:
Traceback (most recent call last):
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\themeform.py", line 533, in accept
    self.theme_manager.save_theme(self.theme, save_from, save_to)
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 632, in save_theme
    self._write_theme(theme, image_from, image_to)
  File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 666, in _write_theme
    shutil.copyfile(str(image_from).encode(encoding), str(image_to).encode(encoding))
  File "c:\python33\lib\shutil.py", line 92, in copyfile
    if _samefile(src, dst):
  File "c:\python33\lib\shutil.py", line 77, in _samefile
    return os.path.samefile(src, dst)
  File "c:\python33\lib\ntpath.py", line 603, in samefile
    return _getfinalpathname(f1) == _getfinalpathname(f2)
TypeError: must be str, not bytes

Problem is in same method:  _write_theme
Most likely shutil.copyfile cannot handle bytes input on windows. This is not an issue on windows.

** Affects: openlp
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/1390917

Title:
  Traceback when copying or creating a theme with background image on
  Windows

Status in OpenLP - Worship Presentation Software:
  New

Bug description:
  Reproducable on Windows with the 2.1.1 beta

  When copying a theme with background image I get this traceback:
  Traceback (most recent call last):
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 298, in on_copy_theme
      self.clone_theme_data(theme_data, new_theme_name)
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 314, in clone_theme_data
      self.save_theme(theme_data, save_from, save_to)
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 632, in save_theme
      self._write_theme(theme, image_from, image_to)
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 666, in _write_theme
      shutil.copyfile(str(image_from).encode(encoding), str(image_to).encode(encoding))
    File "c:\python33\lib\shutil.py", line 92, in copyfile
      if _samefile(src, dst):
    File "c:\python33\lib\shutil.py", line 77, in _samefile
      return os.path.samefile(src, dst)
    File "c:\python33\lib\ntpath.py", line 603, in samefile
      return _getfinalpathname(f1) == _getfinalpathname(f2)
  TypeError: must be str, not bytes

  When createing a new theme with background image I get this traceback:
  Traceback (most recent call last):
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\themeform.py", line 533, in accept
      self.theme_manager.save_theme(self.theme, save_from, save_to)
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 632, in save_theme
      self._write_theme(theme, image_from, image_to)
    File "C:\Users\tgc\OpenLP\trunk\openlp\core\ui\thememanager.py", line 666, in _write_theme
      shutil.copyfile(str(image_from).encode(encoding), str(image_to).encode(encoding))
    File "c:\python33\lib\shutil.py", line 92, in copyfile
      if _samefile(src, dst):
    File "c:\python33\lib\shutil.py", line 77, in _samefile
      return os.path.samefile(src, dst)
    File "c:\python33\lib\ntpath.py", line 603, in samefile
      return _getfinalpathname(f1) == _getfinalpathname(f2)
  TypeError: must be str, not bytes

  Problem is in same method:  _write_theme
  Most likely shutil.copyfile cannot handle bytes input on windows. This is not an issue on windows.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/1390917/+subscriptions


Follow ups

References