SeattleTestbed / portability

Use Repy code in Python
MIT License
0 stars 7 forks source link

repyhelper only works when user has write access #23

Closed choksi81 closed 10 years ago

choksi81 commented 10 years ago

When running a SeattleGENI installation with Apache, I got the following error:

Cannot open file for translation '/home/sportzer/geni_dev/seattle/rsa.repy': 13 Permission denied: '/home/sportzer/geni_dev/seattle/rsa_repy.py'

Apache is running under it's own user, so unless it has permission to overwrite the _repy.py files, repyhelper imports will fail. Running chmod a+w _repy.py to change the permissions works as a temporary fix.

choksi81 commented 10 years ago

Author: mkaplan This needs to be changed to print a clearer error. There may not be a nice fix for this problem.

choksi81 commented 10 years ago

Author: mkaplan I uploaded a diff that will hopefully clarify the exception, when and if it occurs.

The second half of this fix will require wrapping calls to repyhelper.translate_and_import (or any other calls that can trigger a TranslationError, and gracefully handling those exceptions to avoid the 'nasty' traceback.

choksi81 commented 10 years ago

Author: mkaplan I discussed this with sportzer, and he thought this might have been caused by a bug in the logic that checks if the file needs to be retranslated.

I went through that code and did not see any bugs. however, it was able to benefit from a small cleaning, and that diff is attached.

Since this appears to be a configuration issue with Apache, and not an issue with repy itself, I recommend that this bug become a wontfix.

The only possible solution that comes to mind would be to dynamically generate the python code each time, and exec it into a module, which would then need to be added to sys.modules.

[http://code.activestate.com/recipes/82234-importing-a-dynamically-generated-module/] looks like a nice example of exactly that.

choksi81 commented 10 years ago

Author: mkaplan I committed the attached diffs in r5748 and r5749. Based on my conversation with sportzer today, this ticket is being closed as wontfix.