I tried and searched for that function in the system-module, but it’s not there, neither in de os-module. Thanks for the advice anyway! If I create time-sensitive, freespace, or any other form of random ID (which has then to be stored), it is impossible to track where that stored version comes from. You can copy such an ID, and use it together with a key on another computer relatively easy I think.
What I found until now did not really satisfy me yet, but I will name them:
- parse the output of ‘ipconfig /all’
- Install extra module, like ‘pyWin32’
I went for the last one, namely the Harddisk-ID (not volume-ID), since the HD (with the OS on it) is one of the most stable factors. I skipped the MAC address, because ethernet adapters are easier to turn off (I do sometimes, to kickstart my lousy connection), than a bootdisk ;), But if needed, it is possible to include it via the pyWin32 module.
Thx for the help, and hope this helps for others.
For the interested (Install pyWin32 first!), code I use for Hardware-ID of a harddisk:
import win32api
import math
path = str(win32api.GetSystemDirectory().split('\\')[0]) + "\\" #use the Bootdisk
serial = win32api.GetVolumeInformation(path)[1] #is a Negative number (long), always the case?
serial = int(math.sqrt(int(serial**2))) #make it always positive
For those looking for the MAC-address via pyWin32:
http://groups.google.com/group/comp.lang.python/msg/fd2e7437d72c1c21