Index: framspy/frams-test.py
===================================================================
--- framspy/frams-test.py	(revision 1084)
+++ framspy/frams-test.py	(revision 1085)
@@ -2,6 +2,8 @@
 import frams
 
-frams_path = sys.argv[1] # set to the directory where Framsticks binaries and libraries exist
-frams.init(frams_path, sys.argv[2] if len(sys.argv) > 2 else None, "-Ddata")  # "-D"+os.path.join(framspath,"data")) # not possible (maybe python windows issue) because of the need for os.chdir(). So we assume "data" is where the dll/so is
+frams.init(*(sys.argv[1:])) #pass whatever args we have, init() is the right place to deal with different scenrios:
+# frams.init() - should try to figure out everything (and might fail)
+# frams.init('path/to/frams') - load the library from the specified dir and configure framsticks path as "data" inside the dir
+# frams.init('path/to/frams','-d/tmp/workdir/data') - as above, but set the working (writable) directory somewhere else
 
 print('Available objects:', dir(frams))
Index: framspy/frams.py
===================================================================
--- framspy/frams.py	(revision 1084)
+++ framspy/frams.py	(revision 1085)
@@ -248,18 +248,54 @@
 
 
-def init(lib_path, lib_name, *args):
+def init(*args):
 	"""
 	Initializes the connection to Framsticks dll/so.
 
-	:param lib_path: the path where the dll/so file can be found
-	:param lib_name: the name of the dll/so (a complete name including file name extension) or None if you want to use the default name
-	:param args: optional arguments to pass to Framsticks initialization (try "-h")
+	Python programs do not have to know the framstics path but if they know, just pass the path as the first argument.
+	Similarly '-dPATH' and '-DPATH' needed by framsticks are optional and derived from the first path, unless they are specified as args in init().
+	'-lNAME' is the optional library name (full name including the file name extension), default is 'frams-objects.dll/.so' depending on the platform.
+	All other arguments are passed to framsticks and not interpreted by this function.
+
 	"""
+	# goals:
+	frams_d=None
+	frams_D=None
+	lib_path=None
+	lib_name='frams-objects.so' if os.name == 'posix' else 'frams-objects.dll'
+	initargs=[]
+	for a in args:
+		if a[:2]=='-d':
+			frams_d=a
+		elif a[:2]=='-D':
+			frams_D=a
+		elif a[:2]=='-l':
+			lib_name=a[2:]
+		elif lib_path==None:
+			lib_path=a
+		else:
+			initargs.append(a)
+	if lib_path==None:
+		#todo: use env variable and/or the zip distribution we are in when the path is not specified in arg
+		#for now just assume the current dir is framsticks
+		lib_path='.'
+
 	original_dir = os.getcwd()
-	os.chdir(lib_path)  # because under Windows, frams-objects.dll requires other dll's which reside in the same directory, so we must change current dir for them to be found while loading the main dll
-	global c_api  # access global variable to initialize it
-	c_api = ctypes.CDLL(lib_name if lib_name is not None else 'frams-objects.so' if os.name == 'posix' else 'frams-objects.dll')
+	os.chdir(lib_path)  # because under Windows, frams.dll requires other dll's which reside in the same directory, so we must change current dir for them to be found while loading the main dll
+	abs_data=os.path.abspath('data') #use absolute path for -d and -D so python is free to cd anywhere without confusing the frams
+	# for the hypothetical case without lib_path the abs_data must be obtained from somewhere else
+	if frams_d==None:
+		frams_d='-d'+abs_data
+	if frams_D==None:
+		frams_D='-D'+abs_data
+	initargs.insert(0,frams_d)
+	initargs.insert(0,frams_D)
+	initargs.insert(0,'dummy.exe')
+        
+	global c_api  # access global variable
+	if lib_path!=None and os.name == 'posix':
+		lib_name = './'+lib_name #currently we always have lib_path (even if it is incorrect) but hypothetically it could work with lib_path==None and load .so from some default system path without './'
+	c_api = ctypes.CDLL(lib_name)
 	os.chdir(original_dir)
-
+	
 	c_api.init.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_char_p)]
 	c_api.init.restype = None
@@ -301,6 +337,6 @@
 	c_api.rootObject.restype = ctypes.c_void_p
 
-	c_args = (ctypes.c_char_p * (len(args) + 1))(*([b''] + list(a.encode(ExtValue._encoding) for a in args)))
-	c_api.init(len(args) + 1, c_args)
+	c_args = (ctypes.c_char_p * len(initargs))(*list(a.encode(ExtValue._encoding) for a in initargs))
+	c_api.init(len(initargs), c_args)
 	Root = ExtValue._rootObject()
 	for n in dir(Root):
