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

A problem with Python

Post by gameoflifemaniac » February 5th, 2017, 2:23 pm

Now I downloaded the right version of Python (2.7.13), but it gives me the same error:
The Python library does not have this symbol:
Py_InitModule4
What to do?
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 » February 5th, 2017, 3:33 pm

gameoflifemaniac wrote:Now I downloaded the right version of Python (2.7.13), but it gives me the same error:
The Python library does not have this symbol:
Py_InitModule4
What to do?
More details would be good. What was the name of the Python installer executable that you downloaded?

On other threads there have been hints that you're running the default 32-bit download of Golly -- an error message referenced "..\golly-2.8-win-32bit\Scripts\Lua\". Is that still true? If not, what's the name of the Golly ZIP file that you downloaded?

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

Re: A problem with Python

Post by gameoflifemaniac » April 6th, 2017, 12:28 pm

Oh, I'm so sorry, I downloaded Python 2.7.11. And the ZIP file was called golly-2.8-win-32bit.
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 » April 6th, 2017, 12:52 pm

gameoflifemaniac wrote:Oh, I'm so sorry, I downloaded Python 2.7.11. And the ZIP file was called golly-2.8-win-32bit.
The question asked for the name of the Python installer executable. Without that, I don't know for absolutely sure that you haven't gotten hold of the 64-bit version of Python 2.7.11 by accident.

Try uninstalling 2.7.11, and install the 32-bit version of Python 2.7.13 instead.

The 64-bit Python 2.7.11 installer is configured incorrectly and causes Golly to crash and exit.

That's not the problem you're reporting, and I don't recall that there have been any issues with 32-bit 2.7.11 with 32-bit Golly.

But you might as well have a fresh try at installing the latest version of Python. The odds are still fairly good that that will make Python scripts Just Work for you.

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

Re: A problem with Python

Post by gameoflifemaniac » April 6th, 2017, 1:49 pm

But to make it work, what way should I select the features to be installed?
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 » April 6th, 2017, 2:15 pm

gameoflifemaniac wrote:But to make it work, what way should I select the features to be installed?
The installer's defaults are fine. Next > Next > Install (or whatever the buttons say).

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

Re: A problem with Python

Post by gameoflifemaniac » April 9th, 2017, 1:50 pm

Shit. I have 2.7.13, and it STILL doesn't work!
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 » April 9th, 2017, 1:57 pm

gameoflifemaniac wrote:Shit. I have 2.7.13, and it STILL doesn't work!
Please be more specific -- I know you know you did everything right, but what you actually post is too vague to tell if there's a mismatch somewhere.

1) What was the name of the Python installer executable that you downloaded and ran?

2) What happens when you try to run a Golly script after installing 32-bit Python 2.7.13? No error messages -- just the can't-find-the-DLL-so-you'll-have-to-cancel behavior?

3) Where do you find python27.dll, when you search in C:\Windows? (Don't bother looking for python2713.dll -- there ain't no such thing.)

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

Re: A problem with Python

Post by gameoflifemaniac » April 9th, 2017, 2:15 pm

1) python-2.7.13.msi
2) The Python library does not have this symbol:
Py_InitModule4
3)I found the DLL file in the folder 'Python27'
And, I found also the Python 3.4 file, even when I uninstalled it.
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 » April 9th, 2017, 2:36 pm

Thanks!
gameoflifemaniac wrote:3)I found the DLL file in the folder 'Python27'...
When you say something like this, you really mean either

"the folder C:\Python27"

or possibly

"the folder C:\Windows\Python27\"

but I wouldn't think it would be there. Are you looking at C:\Python27\? If so,

4) What is the full path to the DLL, including the filename? It's not just C:\Python27\python27.dll, is it?

Did you do a seach in C:\Windows\? You seem to have Python DLLs littering your machine in various places, which might account for the problems you're having I suppose. Hmm.

5) What is the date stamp on the DLL you found in the 'Python27' folder? This is to make sure the DLL was actually put there by the install that you just did. Otherwise you're still trying to point Golly to some old wrong version of Python.

As per this advice, the installer should really be adding a new python27.dll in either C:\Windows\System32\python27.dll or C:\Windows\SysWOW64\python27.dll. Unless there's something else I'm missing or forgetting, which unfortunately is always possible...!
gameoflifemaniac wrote:And, I found also the Python 3.4 file, even when I uninstalled it.
I haven't heard of any cases where parallel installs of Python 2.x and Python 3.x caused problems, as long as Golly is pointed at the correct DLL -- the one installed by the 32-bit 2.7.13 installer, in this case.

But of course there's always a first time. Except when there isn't. I'm still hoping there's a findable explanation of your troubles here.

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

Re: A problem with Python

Post by gameoflifemaniac » August 16th, 2017, 1:39 pm

