A problem with Python

For scripts to aid with computation or simulation in cellular automata.
User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Post by gameoflifemaniac » September 15th, 2018, 3:50 am

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.
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » September 15th, 2018, 9:40 am

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?

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Post by gameoflifemaniac » September 15th, 2018, 10:57 am

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?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » September 15th, 2018, 12:55 pm

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.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Post by gameoflifemaniac » September 15th, 2018, 1:18 pm

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?
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » September 15th, 2018, 2:44 pm

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.

User avatar
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Post by gameoflifemaniac » September 15th, 2018, 3:04 pm

It just can't load the Python library.
I was so socially awkward in the past and it will haunt me for the rest of my life.

Code: Select all

b4o25bo$o29bo$b3o3b3o2bob2o2bob2o2bo3bobo$4bobo3bob2o2bob2o2bobo3bobo$
4bobo3bobo5bo5bo3bobo$o3bobo3bobo5bo6b4o$b3o3b3o2bo5bo9bobo$24b4o!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » September 15th, 2018, 3:28 pm

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.

dani
Posts: 1222
Joined: October 27th, 2017, 3:43 pm

Re: A problem with Python

Post by dani » September 19th, 2018, 5:17 am

Why does running a Python script close golly for me?

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » September 19th, 2018, 12:24 pm

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).

wildmyron
Posts: 1542
Joined: August 9th, 2013, 12:45 am
Location: Western Australia

Re: A problem with Python

Post by wildmyron » September 19th, 2018, 10:09 pm

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.
The 5S project (Smallest Spaceships Supporting Specific Speeds) is now maintained by AforAmpere. The latest collection is hosted on GitHub and contains well over 1,000,000 spaceships.

Semi-active here - recovering from a severe case of LWTDS.

User avatar
Hdjensofjfnen
Posts: 1742
Joined: March 15th, 2016, 6:41 pm
Location: re^jθ

Re: A problem with Python

Post by Hdjensofjfnen » January 21st, 2019, 2:57 pm

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.

Code: Select all

x = 5, y = 9, rule = B3-jqr/S01c2-in3
3bo$4bo$o2bo$2o2$2o$o2bo$4bo$3bo!

Code: Select all

x = 7, y = 5, rule = B3/S2-i3-y4i
4b3o$6bo$o3b3o$2o$bo!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » January 21st, 2019, 3:24 pm

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.

User avatar
Hdjensofjfnen
Posts: 1742
Joined: March 15th, 2016, 6:41 pm
Location: re^jθ

Re: A problem with Python

Post by Hdjensofjfnen » January 22nd, 2019, 4:46 pm

Turns out apparently I can install it without admin intervention, but the progress bar in the executable is stuck at 0%. :?

Code: Select all

x = 5, y = 9, rule = B3-jqr/S01c2-in3
3bo$4bo$o2bo$2o2$2o$o2bo$4bo$3bo!

Code: Select all

x = 7, y = 5, rule = B3/S2-i3-y4i
4b3o$6bo$o3b3o$2o$bo!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: A problem with Python

Post by dvgrn » January 22nd, 2019, 5:13 pm

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.

Post Reply