If the current directory is not writable nor if
the directory of the output file isn't, use the standard
temporayr directory as a last resort.
data = writer.get_xml()
if options.output and options.output != "-":
tempdir = os.path.dirname(options.output) or os.getcwd()
+ if not os.access(tempdir, os.W_OK):
+ tempdir = tempfile.gettempdir()
main_f = tempfile.NamedTemporaryFile(suffix='.gir', dir=tempdir, delete=False)
main_f.write(data)
main_f.close()