Discussion:
Strange bug with new example scripts
Dave Crossland
2009-05-09 19:00:44 UTC
Permalink
Hi,

I have a problem with the current source that I don't understand:

$ hg clone https://code.goto10.org/hg/shoebot
$ cd shoebot; sudo python setup.py install
$ ./shoebot-ide /usr/share/shoebot/examples/random/RandomVarEllipseOpacity.bot
This is a console window, error messages and script output are shown here,
you can clear the window selecting and deleting the content
Traceback (most recent call last):
File "./shoebot-ide", line 967, in run_script
self.sbot_window = gtkui.ShoebotWindow(codestring,
self.use_socketserver, 7777, self.use_varwindow, self.go_fullscreen)
File "/home/crossland/src/shoebot/shoebot/gtkui.py", line 328, in __init__
self.drawingarea = ShoebotDrawingArea(self, self.bot)
File "/home/crossland/src/shoebot/shoebot/gtkui.py", line 100, in __init__
exec l in self.bot.namespace
File "<string>", line 1, in <module>
NameError: name 'xed' is not defined

Yet,

$ chmod +x sbot
$ ./sbot '/usr/share/shoebot/examples/random/RandomVarEllipseOpacity.bot'
$ evince output.png

works fine, so I'm confused :-)

Also, please note that the current "./sbot" file doesn't have
executable permissions; is that right?
--
Regards,
Dave
architetto francesco fantoni <hva - hermanitos verdes architetti>
2009-05-09 19:26:13 UTC
Permalink
I'm afraid this is an old problem caused by the routine used for
pre-parsing the script code in order to set width and height of gtk
window without actually running the code twice: the function parses the
script looking for the size() statement, but as it works now, you can't
pass a variable as width or height value in size() script because the
pre-parsing routine doesn't recognize it, so numeric values must be
used.
I hope someone can find a better way of setting size without running the
script twice (that was quite annoying for complex script). At the time i
tried to solve it, that was the best I could do, but I was aware there
were some unresolved issues, sorry.
francesco
Post by Dave Crossland
Hi,
$ hg clone https://code.goto10.org/hg/shoebot
$ cd shoebot; sudo python setup.py install
$ ./shoebot-ide /usr/share/shoebot/examples/random/RandomVarEllipseOpacity.bot
This is a console window, error messages and script output are shown here,
you can clear the window selecting and deleting the content
File "./shoebot-ide", line 967, in run_script
self.sbot_window = gtkui.ShoebotWindow(codestring,
self.use_socketserver, 7777, self.use_varwindow, self.go_fullscreen)
File "/home/crossland/src/shoebot/shoebot/gtkui.py", line 328, in __init__
self.drawingarea = ShoebotDrawingArea(self, self.bot)
File "/home/crossland/src/shoebot/shoebot/gtkui.py", line 100, in __init__
exec l in self.bot.namespace
File "<string>", line 1, in <module>
NameError: name 'xed' is not defined
Yet,
$ chmod +x sbot
$ ./sbot '/usr/share/shoebot/examples/random/RandomVarEllipseOpacity.bot'
$ evince output.png
works fine, so I'm confused :-)
Also, please note that the current "./sbot" file doesn't have
executable permissions; is that right?
Dave Crossland
2009-05-09 20:06:44 UTC
Permalink
2009/5/9 architetto francesco fantoni <hva - hermanitos verdes
Post by architetto francesco fantoni <hva - hermanitos verdes architetti>
I'm afraid this is an old problem caused by the routine used for
pre-parsing the script code in order to set width and height of gtk
window without actually running the code twice: the function parses the
script looking for the size() statement, but as it works now, you can't
pass a variable as width or height value in size() script because the
pre-parsing routine doesn't recognize it, so numeric values must be
used.
I hope someone can find a better way of setting size without running the
script twice (that was quite annoying for complex script). At the time i
tried to solve it, that was the best I could do, but I was aware there
were some unresolved issues, sorry.
Could we just have all examples changed to specify a simple size(400,
400) ? That would be a simple quick fix.

$ grep -r "size(x" /usr/share/shoebot/examples/*
Dave Crossland
2009-05-09 20:07:57 UTC
Permalink
Post by Dave Crossland
2009/5/9 architetto francesco fantoni <hva - hermanitos verdes
Post by architetto francesco fantoni <hva - hermanitos verdes architetti>
I'm afraid this is an old problem caused by the routine used for
pre-parsing the script code in order to set width and height of gtk
window without actually running the code twice: the function parses the
script looking for the size() statement, but as it works now, you can't
pass a variable as width or height value in size() script because the
pre-parsing routine doesn't recognize it, so numeric values must be
used.
I hope someone can find a better way of setting size without running the
script twice (that was quite annoying for complex script). At the time i
tried to solve it, that was the best I could do, but I was aware there
were some unresolved issues, sorry.
Could we just have all examples changed to specify a simple size(400,
400) ? That would be a simple quick fix.
$ grep -r "size(x" /usr/share/shoebot/examples/*
Actually, since there are not that many, I think just hardcoding the
xed/yed values into the size() functions of each script would be
better.

Continue reading on narkive:
Loading...