<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to bugs</title><link href="https://sourceforge.net/p/wxglade/bugs/" rel="alternate"/><link href="https://sourceforge.net/p/wxglade/bugs/feed.atom" rel="self"/><id>https://sourceforge.net/p/wxglade/bugs/</id><updated>2024-01-20T12:38:43.291000Z</updated><subtitle>Recent changes to bugs</subtitle><entry><title>#249 [suggestions] A few minor issues</title><link href="https://sourceforge.net/p/wxglade/bugs/249/?limit=25#2988" rel="alternate"/><published>2024-01-20T12:38:43.291000Z</published><updated>2024-01-20T12:38:43.291000Z</updated><author><name>Dietmar Schwertberger</name><uri>https://sourceforge.net/u/dschwertberger/</uri></author><id>https://sourceforge.net093d7cdf198e777b14cc80d31371ac0dedb2a4c5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Gilles,&lt;/p&gt;
&lt;p&gt;thanks for reporting. Next time please use the Github bug tracker at &lt;a href="https://github.com/wxGlade/wxGlade/issues" rel="nofollow"&gt;https://github.com/wxGlade/wxGlade/issues&lt;/a&gt;&lt;br/&gt;
It's also linked from the wxGlade help menu.&lt;/p&gt;
&lt;p&gt;I will update the readme file for the next version, telling people about the binary version. This is the first time I have uploaded a binary at all. It's more for the people who are using C++ or Perl. When using wxPython, the recommendation is to use the wxglade.py with the target version.&lt;/p&gt;
&lt;p&gt;What is your OS, Python and wxPython version? I don't see the problems with .pyw or window positions.&lt;br/&gt;
Just to be sure: you're closing the GUI window, not the console?&lt;br/&gt;
The position should get saved to "C:\Users...\AppData\Roaming\wxglade\wxglade.ini" when wxGlade is closed. Do you have this file and does it get updated on saving?&lt;/p&gt;
&lt;p&gt;wxGlade has a debug console built in. When you run the .pyw file, could you please press F7 and check this in the console?&lt;br/&gt;
&lt;code&gt;import sys
sys.executable&lt;/code&gt;&lt;br/&gt;
For me that would display '... \Python36\Pythonw.exe'' or '...wxGlade-1.1.0a2\python\pythonw.exe'&lt;br/&gt;
If you see python.exe instead, then this means that your registry is set up such that .pyw is linked to python.exe instead of pythonw.exe.&lt;/p&gt;
&lt;p&gt;Also, I don't get the protection message. Probably there's no way to get rid of this other than the user deactivating SmartScreen:&lt;br/&gt;
&lt;a href="https://stackoverflow.com/questions/65488839/how-can-i-avoid-windows-protected-your-pc-problem-when-my-friends-try-to-use-m" rel="nofollow"&gt;https://stackoverflow.com/questions/65488839/how-can-i-avoid-windows-protected-your-pc-problem-when-my-friends-try-to-use-m&lt;/a&gt;&lt;br/&gt;
&lt;a href="https://www.minitool.com/backup-tips/windows-protected-your-pc.html" rel="nofollow"&gt;https://www.minitool.com/backup-tips/windows-protected-your-pc.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As of now, the html page seems to be available. The online version of the documents is more for people who have not yet downloaded wxGlade. After download, press F1.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br/&gt;
Dietmar&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>[suggestions] A few minor issues</title><link href="https://sourceforge.net/p/wxglade/bugs/249/" rel="alternate"/><published>2024-01-20T11:04:11.622000Z</published><updated>2024-01-20T11:04:11.622000Z</updated><author><name>Gilles</name><uri>https://sourceforge.net/u/accountnbr3000/</uri></author><id>https://sourceforge.netdd9c2e530d8bbe7b7aaadf64a5cb9e24771e21fc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;As a newbie learning wxWidgets on Windows 10, I have the following suggestions (entered as a bug to avoid having to subscribe to the mailing-list just for this):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the Download section (https://sourceforge.net/projects/wxglade/files/wxglade/1.1.0/), explain the difference between the two zip files with very different sizes (wxGlade-1.1.0a2_win_amd64_update.zip and wxGlade-1.1.0a2.zip). I figured out the former includes Python etc. so can run on a bare new computer, while the latter assumes Python and wxPython are already installed in the system&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;While the problem doesn't occur with the self-contained zip (ie. 40MB file), the smaller zip displsys the console even when double-clicking on wxglade.pyw (which shouldn't occure with a .pyw file)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;wxGlade always starts with the window ~half the size of the screen, so the user must maximize it manually, and the application doesn't remember this so it must be done every time even though "Remember position and size of wxGlade windows" in Edit &amp;gt; Preferences is checked by default.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When running wxglade.py(w) the first time, Windows says: "Windows protected your PC" with the "Don't run" button. I suggest finding how to tell Windows wxGlade is a safe binary.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As of 20/01/2024 11:58:36, the URL doesn't work ("An error has been encountered in accessing this page.") : &lt;a href="https://wxglade.sourceforge.net/docs/acknowledgements.html" rel="nofollow"&gt;https://wxglade.sourceforge.net/docs/acknowledgements.html&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Cheers,&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#248 Problems while generating Windows Executable</title><link href="https://sourceforge.net/p/wxglade/bugs/248/?limit=25#1874" rel="alternate"/><published>2022-05-16T18:57:35.786000Z</published><updated>2022-05-16T18:57:35.786000Z</updated><author><name>Dietmar Schwertberger</name><uri>https://sourceforge.net/u/dschwertberger/</uri></author><id>https://sourceforge.net7fa2512f7519f6e07e94289f49bcc361fbf0fb77</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I don't use / create installers, as the user usually needs wxPython anyway. If you find the bug, please inform me. Better use the github tracker, which is also linked from the help menu.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Problems while generating Windows Executable</title><link href="https://sourceforge.net/p/wxglade/bugs/248/" rel="alternate"/><published>2022-05-13T07:39:49.961000Z</published><updated>2022-05-13T07:39:49.961000Z</updated><author><name>Alessandro Golinelli</name><uri>https://sourceforge.net/u/mattstevens1994/</uri></author><id>https://sourceforge.netc9438562db05babadc11e8cc86754b0392703f56</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Good Morning, nice to meet you.&lt;br/&gt;
I tried to generate a windows installer, with the following system versions:&lt;br/&gt;
76 INFO: Pyinstaller: 5.0.1&lt;br/&gt;
77 INFO: Python: 3.9.9&lt;br/&gt;
88 INFO: Platform: Windows-10-10.0.19044-SP0&lt;br/&gt;
by executing the batch file&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;PS C:\Users\user\cbrunelli\Desktop\wxglade-1.0.4&amp;gt; install\pyinstaller\build.bat
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;but it says:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;option(s) not allowed: 
    --onedir/--onefile 
    --additional-hooks-dir
