Start a new topic

mgNewDB() fails with ?string input

Trying to use a command line arg to create a new database, but I need to add a prefix to it.  This code fails but it's not clear to me why.  I _think_ I'm following the various example forms..?



	obj_db = mgNewDb ('obj_' + (sys.argv[1]))
	if obj_db == None:
		print(mgGetLastError (), "\n")
		mgExit ()



	print ('name:',obj_db,type(obj_db))
	ok = mgCloseDb (obj_db)
	if ok == MG_FALSE:
		print("Error closing object database\n")

 ## Object db is: obj_blip.flt <class 'str'>

I: File written <C:/Presagis/Suite22/OpenFlight_API_22_0/samples/scripts/blip.flt>.

name: <Swig Object of type 'mgrec *' at 0x000002E431DFAED0> <class 'SwigPyObject'>


C:\Presagis\Suite22\OpenFlight_API_22_0\samples\scripts>dir obj*flt

 Volume in drive C is System

 Volume Serial Number is 96C6-CD68

 Directory of C:\Presagis\Suite22\OpenFlight_API_22_0\samples\scripts

File Not Found



1 Comment

User error - close without a writeDb.

Added a writeDb command to do something with the file.  It's good, now I am writing a new db file.



1 person likes this
Login to post a comment