3) C:\Python27\
4) Yes, it is the path, and no, I didn't search in C:/Windows.
5) The date stamp on the folder was 2017-04-07 17:49, and the date stamp on python27.dll was 2016-12-17 19:43!
And something more shocking: I found nothing Python-related in System32, but in SysWOW64 I found guess what...












the python34.dll file!
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
gameoflifemaniac
Posts: 1242
Joined: January 22nd, 2017, 11:17 am
Location: There too

Re: A problem with Python

Post by gameoflifemaniac » September 1st, 2017, 3:21 am

And, when I tried to run a Python script in the new Golly 3.0 version, it again showed this 'Could not load Python library' thingy, I typed in the correct path to the python27.dll file 'This computer\Windows (C:)\Python27\python27.dll' .......................................................(translated from Polish)
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 1st, 2017, 7:09 am

gameoflifemaniac wrote:And, when I tried to run a Python script in the new Golly 3.0 version, it again showed this 'Could not load Python library' thingy, I typed in the correct path to the python27.dll file 'This computer\Windows (C:)\Python27\python27.dll' .......................................................(translated from Polish)
and it didn't work! Why?
Thanks for the detail, and it looks like you're doing things right. This has been an unusually troublesome computer...

1) What was the name of the Golly 3.0 ZIP file you downloaded?
2) Can you find Start > Python 2.7 > Python (command line)?
If so, type

import sys; print sys.version

at the >>> command prompt, and hit [Enter]. What version number does it report, and does it say "32 bit" or "64 bit"?
(This probably won't tell us anything unexpected, it will just prove that Python works and it's the version we think it should be. From past reports, you do seem to have several versions of Python hanging around.)

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

Re: A problem with Python

Post by gameoflifemaniac » September 1st, 2017, 7:44 am

1) golly-3.0-win-64bit.zip
2) 2.7.13 32-bit. Oh...
EDIT: I already installed the 32-bit version, but did the same and Golly still couldn'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 1st, 2017, 10:04 am

gameoflifemaniac wrote:1) golly-3.0-win-64bit.zip
2) 2.7.13 32-bit. Oh...
EDIT: I already installed the 32-bit version, but did the same and Golly still couldn't load the Python library!
Bother. My theory was good, then, but the fix still hasn't been found. Anyone else have any better theories?

By "still couldn't load the Python library", do you mean that you're seeing the same symptom as before? And that's no error message, just a return to the dialog box that's asking for the path to python27?

Or have you now gone back to "The Python library does not have this symbol: Py_InitModule4"?

The next thing to try might be to close Golly, then search for your GollyPrefs file, and rename it to GollyPrefs.backup or something -- and maybe attach a copy here while you're at it. Then re-run Golly and try telling it about Python27.dll again.

However, I actually don't know what would cause your continuing symptoms, so I don't really expect that this will fix it.

With multiple rumored copies of Python floating around, I suppose we should make sure that the C:\Python27\python27.dll copy is really the 32-bit version that you're accessing via the command line. But theoretically, even if it's a rogue 64-bit version somehow, it should have worked with 64-bit Golly when you tried it (!)

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

Re: A problem with Python

Post by gameoflifemaniac » September 1st, 2017, 12:04 pm

I give up.
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
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: A problem with Python

Post by Saka » September 1st, 2017, 7:32 pm

I had a very similar problem like you, here's how I fixed it.
1. Delete all python and golly, including the one in %AppData%
2. Reinstall Python
3. Reinstall Golly and make sure it is the same bit version as python
4. Golly should be able to tun python

If that does not work, try flipping 2 and 3

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

Re: A problem with Python

Post by gameoflifemaniac » September 12th, 2018, 10:56 am

What version I have to install for Golly 2.8 (that's the version I'm using)?
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 12th, 2018, 11:18 am

gameoflifemaniac wrote:What version I have to install for Golly 2.8 (that's the version I'm using)?
It will be the same version of Python for any recent Golly release -- any 2.7.x version should be okay (except there were some problems with 2.7.11 if I remember right).

However, I'm curious as to why you don't go ahead and download Golly 3.2.

If you just click Download from Golly's main page, you'll get the 32-bit version of Golly 3.2 by default. You'll need 32-bit Python 2.7.15 (current Python 2.x stable release, 5/1/2018) to go with that version of Golly. That's the "Windows x86 MSI installer" link on the 2.7.15 page.

With Golly 3.x you also get the ability to run Lua scripts -- with no need for these silly headaches about what version of Python goes with what version of Golly. Lua doesn't need a separate install at all, it Just Works.

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

Re: A problem with Python

Post by gameoflifemaniac » September 12th, 2018, 11:43 am

dvgrn wrote:
gameoflifemaniac wrote:What version I have to install for Golly 2.8 (that's the version I'm using)?
It will be the same version of Python for any recent Golly release -- any 2.7.x version should be okay (except there were some problems with 2.7.11 if I remember right).

