Create broken symlink with Python
问题 Using Python I want to create a symbolic link pointing to a path that does not exist. However os.symlink just complains about "OSError: [Errno 2] No such file or directory:".. This can easily be done with the ln program, but how to do it in Python without calling the ln program from Python? Edit: somehow I really messed this up :/ ... both answers below is correct 回答1: Such error is raised when you try to create a symlink in non-existent directory. For example, the following code will fail if