Search code examples
pythontensorflow2.0tensorboard

Why is the os.path.join() in directory giving an invalid directory name error?


Here it should create the folder naming Model 1 at time but it giving an error message.

# Folder for tensorboard
folder_name = f'Model 1 at {strftime("%H:%M")}'
directory = os.path.join('tensorboard_mnist_digit_logs', folder_name)
try:
    os.makedirs(directory)
except OSError as exception:
    print(exception.strerror)
else:
    print('Successfully created directories!')

Solution

  • you can not have ':' in a folder name.

    Change strftime("%H:%M") to strftime("%H-%M") and it will work