However, I'm curious as to why you don't go ahead and download Golly 3.2.

If you just click Download from Golly's main page, you'll get the 32-bit version of Golly 3.2 by default. You'll need 32-bit Python 2.7.15 (current Python 2.x stable release, 5/1/2018) to go with that version of Golly. That's the "Windows x86 MSI installer" link on the 2.7.15 page.

With Golly 3.x you also get the ability to run Lua scripts -- with no need for these silly headaches about what version of Python goes with what version of Golly. Lua doesn't need a separate install at all, it Just Works.
I have Golly 3.2, but I don't use it because all the patterns I saved are in the Golly 2.8 folder and I'm too lazy to copy all the files.
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
Macbi
Posts: 903
Joined: March 29th, 2009, 4:58 am

Re: A problem with Python

Post by Macbi » September 12th, 2018, 11:55 am

Is there a "proper" way to update Golly without losing all your files and settings?

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 12th, 2018, 12:30 pm

Macbi wrote:Is there a "proper" way to update Golly without losing all your files and settings?
Here's the official recommendation from Golly Help > Hints and Tips:
Avoid the temptation to put your own patterns, scripts or rules inside Golly's supplied folders — it will make it difficult to upgrade to a future version. A much better idea is to create separate folders for your own files and put those folders alongside the supplied folders, so your Golly folder looks something like this:
Golly
Golly.exe
(Golly.app on Mac, golly on Linux)
Help
Patterns
Rules
Scripts
My-downloads
(contains all your downloaded files; set in Preferences > File)
My-patterns
(contains all your pattern files)
My-rules
(contains all your .rule files; set in Preferences > Control)
My-scripts
(contains all your .lua/.py files)
If necessary, use File > Set File Folder and select the Golly folder. Now all your folders (and the supplied folders) are visible in the file panel, so with just a few clicks you can load any pattern, run any script, or switch to any .rule file. You can also right-click (or control-click) on any of those files to open them in your preferred text editor.
When upgrading to a new version of Golly, Mac users can simply drag all the distributed files and folders into their Golly folder and the old versions will be replaced. On Windows and Linux you'll need to delete the old Help, Patterns, Rules and Scripts folders before dragging in the new folders to avoid ending up with merged versions.
This works because a GollyPrefs file is not included in Golly distribution packages -- it's just created on the fly if Golly finds that it doesn't exist. So if you already have a GollyPrefs on your system, overwriting old files directly with new distributed files won't lose any of your settings. You'd only lose any custom edits that you made to patterns, rule tables, scripts, etc., that are packaged with Golly -- thus the warning in Golly's Help > Hints and Tips about not doing any such custom edits.

-----------------------------------------------------------------

Unfortunately I never do things as advised above! I keep all my old Golly versions just in case I want to go back and test something in an older version, to see where a bug first showed up let's say.

So instead I copy a specially prepared package that I keep as a ZIP file, that decompresses to Golly's standard folder structure including subfolders. The archive includes my favorite GollyPrefs in Golly's root folder, with all my mapped shortcut keys, and in the archive's Scripts/Python and Scripts/Lua folders I have the helper scripts that those keyboard shortcuts refer to... and so forth.

I drop this into each new version of Golly when I download it. This way old and new versions of Golly can work completely independently with different preferences if needed.

-- However, apparently my method won't work on a Mac, because apparently a new subfolder dropped on an existing subfolder on a Mac will, by default, replace all the contents of the subfolder instead of merging! Apparently there's some tricky way to get the Windows/Linux default merge behavior, but it didn't look entirely easy and now I've forgotten the details.

User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: A problem with Python

Post by 77topaz » September 13th, 2018, 5:35 am

The recommendation doesn't appear to work for me: when I load a file, Golly only looks for the rule file in the "Rules" folder, and so can't find rule files in a "My-rules" folder. I suppose I could put my rule files in both "Rules" and a separate folder, but that seems unnecessarily complicated.

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 13th, 2018, 6:25 am

77topaz wrote:The recommendation doesn't appear to work for me: when I load a file, Golly only looks for the rule file in the "Rules" folder, and so can't find rule files in a "My-rules" folder. I suppose I could put my rule files in both "Rules" and a separate folder, but that seems unnecessarily complicated.
Did you do the step about updating the preference?
My-rules
(contains all your .rule files; set in Preferences > Control)
Rules-preference.png
Rules-preference.png (60.33 KiB) Viewed 16295 times

User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: A problem with Python

Post by 77topaz » September 13th, 2018, 6:43 am

Oh, I was misunderstanding your instructions. Now I've managed to set it up so that the default rules in "Rules" and custom rules in "My-rules" both work. Thanks!

Post Reply