Arcpy changing current working directory

Discussion created by gdabski on May 14, 2013
Latest reply on May 20, 2013 by mdenil
I can't seem to understand the following behaviour:

mxd = ur'G:\MapImageCreator\ImageTaker.mxd'

print os.getcwd()                          # C:\Documents and Settings\dabkowsk\Desktop (where I run the script from)
mxd = arcpy.mapping.MapDocument(mxd)
print os.getcwd()                          # G:\MapImageCreator

Why does creating a MapDocument object change my working directory? This way I can't use any relative path in my entire script. For example, if I describe an output file as just 'abcdefg.txt', it gets created in the mxd's directory, not in the one I run the script from.