3

I'm have difficulty finding any docs describing Python's expected symlink behavior.

I've tried testing it myself but I'm getting weird results - sometimes it appears to work for a while then stops working.

Anyway, I have a situation where MoinMoin keeps it's data files and plugin modules in the same directory but I need to keep the data files outside my git repository (I'm using Openshift PaaS) so it persists. So I want to create this symlink:

~/data/plugins/theme/ -> ~/repo/plugins/theme/

Should I expect this to work?

EddyR
  • 6,891
  • 7
  • 42
  • 50

1 Answers1

10

Should work just fine - symlinks are handled on the OS level, meaning as long as python isn't trying to determine if something is a symlink or not, calling an open on it should just open the file it's pointing to.

Is there anything in particular that isn't working? What are you seeing when it stops working?

zigdon
  • 14,573
  • 6
  • 35
  • 54
  • It seems to bypass my custom theme and loads the default. I'm wondering if it depends on when the symlink is being created. Since it's in a git repo the symlink is probably broken everytime it gets pushed. Anyway, it's good to know that that is what should be happening. – EddyR Apr 08 '12 at 06:24
  • So in other words I should probably do something like this: git push -> recreate symlink -> restart server(?) – EddyR Apr 08 '12 at 06:31
  • 2
    Some applications, especially web frameworks, may actively look for symlinks and refuse to follow them for security reasons. This has nothing to do with python per se. It could be specifically a MoinMoin behavior, for example (I wouldn't know), and there may be configuration flags to turn it off. – alexis Apr 08 '12 at 14:27