ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

A problem with Python

For scripts to aid with computation or simulation in cellular automata.

Re: A problem with Python

Postby 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.
https://www.youtube.com/watch?v=q6EoRBvdVPQ
One big dirty Oro. Yeeeeeeeeee...
User avatar
gameoflifemaniac
 
Posts: 726
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Postby 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
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: A problem with Python

Postby 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?
https://www.youtube.com/watch?v=q6EoRBvdVPQ
One big dirty Oro. Yeeeeeeeeee...
User avatar
gameoflifemaniac
 
Posts: 726
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Postby 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
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: A problem with Python

Postby 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?
https://www.youtube.com/watch?v=q6EoRBvdVPQ
One big dirty Oro. Yeeeeeeeeee...
User avatar
gameoflifemaniac
 
Posts: 726
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Postby 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
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: A problem with Python

Postby gameoflifemaniac » September 15th, 2018, 3:04 pm

It just can't load the Python library.
https://www.youtube.com/watch?v=q6EoRBvdVPQ
One big dirty Oro. Yeeeeeeeeee...
User avatar
gameoflifemaniac
 
Posts: 726
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Postby 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.
User avatar
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: A problem with Python

Postby danny » September 19th, 2018, 5:17 am

Why does running a Python script close golly for me?
she/they // Please stop using my full name. Refer to me as dani.

"I'm always on duty, even when I'm off duty." -Cody Kolodziejzyk, Ph.D.
User avatar
danny
 
Posts: 944
Joined: October 27th, 2017, 3:43 pm
Location: New Jersey, USA

Re: A problem with Python

Postby 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).
User avatar
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: A problem with Python

Postby 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 latest version of the 5S Project contains over 47,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1108
Joined: August 9th, 2013, 12:45 am

Re: A problem with Python

Postby 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.
Life is hard. Deal with it.
My favorite oscillator of all time:
x = 7, y = 5, rule = B3/S2-i3-y4i
4b3o$6bo$o3b3o$2o$bo!
User avatar
Hdjensofjfnen
 
Posts: 1079
Joined: March 15th, 2016, 6:41 pm
Location: r cis θ

Re: A problem with Python

Postby 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
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: A problem with Python

Postby 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%. :?
Life is hard. Deal with it.
My favorite oscillator of all time:
x = 7, y = 5, rule = B3/S2-i3-y4i
4b3o$6bo$o3b3o$2o$bo!
User avatar
Hdjensofjfnen
 
Posts: 1079
Joined: March 15th, 2016, 6:41 pm
Location: r cis θ

Re: A problem with Python

Postby 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.
User avatar
dvgrn
Moderator
 
Posts: 5615
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Previous

Return to Scripts

Who is online

Users browsing this forum: No registered users and 2 guests