Python export from Console

2455
3
04-12-2012 03:49 PM
RobertHexter
New Contributor III
I'm a little puzzled,

I'm trying to run a simple export from the the console that will:
1) run the export script I have
2) log output to a file (I'm tired of going to the log window and manually having to tell it to save a log file to a specific location that i can read more comfortably in an IDE after each export)

Currently looks like this:


def export():
    """
    Initiate an export
    Use the script export settings
    """
    settings = ScriptExportModelSettings()
    
    settings.getMiscOptionsBatchBehavior("OVERWRITE")
    settings.setMiscOptionsWriteExportLog(True) 
    
    
    settings.setMiscOptionsScript("exportInstances.py")

    ce.export(ce.selection(), settings, False )



If I comment out, settings.setMiscOptionsWriteExportLog(True) and  settings.getMiscOptionsBatchBehavior("OVERWRITE") ,
it all springs into life and runs the export. Great! (It exports a text File that of instance locations as per your examples)

If they are there, nothing happens..

So:
1) this is confusing behaviour?
2) how do i specify where a log file is to be dumped?
3) where is a log file dumped if nothing is specified? (I guess the default is next to whereever the output from the export is, but its unclear since this is a script based export)
0 Kudos
3 Replies
MatthiasBuehler1
Frequent Contributor
hi

the log is created in the export dir.

if nothing happens, there's propably an error going on.

can you check the 'Log Window', if an error (red cross) is thrown ? If so, double click the error to open the stack trace.


let me know.
0 Kudos
RobertHexter
New Contributor III
Okay I realised the error of my python ways...

settings.getMiscOptionsBatchBehavior("OVERWRITE")

should have been

settings.setMiscOptionsBatchBehavior("OVERWRITE")

thanks for the response!
0 Kudos
MatthiasBuehler1
Frequent Contributor
oooh, that's a tricky one to find .. 😉
0 Kudos