The help says it should return None. In fact it returns an empty string…
import rhinoscriptsyntax as rs
filename=rs.DocumentName()
print "filename is of type: ", type(filename)
if filename==None:
print "Filename is None"
elif filename=="":
print "Filename is an empty string"
else:
print "I have no idea"
def DocumentName():
"Returns the name of the currently loaded Rhino document (3DM file)"
if scriptcontext.doc.Name != "" : return scriptcontext.doc.Name
return