Page 1 of 1

Path

Posted: Wed Aug 07, 2013 1:50 pm
by Akos
Can anyone show me how can i find the path of the working folder. I am trying to make a code in which i inted to create a file.txt . The only problem is that if i dont specify the path I creates it in the blender source code folder and the in the folder where my objects are.

I tryed bpy.path, but it's not good.
A.

Posted: Wed Aug 07, 2013 11:57 pm
by CoDEmanX
should be the working dir:

>>> os.getcwd()
'C:\\Program Files\\Blender Foundation\\Blender'

>>> os.path.dirname(bpy.app.binary_path)
'C:\\Program Files\\Blender Foundation\\Blender'

>>> os.path.dirname(sys.argv[0])
'C:\\Program Files\\Blender Foundation\\Blender'

or one of these?
bpy.utils.script_paths()

Posted: Thu Aug 08, 2013 11:02 am
by Akos
:oops: Thanks, but they didn't worked out for me. They were returning the following directories :
/tmp/
and
/home/akos/soft/blender/2.68/
And my intention were to find the directory were the .blend file is, which is :
/home/akos/scenes/car
Do you have any suggestion ? Or anybody else ?

Thanks again,
A.

Posted: Thu Aug 08, 2013 5:48 pm
by CoDEmanX
I see, you didn't state that clear enough. Try bpy.data.filepath

Posted: Thu Aug 08, 2013 6:01 pm
by Akos
Thank you a lot !

Sorry for my ambiguous language. I'm new to this environment and a beginner in programming.