Page 2 of 2

Re: A problem with Python

Posted: September 15th, 2018, 3:50 am
by gameoflifemaniac
Ok. Python finally started working, but some scripts don't work. When I run a rule generator, it says something like 'no module called ReadRuleTable'. But the files are in the glife folder! What is going on?
I have Python 2.7.15.

Re: A problem with Python

Posted: September 15th, 2018, 9:40 am
by dvgrn
gameoflifemaniac wrote:Ok. Python finally started working, but some scripts don't work. When I run a rule generator, it says something like 'no module called ReadRuleTable'. But the files are in the glife folder! What is going on?
I have Python 2.7.15.
When the error message comes up, you can hit "Ctrl+C" and get the actual text of the error message copied to the clipboard (not a screenshot) -- on Windows, anyway. If you quote that text, it's a lot more helpful than a report of "something like" the error message.

1) What version of Golly did you end up with, and is it 32-bit or 64-bit?
2) Exactly which rule generator script did you try to run?

Re: A problem with Python

Posted: September 15th, 2018, 10:57 am
by gameoflifemaniac
dvgrn wrote:
gameoflifemaniac wrote:Ok. Python finally started working, but some scripts don't work. When I run a rule generator, it says something like 'no module called ReadRuleTable'. But the files are in the glife folder! What is going on?
I have Python 2.7.15.
When the error message comes up, you can hit "Ctrl+C" and get the actual text of the error message copied to the clipboard (not a screenshot) -- on Windows, anyway. If you quote that text, it's a lot more helpful than a report of "something like" the error message.

1) What version of Golly did you end up with, and is it 32-bit or 64-bit?
2) Exactly which rule generator script did you try to run?
Lol it works now
I tried Python 2.7.15 for Golly 3.2 and it didn't work. Why?

Re: A problem with Python

Posted: September 15th, 2018, 12:55 pm
by dvgrn
gameoflifemaniac wrote:
dvgrn wrote:1) What version of Golly did you end up with, and is it 32-bit or 64-bit?
2) Exactly which rule generator script did you try to run?
Lol it works now
I tried Python 2.7.15 for Golly 3.2 and it didn't work. Why?
I asked first. To be fair, you did answer over thirty-three percent of my questions, but that's not enough to have much hope of answering your question.

Re: A problem with Python

Posted: September 15th, 2018, 1:18 pm
by gameoflifemaniac
dvgrn wrote:
gameoflifemaniac wrote:
dvgrn wrote:1) What version of Golly did you end up with, and is it 32-bit or 64-bit?
2) Exactly which rule generator script did you try to run?
Lol it works now
I tried Python 2.7.15 for Golly 3.2 and it didn't work. Why?
I asked first. To be fair, you did answer over thirty-three percent of my questions, but that's not enough to have much hope of answering your question.
Fine...
1) Golly 2.8 32-bit
2) None worked so that didn't matter.
EDIT: Ok, I know it's because for 64-bit Golly 3.2 I need 64-bit Python.
EDIT 2: I downloaded the 32-bit version of Golly 3.2, and Python still doesn't work. Why?

Re: A problem with Python

Posted: September 15th, 2018, 2:44 pm
by dvgrn
gameoflifemaniac wrote:EDIT 2: I downloaded the 32-bit version of Golly 3.2, and Python still doesn't work. Why?
Not sure. From what you've said I can deduce with about 90% confidence that
  • 32-bit Python 2.7.15 is working on your 32-bit install of Golly 2.8, including running rule generator scripts.
    (Good -- about time!)
  • 32-bit Python 2.7.15 is apparently not working on your 32-bit install of Golly 3.2.
Please confirm. Then... what happens when you try to run, say, heisenburp.py from the Scripts/Python folder, using Golly 3.2? Please quote specific error messages if you get any.

Re: A problem with Python

Posted: September 15th, 2018, 3:04 pm
by gameoflifemaniac
It just can't load the Python library.

