#!c:\Program Files\Python39\python.exe # -*- coding: UTF-8 -*- import os, sys # ***** include the biocase.lib directory in the python sys path for importing ***** exec(open(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, 'lib', 'biocase', 'adjustpath.py'))).read()) exec(open(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, 'lib', 'biocase', 'appinit.py'))).read()) from biocase.configtool.general import * from biocase.configtool.cmfupgrade import cmfUpgrade from biocase.cmfinfo import CMFTemplateListClass from biocase import appinit tmpl = PageMacro('Content', PageMacro.DELMODE) tmpl.load('Content', os.path.join(templateDir, '_encodingerror.html')) siteconf = os.path.join(sys.exec_prefix, "sitecustomize.py") tmpl['dsa'] = form.getfirst('dsa') tmpl['schema'] = form.getfirst('schema') tmpl['encoding'] = sys.getdefaultencoding() tmpl['siteconfig'] = siteconf if form.getfirst('action') == 'dochange': try: handle = open(siteconf, 'a') handle.write("\nimport sys\nsys.setdefaultencoding('utf-8')\n") handle.close() tmpl['done'] = "success();" except: tmpl['done'] = "failure();" raise printOverHTTP( tmpl )