Path

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Akos
Posts: 0
Joined: Wed Jul 10, 2013 4:08 pm

Path

Post by Akos » Wed Aug 07, 2013 1:50 pm

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.

CoDEmanX
Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Wed Aug 07, 2013 11:57 pm

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()
I'm sitting, waiting, wishing, building Blender in superstition...

Akos
Posts: 0
Joined: Wed Jul 10, 2013 4:08 pm

Post by Akos » Thu Aug 08, 2013 11:02 am

: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.

CoDEmanX
Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Thu Aug 08, 2013 5:48 pm

I see, you didn't state that clear enough. Try bpy.data.filepath
I'm sitting, waiting, wishing, building Blender in superstition...

Akos
Posts: 0
Joined: Wed Jul 10, 2013 4:08 pm

Post by Akos » Thu Aug 08, 2013 6:01 pm

Thank you a lot !

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

Post Reply