diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 6f53df262..1bd746759 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -41,7 +41,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \ check_directory_exists from openlp.core.lib.settings import Settings -from openlp.core.utils import get_web_page, AppLocation +from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage log = logging.getLogger(__name__) @@ -65,7 +65,8 @@ class ThemeScreenshotThread(QtCore.QThread): filename = config.get(u'theme_%s' % theme, u'filename') screenshot = config.get(u'theme_%s' % theme, u'screenshot') urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot), - os.path.join(gettempdir(), u'openlp', screenshot)) + os.path.join(unicode(gettempdir(), get_filesystem_encoding()), + u'openlp', screenshot)) item = QtGui.QListWidgetItem(title, self.parent().themesListWidget) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename)) item.setCheckState(QtCore.Qt.Unchecked) @@ -115,7 +116,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): Set up display at start of theme edit. """ self.restart() - check_directory_exists(os.path.join(gettempdir(), u'openlp')) + check_directory_exists(os.path.join( + unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) self.noInternetFinishButton.setVisible(False) # Check if this is a re-run of the wizard. self.hasRunWizard = Settings().value( @@ -304,8 +306,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): item = self.themesListWidget.item(index) if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename): break - item.setIcon(build_icon( - os.path.join(gettempdir(), u'openlp', screenshot))) + item.setIcon(build_icon(os.path.join(unicode(gettempdir(), + get_filesystem_encoding()), u'openlp', screenshot))) def _getFileSize(self, url): site = urllib.urlopen(url) @@ -426,7 +428,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self._setPluginStatus(self.alertCheckBox, u'alerts/status') if self.webAccess: # Build directories for downloads - songs_destination = os.path.join(unicode(gettempdir()), u'openlp') + songs_destination = os.path.join( + unicode(gettempdir(), get_filesystem_encoding()), u'openlp') bibles_destination = AppLocation.get_section_data_path(u'bibles') themes_destination = AppLocation.get_section_data_path(u'themes') # Download songs diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 963fde482..267897efe 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1035,8 +1035,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Make sure it's a .conf file. if not export_file_name.endswith(u'conf'): export_file_name = export_file_name + u'.conf' - temp_file = os.path.join(unicode(gettempdir()), - u'openlp', u'exportConf.tmp') + temp_file = os.path.join(unicode(gettempdir(), + get_filesystem_encoding()), u'openlp', u'exportConf.tmp') self.saveSettings() setting_sections = [] # Add main sections. diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 3d60c9270..db8266419 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -40,7 +40,7 @@ from openlp.core.lib import Receiver, SettingsManager, translate, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box from openlp.core.lib.settings import Settings from openlp.core.ui.wizard import OpenLPWizard, WizardStrings -from openlp.core.utils import AppLocation, delete_file +from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, \ BiblesResourcesDB from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract @@ -73,7 +73,8 @@ class BibleUpgradeForm(OpenLPWizard): self.suffix = u'.sqlite' self.settingsSection = u'bibles' self.path = AppLocation.get_section_data_path(self.settingsSection) - self.temp_dir = os.path.join(gettempdir(), u'openlp') + self.temp_dir = os.path.join( + unicode(gettempdir(), get_filesystem_encoding()), u'openlp') self.files = self.manager.old_bible_databases self.success = {} self.newbibles = {} diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 4453798b6..583222e64 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -36,6 +36,7 @@ from openlp.core.lib import Plugin, StringContent, build_icon, translate, \ Receiver from openlp.core.lib.db import Manager from openlp.core.lib.ui import UiStrings, create_action +from openlp.core.utils import get_filesystem_encoding from openlp.core.utils.actions import ActionList from openlp.plugins.songs.lib import clean_song, upgrade, SongMediaItem, \ SongsTab @@ -234,7 +235,8 @@ class SongsPlugin(Plugin): new songs into the database. """ self.onToolsReindexItemTriggered() - db_dir = unicode(os.path.join(gettempdir(), u'openlp')) + db_dir = unicode(os.path.join( + unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) if not os.path.exists(db_dir): return song_dbs = []