Skip to main content
added 122 characters in body
Source Link
stacker
  • 38.9k
  • 31
  • 144
  • 245

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

filepath = bpy.data.filepath
directory = os.path.dirname(filepath)
print(directory)

To add a file to the basename you could use os.path.join:

newfile_name = os.path.join( directory , "newfile.blend")

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

filepath = bpy.data.filepath
directory = os.path.dirname(filepath)
print(directory)

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

filepath = bpy.data.filepath
directory = os.path.dirname(filepath)
print(directory)

To add a file to the basename you could use os.path.join:

newfile_name = os.path.join( directory , "newfile.blend")
deleted 2 characters in body
Source Link
ideasman42
  • 48k
  • 10
  • 144
  • 226

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

filefilepath = bpy.data.filepath
directory = os.path.dirname(filefilepath)
print( directory )

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

file = bpy.data.filepath
directory = os.path.dirname(file)
print( directory )

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

filepath = bpy.data.filepath
directory = os.path.dirname(filepath)
print(directory)
Source Link
stacker
  • 38.9k
  • 31
  • 144
  • 245

You can use the functions provided by os.path for handling pathnames independendly from a platform.

import bpy
import os

file = bpy.data.filepath
directory = os.path.dirname(file)
print( directory )