Golly with Python 3?
Golly with Python 3?
Python 2 is unmaintained after 2020. After that no updates would be available, including security updates.
Are there any plans wmigrate Golly to use Python 3?
AFAIK Python3's core is embeddable, thus there should not be any problem of finding a shared library...
Edit: Apparantly embedding the python interpreter itself is nontrivial, but there's an embeddable zip file for windows users, which seems to have most of the shared library problems.
Are there any plans wmigrate Golly to use Python 3?
AFAIK Python3's core is embeddable, thus there should not be any problem of finding a shared library...
Edit: Apparantly embedding the python interpreter itself is nontrivial, but there's an embeddable zip file for windows users, which seems to have most of the shared library problems.
Last edited by Scorbie on September 27th, 2019, 4:22 am, edited 1 time in total.
Re: Golly with Python 3?
I think the current status is that there are no plans to migrate Golly to Python 3. It was Andrew Trevorrow who implemented Python 2 originally, but he much prefers Lua to Python 3 and has no plans to continue working on Python support (see his message here). But he's happy for Golly to have Python 3 support if someone else does the work.
Personally I'd like to see Python support continued in Golly since it's a much more widely used language than Lua and would make Golly scripting accessible to a wider range of people.
I made a brief attempt to do the work myself, but quickly realised the work was well beyond my rather shallow amount of C++ knowledge.
It's tempting to suggest a community project to get the work done. But I don't think it's the kind of project which can be completed by many people making small contributions. I think we might be stuck waiting around until some hero comes along and does all the work.
Personally I'd like to see Python support continued in Golly since it's a much more widely used language than Lua and would make Golly scripting accessible to a wider range of people.
I made a brief attempt to do the work myself, but quickly realised the work was well beyond my rather shallow amount of C++ knowledge.
It's tempting to suggest a community project to get the work done. But I don't think it's the kind of project which can be completed by many people making small contributions. I think we might be stuck waiting around until some hero comes along and does all the work.
Re: Golly with Python 3?
Thanks for informing me the current status. I'll try to build it myself and see how it goes.
Edit: Is there a git repo for Golly?
Edit2: @dvgrn thanks!
Edit: Is there a git repo for Golly?
Edit2: @dvgrn thanks!
Last edited by Scorbie on September 23rd, 2019, 9:46 pm, edited 1 time in total.
Re: Golly with Python 3?
Yes -- see here:Scorbie wrote:Thanks for informing me the current status. I'll try to build it myself and see how it goes.
Edit: Is there a git repo for Golly?
Code: Select all
git clone https://git.code.sf.net/p/golly/code golly-code
Re: Golly with Python 3?
Here's the git diff. I failed to compile the Lua part (I use MSYS2 on Windows, long story), but the Python part seems okay. If this works as intended, this should be both python2 and python3 compatible.
I just edited two files, so maybe it's better to just look at the diff...
(Git diff, makefile only changed for gtk)
(Fixing some issues...)
I just edited two files, so maybe it's better to just look at the diff...
(Git diff, makefile only changed for gtk)
(Fixing some issues...)
Re: Golly with Python 3?
Apologies for the hasty previous message. Apparantly that did not work on a proper environment...
I am currently working on this on a linux machine.
Here's the current WIP source: (Google drive link)
Only two changes:
At least it doesn't segfault whenever I launch a script.
I haven't tested on other linux devices and other python3 minor versions, but theoretically it should work... which doesn't mean anything, of course.
I am currently working on this on a linux machine.
Here's the current WIP source: (Google drive link)
Only two changes:
- gui-wx/wxpython.cpp is changed
- and gui-wx/makefile-gtk-python3 is made from makefile-gtk.
- If you compile with makefile-gtk, Golly will use Python 2.
- If you compile with makefile-gtk-python3, Golly will use Python 3.
(with debug symbols on; I put -g3 on CXXFLAGS.) - Golly crashes when the python shared library in GollyPrefs file is incompatible, so make sure to put it away and make a backup of it.
At least it doesn't segfault whenever I launch a script.
I haven't tested on other linux devices and other python3 minor versions, but theoretically it should work... which doesn't mean anything, of course.
Re: Golly with Python 3?
In a moment of wild optimism I tried doing a Windows build using the above changes -- Python 3.8 32-bit, and wxWidgets 3.1.3.
local-win.mk:
... and the wxpython.cpp supplied above. I didn't expect it to work at all, and so it worked somewhat better than I expected. Compilation got all the way to the linking stage, and then ran into
Interestingly enough, a top-three Google match for this error message is a time when Tim Hutton was having Windows Golly compile problems... in 2008.
Would anyone like to collaborate on getting Golly-with-Python-3.x to build in Windows and/or Mac, and maybe even solve the problem Scorbie mentioned of why the Esc key doesn't work in the Linux version?
Once there's a working build, I can get started on porting Golly scripts to Python 3. But I'm not going to be very efficient at solving this kind of cross-platform issue, especially with the tools I have available at the moment. In point of fact if I try to fix it I'll almost certainly just make it worse. I'll try eventually, but will have to wait a few weeks or months for my next burst of unwarranted optimism.
Full output from compilation looked like this:
local-win.mk:
Code: Select all
# makefile-win includes local-win.mk, so create a copy of this file
# and call it local-win.mk, then make any desired changes.
# Change the next 2 lines to specify where you installed wxWidgets:
!include <C:/wxWidgets-3.1.3/build/msw/config.vc>
WX_DIR = C:\wxWidgets-3.1.3
# Change the next line to match your wxWidgets version (first two digits):
WX_RELEASE = 31
# LUA_DEFS = -DLUA_COMPAT_5_2
# Uncomment the next line if building a 32-bit version of Golly:
LUA_DEFS = -DLUA_COMPAT_5_2 -DLUA_32BITS
# Change the next line depending on where you installed Python:
PYTHON_INCLUDE = -I"C:\Python38-32\include"
# Uncomment the next 4 lines to allow Golly to run Perl scripts:
# PERL_INCLUDE = \
# -DENABLE_PERL \
# -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT \
# -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -I"C:\Perl514-64\lib\CORE"
# Uncomment the next line to allow Golly to play sounds:
#ENABLE_SOUND = 1
# Change the next line to specify where you installed IrrKLang
IRRKLANGDIR = C:\irrKlang-64bit-1.6.0
# Add any extra CXX flags here
EXTRACXXFLAGS =
Code: Select all
wxpython.obj : error LNK2019: unresolved external symbol __Py_Dealloc referenced in function "struct _object * __cdecl py_getrect(struct _object *,struct _object *)" (?py_getrect@@YAPAU_object@@PAU1@0@Z)
wxpython.obj : error LNK2019: unresolved external symbol _PyModule_Create2 referenced in function "struct _object * __cdecl PyInit_golly(void)" (?PyInit_golly@@YAPAU_object@@XZ)
wxpython.obj : error LNK2019: unresolved external symbol _PyImport_AppendInittab referenced in function "bool __cdecl InitPython(void)" (?InitPython@@YA_NXZ)
..\Golly.exe : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\link.EXE"' : return code '0x460'
Stop.
Would anyone like to collaborate on getting Golly-with-Python-3.x to build in Windows and/or Mac, and maybe even solve the problem Scorbie mentioned of why the Esc key doesn't work in the Linux version?
Once there's a working build, I can get started on porting Golly scripts to Python 3. But I'm not going to be very efficient at solving this kind of cross-platform issue, especially with the tools I have available at the moment. In point of fact if I try to fix it I'll almost certainly just make it worse. I'll try eventually, but will have to wait a few weeks or months for my next burst of unwarranted optimism.
Full output from compilation looked like this:
Code: Select all
c:\repos\golly-code\gui-wx>nmake -f makefile-win BUILD=release RUNTIME_LIBS=static DEBUG_INFO=0 DEBUG_FLAG=0 UNICODE=1 USE_OPENGL=1
Microsoft (R) Program Maintenance Utility Version 14.12.25835.0
Copyright (C) Microsoft Corporation. All rights reserved.
mkdir ObjWin
cl /MP8 /FoObjWin/ /c /nologo /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 ..\gollybase/bigint.cpp ..\gollybase/lifealgo.cpp ..\gollybase/hlifealgo.cpp ..\gollybase/hlifedraw.cpp ..\gollybase/qlifealgo.cpp ..\gollybase/qlifedraw.cpp ..\gollybase/ltlalgo.cpp ..\gollybase/ltldraw.cpp ..\gollybase/jvnalgo.cpp ..\gollybase/ruletreealgo.cpp ..\gollybase/ruletable_algo.cpp ..\gollybase/ghashbase.cpp ..\gollybase/ruleloaderalgo.cpp ..\gollybase/ghashdraw.cpp ..\gollybase/readpattern.cpp ..\gollybase/writepattern.cpp ..\gollybase/liferules.cpp ..\gollybase/util.cpp ..\gollybase/liferender.cpp ..\gollybase/viewport.cpp ..\gollybase/lifepoll.cpp ..\gollybase/generationsalgo.cpp
bigint.cpp
lifealgo.cpp
hlifealgo.cpp
hlifedraw.cpp
qlifealgo.cpp
qlifedraw.cpp
ltlalgo.cpp
ltldraw.cpp
jvnalgo.cpp
ruletreealgo.cpp
ruletable_algo.cpp
ghashbase.cpp
ruleloaderalgo.cpp
ghashdraw.cpp
readpattern.cpp
writepattern.cpp
liferules.cpp
util.cpp
liferender.cpp
viewport.cpp
lifepoll.cpp
generationsalgo.cpp
cl /MP8 /FoObjWin/ /c /nologo /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 wxutils.cpp wxprefs.cpp wxalgos.cpp wxrule.cpp wxinfo.cpp wxhelp.cpp wxstatus.cpp wxedit.cpp wxcontrol.cpp wxtimeline.cpp wxundo.cpp wxlayer.cpp wxselect.cpp
wxutils.cpp
wxprefs.cpp
wxalgos.cpp
wxrule.cpp
wxinfo.cpp
wxhelp.cpp
wxstatus.cpp
wxedit.cpp
wxcontrol.cpp
wxtimeline.cpp
wxundo.cpp
wxlayer.cpp
wxselect.cpp
cl /MP8 /FoObjWin/ /c /nologo /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 -DLUA_COMPAT_5_2 -DLUA_32BITS /I..\lua wxoverlay.cpp wxlua.cpp wxfile.cpp wxmain.cpp wxrender.cpp wxscript.cpp wxview.cpp
wxoverlay.cpp
wxlua.cpp
wxfile.cpp
wxmain.cpp
wxrender.cpp
wxscript.cpp
wxview.cpp
cl /c /nologo /FoObjWin/wxperl.obj /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 wxperl.cpp
wxperl.cpp
cl /c /nologo /FoObjWin/wxpython.obj /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 -I"C:\Python38-32\include" wxpython.cpp
wxpython.cpp
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(182): warning C4005: 'PRIuPTR': macro redefinition
c:\repos\golly-code\gollybase\platform.h(36): note: see previous definition of 'PRIuPTR'
wxpython.cpp(3204): error C3861: 'Py_InitModule': identifier not found
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\cl.EXE"' : return code '0x2'
Stop.
c:\repos\golly-code\gui-wx>nmake -f makefile-win BUILD=release RUNTIME_LIBS=static DEBUG_INFO=0 DEBUG_FLAG=0 UNICODE=1 USE_OPENGL=1
Microsoft (R) Program Maintenance Utility Version 14.12.25835.0
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /nologo /FoObjWin/wxpython.obj /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 -I"C:\Python38-32\include" wxpython.cpp
wxpython.cpp
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt\inttypes.h(182): warning C4005: 'PRIuPTR': macro redefinition
c:\repos\golly-code\gollybase\platform.h(36): note: see previous definition of 'PRIuPTR'
cl /c /TP /nologo /FoObjWin/wxgolly.obj /MT /DWIN32 /Fdgolly.pdb /O2 /D__WXMSW__ /DwxDEBUG_LEVEL=0 /DNDEBUG /D_UNICODE /IC:\wxWidgets-3.1.3\include /IC:\wxWidgets-3.1.3\lib\vc_lib\mswu /W4 /wd4100 /I. /D_WINDOWS /IC:\wxWidgets-3.1.3\samples /DNOPCH /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /EHsc /DVERSION=3.4b1 /DZLIB /IC:\wxWidgets-3.1.3\src\zlib /I..\gollybase /wd4459 /wd4458 /wd4457 /wd4456 wxgolly.cpp
wxgolly.cpp
cd "..\lua"
cl /MP8 /MT /O2 /c /nologo -DLUA_COMPAT_5_2 -DLUA_32BITS *.c
lapi.c
lauxlib.c
lbaselib.c
lbitlib.c
lcode.c
lcorolib.c
lctype.c
ldblib.c
ldebug.c
ldo.c
ldump.c
lfunc.c
lgc.c
linit.c
liolib.c
llex.c
lmathlib.c
lmem.c
loadlib.c
lobject.c
lopcodes.c
loslib.c
lparser.c
lstate.c
lstring.c
lstrlib.c
ltable.c
ltablib.c
ltm.c
lundump.c
lutf8lib.c
lvm.c
lzio.c
cd "c:\repos\golly-code\gui-wx"
rc /fogolly.res /d WX_CPU_X86 /d WIN32 /d __WXMSW__ /d wxDEBUG_LEVEL=0 /d NDEBUG /d _UNICODE /i C:\wxWidgets-3.1.3\include /i C:\wxWidgets-3.1.3\lib\vc_lib\mswu /i . /d _WINDOWS /i C:\wxWidgets-3.1.3\samples /d NOPCH golly.rc
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
link /LARGEADDRESSAWARE /NOLOGO /OUT:..\Golly.exe /pdb:"golly.pdb" /MANIFEST:NO /LIBPATH:C:\wxWidgets-3.1.3\lib\vc_lib /SUBSYSTEM:WINDOWS ObjWin/bigint.obj ObjWin/lifealgo.obj ObjWin/hlifealgo.obj ObjWin/hlifedraw.obj ObjWin/qlifealgo.obj ObjWin/qlifedraw.obj ObjWin/ltlalgo.obj ObjWin/ltldraw.obj ObjWin/jvnalgo.obj ObjWin/ruletreealgo.obj ObjWin/ruletable_algo.obj ObjWin/ghashbase.obj ObjWin/ruleloaderalgo.obj ObjWin/ghashdraw.obj ObjWin/readpattern.obj ObjWin/writepattern.obj ObjWin/liferules.obj ObjWin/util.obj ObjWin/liferender.obj ObjWin/viewport.obj ObjWin/lifepoll.obj ObjWin/generationsalgo.obj ObjWin/wxutils.obj ObjWin/wxprefs.obj ObjWin/wxalgos.obj ObjWin/wxrule.obj ObjWin/wxinfo.obj ObjWin/wxhelp.obj ObjWin/wxstatus.obj ObjWin/wxview.obj ObjWin/wxoverlay.obj ObjWin/wxrender.obj ObjWin/wxscript.obj ObjWin/wxlua.obj ObjWin/wxperl.obj ObjWin/wxpython.obj ObjWin/wxfile.obj ObjWin/wxedit.obj ObjWin/wxcontrol.obj ObjWin/wxtimeline.obj ObjWin/wxundo.obj ObjWin/wxlayer.obj ObjWin/wxmain.obj ObjWin/wxselect.obj ObjWin/wxgolly.obj ..\lua\lapi.obj ..\lua\lauxlib.obj ..\lua\lbaselib.obj ..\lua\lbitlib.obj ..\lua\lcode.obj ..\lua\lcorolib.obj ..\lua\lctype.obj ..\lua\ldblib.obj ..\lua\ldebug.obj ..\lua\ldo.obj ..\lua\ldump.obj ..\lua\lfunc.obj ..\lua\lgc.obj ..\lua\linit.obj ..\lua\liolib.obj ..\lua\llex.obj ..\lua\lmathlib.obj ..\lua\lmem.obj ..\lua\loadlib.obj ..\lua\lobject.obj ..\lua\lopcodes.obj ..\lua\loslib.obj ..\lua\lparser.obj ..\lua\lstate.obj ..\lua\lstring.obj ..\lua\lstrlib.obj ..\lua\ltable.obj ..\lua\ltablib.obj ..\lua\ltm.obj ..\lua\lundump.obj ..\lua\lutf8lib.obj ..\lua\lvm.obj ..\lua\lzio.obj golly.res wxmsw31u_html.lib wxmsw31u_adv.lib wxmsw31u_core.lib wxbase31u.lib wxbase31u_net.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib wxmsw31u_gl.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib opengl32.lib
wxpython.obj : error LNK2019: unresolved external symbol __Py_Dealloc referenced in function "struct _object * __cdecl py_getrect(struct _object *,struct _object *)" (?py_getrect@@YAPAU_object@@PAU1@0@Z)
wxpython.obj : error LNK2019: unresolved external symbol _PyModule_Create2 referenced in function "struct _object * __cdecl PyInit_golly(void)" (?PyInit_golly@@YAPAU_object@@XZ)
wxpython.obj : error LNK2019: unresolved external symbol _PyImport_AppendInittab referenced in function "bool __cdecl InitPython(void)" (?InitPython@@YA_NXZ)
..\Golly.exe : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\link.EXE"' : return code '0x460'
Stop.
Re: Golly with Python 3?
Didn't realize there was any interest in moving to Python3 at all;
I'll get my hands on it and see if anything's working (Currently using Windows 10). Of course help from others would be thankful.
I'll get my hands on it and see if anything's working (Currently using Windows 10). Of course help from others would be thankful.
Re: Golly with Python 3?
Happy to help, but it would only be Mac/Linux from my end; got rid of all Windows some time ago.
Re: Golly with Python 3?
Working on it...
https://sourceforge.net/u/scorbie/golly ... hon3/tree/
Currently the build works okay, but running a script raises a mysterious StderrCatcherForGolly error.
Strange because manually embedding almost the same code outside of Golly ran perfectly okay.
Still working on it...
https://sourceforge.net/u/scorbie/golly ... hon3/tree/
Currently the build works okay, but running a script raises a mysterious StderrCatcherForGolly error.
Strange because manually embedding almost the same code outside of Golly ran perfectly okay.
Still working on it...
Re: Golly with Python 3?
Currently I got the gist of `gui-wx/wxpython.cpp` but would like to change the structure of this file to make my life a bit easier.
I'll ask permission from the devs from the mailing list if I can commit the changes to the main branch if I do so.
I'll elaborate technical details in the mailing list.
Edit: More thinking going on, now I get the design decisions for the current macro system in `wxpython.cpp`.
Will implement an improved system that aids debugging if I can manage to do so.
I'll ask permission from the devs from the mailing list if I can commit the changes to the main branch if I do so.
I'll elaborate technical details in the mailing list.
Edit: More thinking going on, now I get the design decisions for the current macro system in `wxpython.cpp`.
Will implement an improved system that aids debugging if I can manage to do so.
Re: Golly with Python 3?
Okay, currently the build seems to be working:
https://sourceforge.net/u/scorbie/golly ... hon3/tree/
Many thanks to Tomas Rokicki for the help and directions!
[Building caveats]
Windows users: I've changed local-win(-template).mk slightly so make sure you change it appropriately.
Linux users: Should probably work if you set the PYTHON variable in your local makefile template to your Python installation path.
Mac users: Should probably install Python3 and edit the build script using that Python installation path. May change linking to Python3 DLL dynamically.
[Running caveats]
I've experienced crashes when the Python DLL version in GollyPrefs did not match the Python version used in compiling Golly.
Better use a local GollyPrefs file at the same directory in Golly!
[Notes]
The build **should** work either with Python 2 or Python 3 (You just have to set the path to Python appropriately when compiling) but haven't tested for sure.
https://sourceforge.net/u/scorbie/golly ... hon3/tree/
Many thanks to Tomas Rokicki for the help and directions!
[Building caveats]
Windows users: I've changed local-win(-template).mk slightly so make sure you change it appropriately.
Linux users: Should probably work if you set the PYTHON variable in your local makefile template to your Python installation path.
Mac users: Should probably install Python3 and edit the build script using that Python installation path. May change linking to Python3 DLL dynamically.
[Running caveats]
I've experienced crashes when the Python DLL version in GollyPrefs did not match the Python version used in compiling Golly.
Better use a local GollyPrefs file at the same directory in Golly!
[Notes]
The build **should** work either with Python 2 or Python 3 (You just have to set the path to Python appropriately when compiling) but haven't tested for sure.
Re: Golly with Python 3?
I built Golly on my Mac with Python 2.7.10 using your wxpython.cpp. All the .py scripts I tested ran ok but I did notice a problem if a script had an error. For example, after editing bricklayer.py and changing "pattern" on line 18 to "patter" I got this error message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 18, in <module>
NameError: name 'patter' is not defined
If I run that same script in Golly built with the original wxpython.cpp then the error message has more details:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/HD/Golly/golly/Scripts/Python/bricklayer.py", line 18, in <module>
pre_lom = patter("2bo$2ob2o$2ob2o2$b2ob2o$b2ob2o$3bo!")
NameError: name 'patter' is not defined
I tracked down the difference to a change you made in RunPythonScript. Your code runs a script this way:
Code: Select all
wxString command = wxT("exec(open('") + fpath + wxT("').read(),{})");
Code: Select all
wxString command = wxT("execfile('") + fpath + wxT("',{})");
Re: Golly with Python 3?
This problem can be fixed by changing the way we execute python; instead of exec(open().read()) we need to stick a compile() in there. Easy to fix.
And yes, this is a change between Python2 and Python3; execfile is gone.
And yes, this is a change between Python2 and Python3; execfile is gone.