marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.32k stars 216 forks source link

exe created from simple kivy program has ConfigParser.InterpolationSyntaxError #213

Open anthony-tuininga opened 7 years ago

anthony-tuininga commented 7 years ago

Originally reported by: ben ryan (Bitbucket: BenGRyan, GitHub: Unknown)


I wish to package a project based on kivy, for windows. To start I have made a simple kivy helloworld application which packages successfully. When it is run it has this error:

#!python
[ERROR             ] [Core        ] error while reading localconfiguration
Traceback (most recent call last):
  File "C:\Python\Python34\lib\site-packages\kivy\config.py", line 634, in <module>
    Config.read(kivy_config_fn)
  File "C:\Python\Python34\lib\site-packages\kivy\config.py", line 401, in read
    for k, v in self.items(section):
  File "C:\Python\Python34\lib\ConfigParser.py", line 835, in items
    return [(option, value_getter(option)) for option in d.keys()]
  File "C:\Python\Python34\lib\ConfigParser.py", line 835, in <listcomp>
    return [(option, value_getter(option)) for option in d.keys()]
  File "C:\Python\Python34\lib\ConfigParser.py", line 832, in <lambda>
    section, option, d[option], d)
  File "C:\Python\Python34\lib\ConfigParser.py", line 371, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "C:\Python\Python34\lib\ConfigParser.py", line 421, in _interpolate_some
    "found: %r" % (rest,))
ConfigParser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%y-%m-%d_%_.txt'
[ERROR             ] Error while activating FileHandler logger
Traceback (most recent call last):
  File "C:\Python\Python34\lib\site-packages\kivy\logger.py", line 205, in emit
    self._configure()
  File "C:\Python\Python34\lib\site-packages\kivy\logger.py", line 147, in _configure
    log_name = Config.get('kivy', 'log_name')
  File "C:\Python\Python34\lib\site-packages\kivy\config.py", line 433, in get
    value = PythonConfigParser.get(self, section, option, **kwargs)
  File "C:\Python\Python34\lib\ConfigParser.py", line 772, in get
    d)
  File "C:\Python\Python34\lib\ConfigParser.py", line 371, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "C:\Python\Python34\lib\ConfigParser.py", line 421, in _interpolate_some
    "found: %r" % (rest,))

If i go to kivy/config.ini and change the string to "%%y-%%m-%%d%%.txt" the error goes away... but that can't be a good solution. The program runs fine when run normally through python. Why would packaging it make that happen? Pretty bizarre.

Using Windows 10, Python 3.4.4, Kivy 1.9.1, cx_Freeze 5.0

Setup Script:

#!python

from cx_Freeze import setup, Executable

build_exe_options = {"packages":['kivy'], 
                     "excludes": [],
                     "include_files": []}
setup(
    name = "Helloworld",
    description = "Simple kivy app",
    version = "0.1",
    options = {"build_exe": build_exe_options},
    executables = [Executable("helloworld.py")]
    )

Simply helloworld kivy app

#!python
import kivy
kivy.require('1.9.1') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.label import Label

class MyApp(App):

    def build(self):
        return Label(text='Hello world')

if __name__ == '__main__':
    MyApp().run()

ghost commented 6 years ago

I'm encountering this same issue. I am using Windows 7, Python 3.5.2, Kivy 1.9.1, cx_Freeze 5.1.1. The program also runs fine for me via PyCharm.

taha-lyousfi commented 4 years ago

Me too I am facing the same issue with windows 7 pro python 3.6.4, kivy 1.11.1 and cx_freeze 6.1. The program is running fine in VSCode but the window does not even appear for me and I am getting an error message.