Re: A problem with Python

Posted: September 15th, 2018, 3:28 pm
by dvgrn
gameoflifemaniac wrote:It just can't load the Python library.
Hm, I can't think of any differences in Golly's Python handling between 2.8 and 3.2 that would cause any kind of trouble like that.

So my speculation would be that Golly 3.2 is finding a GollyPrefs file somewhere that's telling Golly to look in the wrong place for a Python dll. If you have a GollyPrefs file in your Golly 2.8 folder, and another GollyPrefs in your {username}/AppData/Roaming/Golly folder, for example, then maybe something like that could happen.

If you're in the mood to experiment, go into your 32-bit Golly 2.8 folder and rename the Golly.exe file there to something else, like "Golly.exp". Then copy in the Golly.exe from your 32-bit Golly 3.2 folder and try running it from there.

Better would be to do a search of your hard drive for all GollyPrefs files, and rename all the ones that you don't think you're using for anything -- call them, say, GollyPrefs.bak. See if Golly 3.2 is happier after that.

I'm suggesting renaming -- and also carefully making a list of the full path and file name of every file you rename, before and after you rename it -- because I definitely don't want your Golly 2.8 to stop working again! As long as you can rename everything back to exactly the way it is now, then any experiments should be safe and temporary.

Re: A problem with Python

Posted: September 19th, 2018, 5:17 am
by dani
Why does running a Python script close golly for me?

Re: A problem with Python

Posted: September 19th, 2018, 12:24 pm
by dvgrn
danny wrote:Why does running a Python script close golly for me?
I forget now which of the permutations of 32-bit vs. 64-bit Python vs. Golly causes that behavior, but it's worth checking the GollyPrefs that Golly is using, and making sure it's really pointing to a Python DLL that matches the bittitude of the Golly executable.

Can't think of anything else offhand, but keep posting if the mystery continues (with the usual tedious OS, Golly, and Python details).

Re: A problem with Python

Posted: September 19th, 2018, 10:09 pm
by wildmyron
danny wrote:Why does running a Python script close golly for me?
Does your script perhaps have an exit() or quit() in place of g.exit()?
I don't know how exactly Golly deals with embedded Python and the exception that is raised by exit()/quit, but from testing there are certain scenarios where it can cause the Golly app to close.

Re: A problem with Python

Posted: January 21st, 2019, 2:57 pm
by Hdjensofjfnen
I have my own problem:
Golly warning: wrote:The Python library does not have this symbol:
Py_InitModule4
Since I am not an administrator on my Windows computer I can't uninstall Python 3 from my computer.

Re: A problem with Python

Posted: January 21st, 2019, 3:24 pm
by dvgrn
Hdjensofjfnen wrote:I have my own problem:
Golly warning: wrote:The Python library does not have this symbol:
Py_InitModule4
Since I am not an administrator on my Windows computer I can't uninstall Python 3 from my computer.
The admin vs. non-admin detail might or might not be an issue.

I've had no difficulty having Python 2.7.x and Python 3.x installed on the same computer.
M.I. Wright reported the same error message, several years ago, and it seemed to have to do with Python 3.x being the only version installed.

So if you can get an admin to install Python 2.7.x on your system -- 32-bit or 64-bit, depending on what flavor of Golly you want to be running -- then Python scripts ought to start working for you.

Re: A problem with Python

Posted: January 22nd, 2019, 4:46 pm
by Hdjensofjfnen
Turns out apparently I can install it without admin intervention, but the progress bar in the executable is stuck at 0%. :?

Re: A problem with Python

Posted: January 22nd, 2019, 5:13 pm
by dvgrn
Hdjensofjfnen wrote:Turns out apparently I can install it without admin intervention, but the progress bar in the executable is stuck at 0%. :?
You can run the executable all right, and pick a folder for installation. But without admin rights, when the installer tries to write the first file it's probably stuck trying to display a pop-up "Sign in as admin" window ... that for whatever reason you can't see.