Scripts that modify rules crash Golly
- Extrementhusiast
- Posts: 1966
- Joined: June 16th, 2009, 11:24 pm
- Location: USA
Scripts that modify rules crash Golly
Running a script that changes a .table file crashes Golly, with the error message notably saying "This application has requested the Runtime to terminate it in an unusual way." (running 64-bit version on Windows 7, script previously worked running 32-bit version on Windows XP)
I Like My Heisenburps! (and others)
Re: Scripts that modify rules crash Golly
Any chance you could post the offending script? It would help enormously if you could create a version of the script that is as small as possible but still causes the same crash. Is the crash 100% reproducible?Extrementhusiast wrote:Running a script that changes a .table file crashes Golly...
- Extrementhusiast
- Posts: 1966
- Joined: June 16th, 2009, 11:24 pm
- Location: USA
Re: Scripts that modify rules crash Golly
The offending Python script (from Randomized Three-State Rules):
I'll come up with a test script soon.
Code: Select all
from random import randint
import golly as g
def f(n):
line = [0, 0, 0, 0, 0, 0, 0, 0, n]
i = 0
while i < 8:
j = 0
while j <= i:
line[j] = 1
j += 1
file.write('%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n' % (line[8], line[7], line[6], line[5], line[4], line[3], line[2], line[1], line[0], r()))
j = 0
while j <= i:
line[j] = 2
file.write('%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n' % (line[8], line[7], line[6], line[5], line[4], line[3], line[2], line[1], line[0], r()))
j += 1
i += 1
def r():
if randint(0, 2) == 2:
return randint(0, 2)
else:
return 0
file = open(g.getdir('rules') + 'test.table', 'w')
file.write('n_states:3\n')
file.write('neighborhood:Moore\n')
file.write('symmetries:permute\n\n')
f(0)
file.write('%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n' % (1, 0, 0, 0, 0, 0, 0, 0, 0, r()))
f(1)
file.write('%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n' % (2, 0, 0, 0, 0, 0, 0, 0, 0, r()))
f(2)
file.close()
g.new('testing rule')
g.setalgo('RuleLoader')
g.setrule('test')
g.select([0, 0, 100, 100])
g.randfill(33)
g.select([])
g.fit()
I Like My Heisenburps! (and others)
Re: Scripts that modify rules crash Golly
I ran the above script many times on my 64-bit Mac version of Golly without any problems, so it would seem to be a Windows-specific problem. I don't have access to a 64-bit Windows machine so I'll try to get someone else to duplicate your crash.
Just to be clear, are you sure you're using a 64-bit Python? A 64-bit Golly requires that. (If the supplied Python scripts like oscar.py run ok then you're presumably using a compatible Python.)
Just to be clear, are you sure you're using a 64-bit Python? A 64-bit Golly requires that. (If the supplied Python scripts like oscar.py run ok then you're presumably using a compatible Python.)
Re: Scripts that modify rules crash Golly
I'm also running the 64-bit version on my Windows 7 computer, and the script runs perfectly fine. I don't know what could cause it to do that, but I do know I have a working 64-bit version of Python
- Extrementhusiast
- Posts: 1966
- Joined: June 16th, 2009, 11:24 pm
- Location: USA
Re: Scripts that modify rules crash Golly
Yes, as I had previously gone through a debacle where Golly couldn't find Python, even though I provided the correct file address. As it turns out, that's what happens when you have 64-bit Golly look for 32-bit Python. (With the 64-bit python, preset scripts like oscar.py do work.)Andrew wrote:Just to be clear, are you sure you're using a 64-bit Python? A 64-bit Golly requires that. (If the supplied Python scripts like oscar.py run ok then you're presumably using a compatible Python.)
I Like My Heisenburps! (and others)
- Extrementhusiast
- Posts: 1966
- Joined: June 16th, 2009, 11:24 pm
- Location: USA
Re: Scripts that modify rules crash Golly
The latest version of the apgsearch script also crashes Golly in the same way. Perhaps it just has to do with changing rules?
EDIT: No, maybe it's writing files, as this script works:
EDIT 2: Found a one-line problem:
Notably, this doesn't affect the 32-bit version of Golly, which is very strange.
EDIT: No, maybe it's writing files, as this script works:
Code: Select all
from glife import validint
import golly as g
num_string=g.getstring("Enter the number of samples:")
if not validint(num_string) :
g.exit("This is not a valid number.")
else :
num_samples=int(num_string)
margin=127
soup_width=2*margin+1
pop_t=0
pop_t_minus_one=0
pop=0
maxpop=0
prev_maxpop=0
pop_data=[]
# Clear the current layer
g.new("work")
for i in range(num_samples) :
# Change to a dummy rule
g.setrule("B/S")
# Create random soup
g.select([0, 0, soup_width, soup_width])
g.randfill(50)
g.select([])
# Change rule to WFLanalyze-1
g.setrule("WFLanalyze-1")
# Set central cell
g.setcell(margin,margin,3)
# Run pattern until stabilization
for j in range(1001) :
if j==1000 :
g.exit("Overflow on a sample.")
pop_t_minus_one=int(g.getpop())
g.run(1)
pop_t=int(g.getpop())
if pop_t==pop_t_minus_one :
break
# Change rule to WFLanalyze-2
g.setrule("WFLanalyze-2")
# Step pattern
g.run(1)
# Record population
pop=int(g.getpop())
# Increment table
if pop>maxpop :
prev_maxpop=maxpop
maxpop=pop
for j in range(prev_maxpop,maxpop) :
pop_data.append(0)
pop_data[pop-1]+=1
# Reset
g.reset()
# END
# Create new layer
g.new("data")
# FOR LOOP:
for i in range(len(pop_data)) :
if pop_data[i]!=0 :
for j in range(pop_data[i]) :
g.setcell(i,-j-1,1)
# END
Code: Select all
from random import randint
I Like My Heisenburps! (and others)
Re: Scripts that modify rules crash Golly
I'm getting a bit confused. Are you saying that the latest 64-bit Golly for Windows, using a 64-bit Python, will crash if a script contains "from random import randint"? If so, I've got no idea why that would happen.
- Extrementhusiast
- Posts: 1966
- Joined: June 16th, 2009, 11:24 pm
- Location: USA
Re: Scripts that modify rules crash Golly
Just getting word that that same error message is appearing in completely different contexts from what I'm seeing here. So it's highly likely it's not a problem with Golly.
I Like My Heisenburps! (and others)