makespec options not valid when a .spec file is given
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So i removed those options and changed the hookspath parameter inside the .spec file to "hookspath="install\pyinstaller\hooks",&lt;br/&gt;
but pyinstaller couldn't find wxglade.py so i moved the .spec file to the wxglade-1.0.4 directory, and then i launched pyinstaller targeting the .spec file from there, always using the --clean --noconfirm options.&lt;br/&gt;
I got only the onedir executable but it does nothing.&lt;br/&gt;
I'm trying to figure it out by myself but i can't understand what's wrong.&lt;br/&gt;
Thanks&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#247  NameError: name'config' is not defined, etc.</title><link href="https://sourceforge.net/p/wxglade/bugs/247/?limit=25#a07d" rel="alternate"/><published>2021-12-18T15:22:22.227000Z</published><updated>2021-12-18T15:22:22.227000Z</updated><author><name>Dietmar Schwertberger</name><uri>https://sourceforge.net/u/dschwertberger/</uri></author><id>https://sourceforge.net4f95814c864832344ad6ecd6f8a139f2eb97a399</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;: open --&amp;gt; closed&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary></entry><entry><title>#247  NameError: name'config' is not defined, etc.</title><link href="https://sourceforge.net/p/wxglade/bugs/247/?limit=25#3b13" rel="alternate"/><published>2021-12-18T15:19:25.678000Z</published><updated>2021-12-18T15:19:25.678000Z</updated><author><name>GAM</name><uri>https://sourceforge.net/u/ry1234/</uri></author><id>https://sourceforge.net03769c51fe1074ba722a1c60303bff204c19a334</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;solved.&lt;br/&gt;
thank you.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#247  NameError: name'config' is not defined, etc.</title><link href="https://sourceforge.net/p/wxglade/bugs/247/?limit=25#0275" rel="alternate"/><published>2021-12-18T12:12:42.943000Z</published><updated>2021-12-18T12:12:42.943000Z</updated><author><name>Dietmar Schwertberger</name><uri>https://sourceforge.net/u/dschwertberger/</uri></author><id>https://sourceforge.nete51b8d1dc130533d623615c9560c3e9f70fffb54</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;It looks to me as if you try to run wxglade by executing the code in something like a shell window.&lt;br/&gt;
Please run wxGlade e.g. by double-clicking the file wxglade.py or by a command line &lt;br/&gt;
' C:/Users/user/AppData/Local/Programs/Python/Python39/python.exe wxglade.py'&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title> NameError: name'config' is not defined, etc.</title><link href="https://sourceforge.net/p/wxglade/bugs/247/" rel="alternate"/><published>2021-12-18T12:05:55.306000Z</published><updated>2021-12-18T12:05:55.306000Z</updated><author><name>GAM</name><uri>https://sourceforge.net/u/ry1234/</uri></author><id>https://sourceforge.net246fe335fa92e16dec2308f53ca8345f780e13c3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Nice to meet you.&lt;br/&gt;
We apologize for the inconvenience, but please check it because an error occurred when using it for the first time.&lt;br/&gt;
The usage environment is as follows.&lt;/p&gt;
&lt;p&gt;Python 3.9.9&lt;br/&gt;
wxPython 4.1.1&lt;br/&gt;
Windows 10&lt;/p&gt;
&lt;p&gt;PS C:\Users\user&amp;gt; &amp;amp; C:/Users/user/AppData/Local/Programs/Python/Python39/python.exe&lt;br/&gt;
Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) &lt;span&gt;[MSC v.1929 64 bit (AMD64)]&lt;/span&gt; on win32&lt;br/&gt;
Type "help", "copyright", "credits" or "license" for more information.&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;"""&lt;br/&gt;
... Entry point of wxGlade&lt;br/&gt;
... &lt;a class="user-mention" href="/u/copyright/"&gt;@copyright&lt;/a&gt;: 2002-2007 Alberto Griggio&lt;br/&gt;
... &lt;a class="user-mention" href="/u/copyright/"&gt;@copyright&lt;/a&gt;: 2013-2016 Carsten Grohmann   &lt;br/&gt;
... &lt;a class="user-mention" href="/u/copyright/"&gt;@copyright&lt;/a&gt;: 2016-2020 Dietmar Schwertberger&lt;br/&gt;
... @license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY&lt;br/&gt;
... """&lt;br/&gt;
'\nEntry point of wxGlade\n@copyright: 2002-2007 Alberto Griggio\n@copyright: 2013-2016 Carsten Grohmann\n@copyright: 2016-2020 Dietmar Schwertberger\n@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY\n'&lt;/p&gt;
&lt;p&gt;import atexit&lt;br/&gt;
import codecs&lt;br/&gt;
import logging, os, sys, gettext, optparse&lt;/p&gt;
&lt;h1 id="use-a-nullwriter-with-unicode-support-encoding-attribute-to-catch-and"&gt;Use a NullWriter with Unicode support (encoding attribute) to catch and&lt;/h1&gt;
&lt;h1 id="drop-all-output-in-pyinstaller-environment-standalone-edition"&gt;drop all output in PyInstaller environment (standalone Edition)&lt;/h1&gt;
&lt;h1 id="_1"&gt;&lt;/h1&gt;
&lt;h1 id="fix-for-pyinstaller-bug-1324"&gt;Fix for PyInstaller bug #1324&lt;/h1&gt;
&lt;h1 id="httpsgithubcompyinstallerpyinstallerissues1324"&gt;&lt;a href="https://github.com/pyinstaller/pyinstaller/issues/1324" rel="nofollow"&gt;https://github.com/pyinstaller/pyinstaller/issues/1324&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;if hasattr(sys, 'frozen') and not hasattr(sys.stderr, 'encoding'):&lt;br/&gt;
...     class NullWriter(object):&lt;br/&gt;
...         softspace = 0&lt;br/&gt;
...         encoding = 'UTF-8'&lt;br/&gt;
...         def write(&lt;em&gt;args):&lt;br/&gt;
...             pass&lt;br/&gt;
...         def flush(&lt;/em&gt;args):&lt;br/&gt;
...             pass&lt;br/&gt;
...     sys.stdout = NullWriter()&lt;br/&gt;
...     sys.stderr = NullWriter()&lt;br/&gt;
...&lt;br/&gt;
t = gettext.translation(domain="wxglade", localedir="locale", fallback=True)&lt;br/&gt;
t.install("wxglade")&lt;/p&gt;
&lt;h1 id="avoid-problems-with-_-in-builtins-being-replaced"&gt;avoid problems with "_" in &lt;strong&gt;builtins&lt;/strong&gt; being replaced:&lt;/h1&gt;
&lt;p&gt;def my_displayhook(value):&lt;br/&gt;
...     if value is not None:&lt;br/&gt;
...         print(repr(value))&lt;br/&gt;
...&lt;br/&gt;
sys.displayhook = my_displayhook&lt;br/&gt;
import common, config, compat, log&lt;br/&gt;
Traceback (most recent call last):&lt;br/&gt;
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;br/&gt;
ModuleNotFoundError: No module named 'common'&lt;br/&gt;
def parse_command_line():&lt;br/&gt;
...     "Parse command line"&lt;br/&gt;
...     # list of all available languages; don't load code generators at this point!!&lt;br/&gt;
...     languages = &lt;span&gt;['C++', 'XRC', 'lisp', 'perl', 'python']&lt;/span&gt;&lt;br/&gt;
...     # inject&lt;br/&gt;
...     optparse.OptionParser.format_description = lambda self, formatter: self.description&lt;br/&gt;
...     version = &lt;em&gt;("wxGlade version %s\n"&lt;br/&gt;
...                 "Copyright (C) 2007-2012 Alberto Griggio\n"&lt;br/&gt;
...                 "Copyright (C) 2011-2016 Carsten Grohmann\n"&lt;br/&gt;
...                 "Copyright (C) 2016-2020 Dietmar Schwertberger\n"&lt;br/&gt;
...                 "License MIT: The MIT License\n"&lt;br/&gt;
...                 "             &lt;a href="http://www.opensource.org/licenses/mit-license.php" rel="nofollow"&gt;http://www.opensource.org/licenses/mit-license.php&lt;/a&gt;") % config.get_version()&lt;br/&gt;
...     usage = &lt;/em&gt;("Usage: wxglade &amp;lt;wxg file=""&amp;gt;             start the wxGlade GUI\n"&lt;br/&gt;
...               " or:   wxglade &amp;lt;options&amp;gt; &amp;lt;wxg file=""&amp;gt;   generate code from command line\n"&lt;br/&gt;
...               " or:   wxglade --version              show programs version number and exit\n"&lt;br/&gt;
...               " or:   wxglade -h|--help              show this help message and exit")&lt;br/&gt;
...     parser = optparse.OptionParser( add_help_option=False, version=version, usage=usage )&lt;br/&gt;
...     parser.add_option('-h', '--help', dest='help', action='store_true', help=&lt;em&gt;('show this help message and exit'))&lt;br/&gt;
...     parser.add_option("-g", "--generate-code", type="choice", choices=languages, metavar="LANG", dest="language",&lt;br/&gt;
...                             help=&lt;/em&gt;("(required) output language, valid languages are: %s") % ", ".join(languages) )&lt;br/&gt;
...     parser.add_option("-o", "--output", metavar="PATH", dest="output",&lt;br/&gt;
...                             help=&lt;em&gt;("(optional) output file in single-file mode or output directory in multi-file mode"))&lt;br/&gt;
...     parser.add_option("-c", "--use-config", dest="rc_file",&lt;br/&gt;
...                             help=&lt;/em&gt;("use specified wxgladerc config file instead of the default one") )&lt;br/&gt;
...     options, args = parser.parse_args()&lt;br/&gt;
...     # print epilog because OptionParser.epilog isn't available to Python 2.3&lt;br/&gt;
...     if options.help:&lt;br/&gt;
...         parser.print_help()&lt;br/&gt;
...         print( &lt;em&gt;( "Example: Generate Python code out of myapp.wxg\n\n"&lt;br/&gt;
...                   "   wxglade -o output.py -g python myapp.wxg\n\n"&lt;br/&gt;
...                   "Report bugs to:    &lt;a href="mailto:wxglade-general@lists.sourceforge.net"&gt;wxglade-general@lists.sourceforge.net&lt;/a&gt; or at\n"&lt;br/&gt;
...                   "                   &lt;a href="https://sourceforge.net/projects/wxglade/"&gt;https://sourceforge.net/projects/wxglade/&lt;/a&gt;\n"&lt;br/&gt;
...                   "wxGlade home page: &lt;a href="http://wxglade.sourceforge.net/" rel="nofollow"&gt;http://wxglade.sourceforge.net/&lt;/a&gt;") )&lt;br/&gt;
...         sys.exit()&lt;br/&gt;
...     # Make an absolute version of path.&lt;br/&gt;
...     # According to the invoking dir of wxGlade (which can be different&lt;br/&gt;
...     # from '.' if it is invoked from a shell script).&lt;br/&gt;
...     if len(args) == 1:&lt;br/&gt;
...         filename = args&lt;span&gt;&lt;span&gt;[0]&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;
...         if filename.startswith("file://"): filename = filename&lt;span&gt;&lt;span&gt;[7:]&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;
...         if not os.path.isabs(filename):&lt;br/&gt;
...             filename = os.path.join(os.getcwd(), filename)&lt;br/&gt;
...         filename = os.path.normpath(os.path.expanduser(filename))&lt;br/&gt;
...         options.filename = filename&lt;br/&gt;
...     else:&lt;br/&gt;
...         options.filename = None&lt;br/&gt;
...     # check parameters&lt;br/&gt;
...     #  - language&lt;br/&gt;
...     #     - one file            -&amp;gt; cmdline code generation&lt;br/&gt;
...     #     - no / &amp;gt; one files    -&amp;gt; usage&lt;br/&gt;
...     #  - no language            -&amp;gt; start gui&lt;br/&gt;
...     if options.language:&lt;br/&gt;
...         if len(args) == 1:&lt;br/&gt;
...             options.start_gui = False&lt;br/&gt;
...         elif len(args) == 0:&lt;br/&gt;
...             msg = &lt;/em&gt;("No wxg file given.\n")&lt;br/&gt;
...             logging.error(msg)&lt;br/&gt;
...             parser.print_help()&lt;br/&gt;
...             sys.exit(msg)&lt;br/&gt;
...         else:&lt;br/&gt;
...             msg = &lt;em&gt;("Too many wxg files given.\n")&lt;br/&gt;
...             logging.error(msg)&lt;br/&gt;
...             parser.print_help()&lt;br/&gt;
...             sys.exit(msg)&lt;br/&gt;
...     else:&lt;br/&gt;
...         options.start_gui = True&lt;br/&gt;
...     # check output path&lt;br/&gt;
...     if options.output:&lt;br/&gt;
...         options.output = os.path.normpath(os.path.expanduser(options.output))&lt;br/&gt;
...     return options&lt;br/&gt;
...&lt;br/&gt;
def command_line_code_generation(filename, language, out_path=None):&lt;br/&gt;
...     """Starts a code generator without starting the GUI.&lt;br/&gt;
...     filename: Name of wxg file to generate code from&lt;br/&gt;
...     language: Code generator language&lt;br/&gt;
...     out_path: output file / output directory"""&lt;br/&gt;
...     from xml_parse import CodeWriter&lt;br/&gt;
...     try:&lt;br/&gt;
...         if language not in common.code_writers:&lt;br/&gt;
...             raise ValueError('Code writer for "%s" is not available.'%language)&lt;br/&gt;
...         writer = common.code_writers&lt;span&gt;&lt;span&gt;[language]&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;
...         CodeWriter( writer=writer, input=filename, out_path=out_path )&lt;br/&gt;
...     except errors.WxgBaseException as inst:&lt;br/&gt;
...         logging.error(inst)&lt;br/&gt;
...         sys.exit(inst)&lt;br/&gt;
...     except Exception:&lt;br/&gt;
...         logging.error( &lt;/em&gt;("An exception occurred while generating the code for the application.\n"&lt;br/&gt;
...                          "If you think this is a wxGlade bug, please report it.") )&lt;br/&gt;
...         logging.exception(&lt;em&gt;('Internal Error'))&lt;br/&gt;
...         sys.exit(1)&lt;br/&gt;
...     sys.exit(0)&lt;br/&gt;
...&lt;br/&gt;
def _guiless_open_app(filename):&lt;br/&gt;
...     """Load a new wxGlade project&lt;br/&gt;
...     GUI-less version of main.wxGladeFrame._open_app().&lt;br/&gt;
...     Returns True if successful."""&lt;br/&gt;
...     import time&lt;br/&gt;
...     from xml.sax import SAXParseException&lt;br/&gt;
...     from xml_parse import XmlWidgetBuilder, XmlParsingError&lt;br/&gt;
...     error_msg = None&lt;br/&gt;
...     infile = None&lt;br/&gt;
...     start = time.time()&lt;br/&gt;
...     common.root.clear()&lt;br/&gt;
...     common.root.init()&lt;br/&gt;
...     try:&lt;br/&gt;
...         try:&lt;br/&gt;
...             logging.info( &lt;/em&gt;('Read wxGlade project from file "%s"'), filename )&lt;br/&gt;
...             input_file_version = None&lt;br/&gt;
...             if not isinstance(filename, list):&lt;br/&gt;
...                 common.root.filename = filename&lt;br/&gt;
...                 # decoding will done automatically by SAX XML library&lt;br/&gt;
...                 if compat.PYTHON2:&lt;br/&gt;
...                     infile = open(filename)&lt;br/&gt;
...                 else:&lt;br/&gt;
...                     infile = open(filename, "r", encoding="UTF8")&lt;br/&gt;
...                 if hasattr(infile, "seek"):&lt;br/&gt;
...                     # try to read file version number from the first few lines&lt;br/&gt;
...                     import re&lt;br/&gt;
...                     version_re = re.compile(r"&amp;lt;!-- generated by wxGlade (\d+).(\d+).(\d+)(\S&lt;em&gt;)\s&lt;/em&gt;")&lt;br/&gt;
...                     for n in range(3):&lt;br/&gt;
...                         match = version_re.match( infile.readline() )&lt;br/&gt;
...                         if match:&lt;br/&gt;
...                             major, minor, sub, extension = match.groups()&lt;br/&gt;
...                             input_file_version = (int(major), int(minor), int(major), extension)&lt;br/&gt;
...                             break&lt;br/&gt;
...                     infile.seek(0)&lt;br/&gt;
...             else:&lt;br/&gt;
...                 common.root.filename = None&lt;br/&gt;
...             p = XmlWidgetBuilder(filename, input_file_version)&lt;br/&gt;
...             if infile is not None:&lt;br/&gt;
...                 p.parse(infile)&lt;br/&gt;
...             else:&lt;br/&gt;
...                 p.parse_string(filename)&lt;br/&gt;
...                 filename = None&lt;br/&gt;
...         except (EnvironmentError, SAXParseException, XmlParsingError) as msg:&lt;br/&gt;
...             if config.debugging: raise&lt;br/&gt;
...             if infile is not None:&lt;br/&gt;
...                 error_msg = &lt;em&gt;("Error loading file %s:\n%s") % (filename, msg)&lt;br/&gt;
...             else:&lt;br/&gt;
...                 error_msg = &lt;/em&gt;("Error loading from a file-like object:\n%s") % msg&lt;br/&gt;
...         except Exception as inst:&lt;br/&gt;
...             if config.debugging: raise&lt;br/&gt;
...             if filename:&lt;br/&gt;
...                 fn = os.path.basename(filename).encode('ascii','replace')&lt;br/&gt;
...                 msg = &lt;em&gt;('loading file "%s"') % fn&lt;br/&gt;
...             else:&lt;br/&gt;
...                 msg = &lt;/em&gt;('loading from a file-like object')&lt;br/&gt;
...             error_msg = ("%s: %s" % (msg, inst))&lt;br/&gt;
...     finally:&lt;br/&gt;
...         if infile and filename:&lt;br/&gt;
...             infile.close()&lt;br/&gt;
...         if error_msg:&lt;br/&gt;
...             common.root.clear()&lt;br/&gt;
...             common.root.new()&lt;br/&gt;
...             common.root.saved = True&lt;br/&gt;
...             logging.error(error_msg)&lt;br/&gt;
...             return False&lt;br/&gt;
...     if common.root.is_template:&lt;br/&gt;
...         logging.info(&lt;em&gt;("Template loaded"))&lt;br/&gt;
...         common.root.template_data = template.Template(filename)&lt;br/&gt;
...         common.root.filename = None&lt;br/&gt;
...     end = time.time()&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Loading time: %.5f'), end - start)&lt;br/&gt;
...     common.root.saved = True&lt;br/&gt;
...     #common.property_panel.Raise()&lt;br/&gt;
...     duration = end - start&lt;br/&gt;
...     if filename:&lt;br/&gt;
...         logging.debug( &lt;em&gt;("Loaded %s in %.2f seconds") % (os.path.basename(filename), duration ))&lt;br/&gt;
...     else:&lt;br/&gt;
...         logging.debug( &lt;/em&gt;("Loaded in %.2f seconds") % duration )&lt;br/&gt;
...     return True&lt;br/&gt;
...&lt;br/&gt;
def command_line_code_generation(filename, language, out_path=None):&lt;br/&gt;
...     """Starts a code generator without starting the GUI.&lt;br/&gt;
...     filename: Name of wxg file to generate code from&lt;br/&gt;
...     language: Code generator language&lt;br/&gt;
...     out_path: output file / output directory"""&lt;br/&gt;
...     import application, tree&lt;br/&gt;
...     # Instead of instantiating a main.wxGlade() object, that is&lt;br/&gt;
...     # derived from wx.App, we must do the equivalent work.  The&lt;br/&gt;
...     # following lines are taken from main.wxGlade().OnInit() and&lt;br/&gt;
...     # main.wxGladeFrame.&lt;strong&gt;init&lt;/strong&gt;()&lt;br/&gt;
...     common.init_preferences()&lt;br/&gt;
...     common.root = app = application.Application()&lt;br/&gt;
...     # Now we can load the file&lt;br/&gt;
...     if filename is not None:&lt;br/&gt;
...         b = &lt;em&gt;guiless_open_app(filename)&lt;br/&gt;
...         if not b:&lt;br/&gt;
...             sys.exit(1)&lt;br/&gt;
...     try:&lt;br/&gt;
...         if language not in common.code_writers:&lt;br/&gt;
...             raise ValueError('Code writer for "%s" is not available.'%language)&lt;br/&gt;
...         common.root.properties&lt;span&gt;&lt;span&gt;["language"]&lt;/span&gt;&lt;/span&gt;.set(language)&lt;br/&gt;
...         common.root.generate_code(out_path=out_path)&lt;br/&gt;
...     #except errors.WxgBaseException as inst:&lt;br/&gt;
...         #if config.debugging: raise&lt;br/&gt;
...         #logging.error(inst)&lt;br/&gt;
...         #sys.exit(inst)&lt;br/&gt;
...     except Exception:&lt;br/&gt;
...         if config.debugging: raise&lt;br/&gt;
...         logging.error( &lt;/em&gt;("An exception occurred while generating the code for the application.\n"&lt;br/&gt;
...                          "If you think this is a wxGlade bug, please report it.") )&lt;br/&gt;
...         logging.exception(&lt;em&gt;('Internal Error'))&lt;br/&gt;
...         sys.exit(1)&lt;br/&gt;
...     if not config.testing:&lt;br/&gt;
...         sys.exit(0)&lt;br/&gt;
...&lt;br/&gt;
def init_stage1(options):&lt;br/&gt;
...     """Initialise paths for wxGlade (first stage)&lt;br/&gt;
...     Initialisation is split because the test suite doesn't work with proper initialised paths."""&lt;br/&gt;
...     config.version = config.get_version()&lt;br/&gt;
...     common.init_paths(options)&lt;br/&gt;
...     # initialise own logging extensions&lt;br/&gt;
...     log.init(filename=config.log_file, encoding='utf-8',&lt;br/&gt;
...              level='DEBUG' if config.debugging else 'INFO')&lt;br/&gt;
...     atexit.register(log.deinit)&lt;br/&gt;
...     # print versions&lt;br/&gt;
...     logging.info( &lt;/em&gt;('Starting wxGlade version "%s" on Python %s'), config.version, config.py_version )&lt;br/&gt;
...     # print used paths&lt;br/&gt;
...     logging.debug(&lt;em&gt;('Base directory:             %s'), config.wxglade_path)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Documentation directory:    %s'), config.docs_path)&lt;br/&gt;
...     logging.debug(&lt;em&gt;('Icons directory:            %s'), config.icons_path)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Build-in widgets directory: %s'), config.widgets_path)&lt;br/&gt;
...     logging.debug(&lt;em&gt;('Template directory:         %s'), config.templates_path)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Credits file:               %s'), config.credits_file)&lt;br/&gt;
...     logging.debug(&lt;em&gt;('License file:               %s'), config.license_file)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Manual file:                %s'), config.manual_file)&lt;br/&gt;
...     logging.debug(&lt;em&gt;('Tutorial file:              %s'), config.tutorial_file)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Home directory:             %s'), config.home_path)&lt;br/&gt;
...     logging.debug(&lt;em&gt;('Application data directory: %s'), config.appdata_path)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Configuration file:         %s'), config.rc_file)&lt;br/&gt;
...     logging.debug(&lt;em&gt;('History file:               %s'), config.history_file)&lt;br/&gt;
...     logging.debug(&lt;/em&gt;('Log file:                   %s'), config.log_file)&lt;br/&gt;
...     # adapt application search path&lt;br/&gt;
...     sys.path.insert(0, config.wxglade_path)&lt;br/&gt;
...     sys.path.insert(1, config.widgets_path)&lt;br/&gt;
...&lt;br/&gt;
def init_stage2(use_gui):&lt;br/&gt;
...     """Initialise the remaining (non-path) parts of wxGlade (second stage)&lt;br/&gt;
...     use_gui: Starting wxGlade GUI"""&lt;br/&gt;
...     config.use_gui = use_gui&lt;br/&gt;
...     if use_gui:&lt;br/&gt;
...         # import proper wx-module using wxversion, which is only available in Classic&lt;br/&gt;
...         if compat.IS_CLASSIC:&lt;br/&gt;
...             if not hasattr(sys, "frozen") and 'wx' not in sys.modules:&lt;br/&gt;
...                 try:&lt;br/&gt;
...                     import wxversion&lt;br/&gt;
...                     wxversion.ensureMinimal('2.8')&lt;br/&gt;
...                 except ImportError:&lt;br/&gt;
...                     msg = &lt;em&gt;('Please install missing Python module "wxversion".')&lt;br/&gt;
...                     logging.error(msg)&lt;br/&gt;
...                     sys.exit(msg)&lt;br/&gt;
...         try:&lt;br/&gt;
...             import wx&lt;br/&gt;
...         except ImportError:&lt;br/&gt;
...             msg = &lt;/em&gt;('Please install missing Python module "wxPython".')&lt;br/&gt;
...             logging.error(msg)&lt;br/&gt;
...             sys.exit(msg)&lt;br/&gt;
...         # store current version and platform ('not_set' is default)&lt;br/&gt;
...         config.platform = wx.Platform&lt;br/&gt;
...         config.wx_version = wx.&lt;strong&gt;version&lt;/strong&gt;&lt;br/&gt;
...         if sys.platform=="win32":&lt;br/&gt;
...             # register ".wxg" extension&lt;br/&gt;
...             try:&lt;br/&gt;
...                 import msw&lt;br/&gt;
...                 msw.register_extensions(&lt;span&gt;["wxg"]&lt;/span&gt;, "wxGlade")&lt;br/&gt;
...                 if not os.path.exists(config.rc_file):&lt;br/&gt;
...                     config.inform_screen_reader = msw.check_for_screen_reader()&lt;br/&gt;
...             except ImportError:&lt;br/&gt;
...                 pass&lt;br/&gt;
...         # codewrites, widgets and sizers are loaded in class main.wxGladeFrame&lt;br/&gt;
...     else:&lt;br/&gt;
...         # use_gui has to be set before importing config&lt;br/&gt;
...         common.init_preferences()&lt;br/&gt;
...         common.init_codegen()&lt;br/&gt;
...&lt;br/&gt;
def run_main():&lt;br/&gt;
...     "This main procedure is started by calling either wxglade.py or wxglade.pyw on windows."&lt;br/&gt;
...     # check command line parameters first&lt;br/&gt;
...     options = parse_command_line()&lt;br/&gt;
...     # initialise wxGlade (first stage and second stage)&lt;br/&gt;
...     init_stage1(options)&lt;br/&gt;
...     init_stage2(options.start_gui)&lt;br/&gt;
...     if options.start_gui:&lt;br/&gt;
...         # late import of main (imported wx) for using wxversion  in init_stage2()&lt;br/&gt;
...         import main&lt;br/&gt;
...         main.main(options.filename)&lt;br/&gt;
...     else:&lt;br/&gt;
...         command_line_code_generation( filename=options.filename, language=options.language, out_path=options.output )&lt;br/&gt;
...&lt;br/&gt;
if &lt;strong&gt;name&lt;/strong&gt; == "&lt;strong&gt;main&lt;/strong&gt;":&lt;br/&gt;
...     run_main()&lt;br/&gt;
...&lt;br/&gt;
Traceback (most recent call last):&lt;br/&gt;
  File "&amp;lt;stdin&amp;gt;", line 2, in &amp;lt;module&amp;gt;&lt;br/&gt;
  File "&amp;lt;stdin&amp;gt;", line 4, in run_main&lt;br/&gt;
  File "&amp;lt;stdin&amp;gt;", line 12, in parse_command_line&lt;br/&gt;
NameError: name 'config' is not defined&lt;br/&gt;
&amp;lt;/stdin&amp;gt;&amp;lt;/stdin&amp;gt;&amp;lt;/module&amp;gt;&amp;lt;/stdin&amp;gt;&amp;lt;/wxg&amp;gt;&amp;lt;/options&amp;gt;&amp;lt;/wxg&amp;gt;&amp;lt;/module&amp;gt;&amp;lt;/stdin&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;&lt;/div&gt;</summary></entry><entry><title> NameError: name'config' is not defined, etc.</title><link href="https://sourceforge.net/p/wxglade/bugs/247/" rel="alternate"/><published>2021-12-18T12:05:55.306000Z</published><updated>2021-12-18T12:05:55.306000Z</updated><author><name>GAM</name><uri>https://sourceforge.net/u/ry1234/</uri></author><id>https://sourceforge.netbcbd60a738138c088c14faab378ad0ffc66650eb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ticket 247 has been modified:  NameError: name'config' is not defined, etc.&lt;br/&gt;
Edited By: Dietmar Schwertberger (dschwertberger)&lt;br/&gt;
Status updated: 'open' =&amp;gt; 'closed'&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>#246 Unexpected Error Occurred</title><link href="https://sourceforge.net/p/wxglade/bugs/246/?limit=25#febc" rel="alternate"/><published>2021-08-08T10:12:35.483000Z</published><updated>2021-08-08T10:12:35.483000Z</updated><author><name>Dietmar Schwertberger</name><uri>https://sourceforge.net/u/dschwertberger/</uri></author><id>https://sourceforge.net428baff7252904729694ef3cabb4fe51be8ee0d2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;: open --&amp;gt; closed&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary></entry></feed>