Unable to Pinpoint Script Error
I find running scripts in blenders python console can be very helpful, this addon adds a menu to the console that lets you run a text block from the python console where you can see any print output as well as leaving variables set as they are at the end of the script so you can have a look at what the script was working with when it failed.

By looking at your code I expect the error is the filepath in path_to_directory. On *nix systems ~ is used to represent a users home folder, when used in a shell this gets expanded automatically but in python you need to use os.path.expanduser() to get the absolute path which you will find gets expanded to /Users/jackburker which you are already adding to your path.

So you want to either use

path_to_directory = os.path.join(
    '/', 'Users', 'jackburker', 'Documents',
    'Code', 'Blender', 'base_models')


or

path_to_directory = os.path.join(
    os.path.expanduser('~'), 'Documents',
    'Code', 'Blender', 'base_models')