Search code examples
pythonlimit

Limit Usage of Python Script to One Particular Computer?


How should one generally go about limiting the usage of a script to one particular computer for a single, average computer user?


Solution

  • You could tie the script to the MAC address of your computer by using uuid.getnode(), which returns the MAC address. Then in your script you would have

    import uuid
    if uuid.getnode() != #precomputed number:
        raise SystemExit()
    

    You'll need to change the permissions of the script to make sure it can't be edited.