Discussion:
Getting folder of current bot...
Stuart Axon
2010-06-01 20:22:06 UTC
Permalink
A lot of examples have hardcoded paths in them, I'm looking to avoid this...

I've got __file__ working in my branch, so you can do

os.path.dirname(__file__) + 'someresource.svg'


Any objections to me adding
__dirname__ with the current folder ?

This would make the code simpler + it is consistant with __file__ being a builtin.

S++
Stuart Axon
2010-06-01 20:25:43 UTC
Permalink
Having said that, maybe we should have an api equivilent to getResource in java maybe?

S++



----- Original Message ----
Sent: Tue, June 1, 2010 9:22:06 PM
Subject: Getting folder of current bot...
A lot of examples have hardcoded paths in them, I'm looking to avoid
this...
I've got __file__ working in my branch, so you can
do
os.path.dirname(__file__) + 'someresource.svg'


Any
objections to me adding
__dirname__ with the current folder
?
This would make the code simpler + it is consistant with __file__ being
a builtin.
S++
ricardo lafuente
2010-06-02 20:12:07 UTC
Permalink
Sounds fine -- we'll just have to document it along with the other
additions to Nodebox.
Post by Stuart Axon
A lot of examples have hardcoded paths in them, I'm looking to avoid this...
I've got __file__ working in my branch, so you can do
os.path.dirname(__file__) + 'someresource.svg'
Any objections to me adding
__dirname__ with the current folder ?
This would make the code simpler + it is consistant with __file__ being a builtin.
S++
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Dave Crossland
2010-06-04 11:12:57 UTC
Permalink
Post by Stuart Axon
This would make the code simpler + it is consistant with __file__ being a builtin.
+1

Continue reading on narkive:
Loading...