How to get Desktop path with Python

Hi, any idea how to get the Desktop path with Python?

The code from below doesn’t work for me.

Another time a error message would be nice as to what is not working for you…

image

Works without a hitch…

import clr
import sys
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")

from os import path
import os
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')

user = os.environ.get('USERNAME')

OUT = desktop , user
5 Likes