Don't fail if we can't create startup file
Fixes https://gitlab.com/kicad/code/kicad/issues/9205
This commit is contained in:
parent
73401932f7
commit
38cdc362a0
|
@ -49,21 +49,24 @@ class KiCadPyShell(KiCadEditorNotebookFrame):
|
|||
|
||||
# Check if startup script exists
|
||||
if not os.path.isfile(self.startup_file):
|
||||
# Not, so create a default.
|
||||
default_startup = open(self.startup_file, 'w')
|
||||
# provide the content for the default startup file.
|
||||
default_startup.write(
|
||||
"### DEFAULT STARTUP FILE FOR KiCad Python Shell\n" +
|
||||
"# Enter any Python code you would like to execute when" +
|
||||
" the PCBNEW python shell first runs.\n" +
|
||||
"\n" +
|
||||
"# For example, uncomment the following lines to import the current board\n" +
|
||||
"\n" +
|
||||
"# import pcbnew\n" +
|
||||
"# import eeschema\n" +
|
||||
"# board = pcbnew.GetBoard()\n" +
|
||||
"# sch = eeschema.GetSchematic()\n")
|
||||
default_startup.close()
|
||||
# Not, so try to create a default.
|
||||
try:
|
||||
default_startup = open(self.startup_file, 'w')
|
||||
# provide the content for the default startup file.
|
||||
default_startup.write(
|
||||
"### DEFAULT STARTUP FILE FOR KiCad Python Shell\n" +
|
||||
"# Enter any Python code you would like to execute when" +
|
||||
" the PCBNEW python shell first runs.\n" +
|
||||
"\n" +
|
||||
"# For example, uncomment the following lines to import the current board\n" +
|
||||
"\n" +
|
||||
"# import pcbnew\n" +
|
||||
"# import eeschema\n" +
|
||||
"# board = pcbnew.GetBoard()\n" +
|
||||
"# sch = eeschema.GetSchematic()\n")
|
||||
default_startup.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def _setup(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue