This forum is no longer active. Please post your questions to our new community site
TRAC_ADMIN: ImportError: No module named trac.scripts.admin - Please Help
|
|
Hi - I just installed Trac on my OS X machine via the Bitnami Trac installer. Everything went smooth and created the following directory structure with a project under /projects called myproject> Top Level Directory: Applications/trac-0.10.4-9 Sub Directories: common I wanted to add a user named “rick” to projects/myproject with TRAC_ADMIN privileges. I CD into: /Applications/trac-0.10.4-9/trac/bin And I type: ./trac-admin permission add rick TRAC_ADMIN And get back: Traceback (most recent call last): Am I doing anything wrong, or is this a config issue? I’ve read that it could be a problem with my PYTHONPATH not being set up correctly, but none of the docs I’ve read tell me how to set that up. Any help is appreciated. |
|
|
I am having the exact same problem under my Mac OS X leopard machine. Running the ./trac-admin script in the /Applications/trac-0.10.4-9/trac/bin gives me the exact same error. Obviously the problem is with the ENvironment variables. I tried to run /Applications/trac-0.10.4-9/scripts/setenv.sh 1. It is not executable. I ran chmod +x setenv and fixed it. Well I did copy paste those variables and exported them manually, but the trac-admin still doesn’t run. If it helps, my default terminal on leopard is bash (found with echo $0). Oh, and the PATH that the setenv is trying to set doesn’t include all the stuff in the current PATH. In other words, one thinks it should try to only add directories to the current PATH, not remove directories from it. In a previous install (2 months ago), I had the same problem as well. I remember I managed to set the PYTHONPATH with try and error, but there was something wrong with the md5 hashing functionality of python, and I gave up at that point. I would appreciate if any of the developers can look into this. |
|
|
I should add that in my previous installation, I told the installer to create a project (I didn’t need SVN connection at the time), and that project worked like a charm. However, the trac-admin has always acted funny. Thanks |
|
|
Hi, First of all, my apologies to chad, as his first post went unnoticed and was never replied. Secondly, I have been able to reproduce this issue, let us work on it a little bit to get it fixed. Cheers |
|
|
Hi again, I investigated this issue a little bit more and found that actually it works okay :) Before using trac-admin, you need to load the environment variables as rezaf_2000 pointed out. But the way to do this is by typing from the installation directory
Once you have loaded the proper environment, the trac-admin utility should work correctly, change directory to <installdir>/trac/bin and type
It has worked for me. By the way, the script setenv.sh does include the PYTHONPATH variable. What version of the stack are you using? Cheers |
|
|
Great, seems to work! Well, I can check more thoroughly tomorrow, but at least trac-admin runs and doesn’t die :-) So, the trick was in running the setenv.sh from the installation directory and not from the scripts directory? What does the one single “dot” before scripts/setenv.sh do? And yes, I overlooked the contents of setenv.sh. It did contain the PYTHONPATH. Finally, I would suggest you add this information to the readme file, so that people know they should run this before trying to run trac-admin. |
|
|
The dot loads the environment from a shell script into the shell that is running the script. We will update the documentation, I am glad to hear that you finally got it working :) |

