Kitware / tangelo

A simple, quick, powerful web framework
http:/tangelohub.org/tangelo/
Apache License 2.0
185 stars 35 forks source link

Current working directory of Tangelo services is unexpected #470

Closed waxlamp closed 9 years ago

waxlamp commented 9 years ago

The CWD seems to be set to the working directory with which Tangelo was launched. This is actually to be expected, but writers of a service module may (reasonably) expect that the CWD is the directory containing the service.

@jeffbaumes what do you think we should do? Part of me thinks yes, change the cwd to the service directory before executing it, but another part thinks no, don't mess with the cwd when it is properly set to the cwd of the actual Tangelo process. The former is more useful but possibly wrong; the latter is just the opposite.

jeffbaumes commented 9 years ago

My knee-jerk reaction is to say yes, set the CWD to the script directory. This helps with the metaphor that Tangelo lets you expose a script as a web service. If there is a script that does IO on relative paths, the user would expect them to work much as if they had run python myscript.py.