This forum is no longer active. Please post your questions to our new community site

Forums Trac

trac-admin not working on Amazon AMI

Subscribe to trac-admin not working on Amazon AMI 15 post(s), 4 voice(s)

 
Avatar nick 4 post(s)

Hi – I am getting a series of errors when trying to run trac-admin on my Amazon AMI. I have gone to the installation directory (/opt/bitnami/) and typed . scripts/setenv.sh . I have then tried to execute /opt/bitnami/trac/bin/trac-admin help (which should just bring up help file). Whether I do help or any other command, including initenv, I get a series of “command not found” errors e.g. line 3: requires: command not found. I think I have set all permissions correctly. Help!

Thanks

Nick

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

Try to run the trac-admin tool with the python binary:

$ python /opt/bitnami/trac/bin/trac-admin help

 
Avatar nick 4 post(s)

I get:

-bash: bq.$: command not found

Nick

 
Avatar nick 4 post(s)

Sorry, have done . scripts/setenv.sh first and now get:

/usr/bin/python: /opt/bitnami/common/lib/libz.so.1: no version information available (required by /usr/bin/python)
‘import site’ failed; use -v for traceback
Traceback (most recent call last):
File “/usr/lib/command-not-found”, line 8, in
import CommandNotFound
ImportError: No module named CommandNotFound

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

Could you check the first line in the trac-admin script? If it is “#!/usr/bin/python”, could you try to modify to “#!/opt/bitnami/python/bin/python”?

 
Avatar nick 4 post(s)

Script contains #!/opt/bitnami/python/bin/python

Nick

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Thanks for reporting it. We will investigate this issue.

 
Avatar victoria Administrator 134 post(s)

Hi,

I have tested executing:

. /opt/bitnami/scripts/setenv.sh
python /opt/bitnami/trac/bin/trac-admin

and it works.

Could you try it again? the bq.$ that you instruced was not part of the command.

In any case we will investigate the cause of the error related to zlib and /usr/bin/python.

 
Avatar andrew 14 post(s)

The Mac OS X stack has a similar problem on Snow Leopard. The setenv.sh fix didn’t help, but changes the error a bit.

On the first run (before setenv.sh) it launches my X11 server and the script hangs until I shut down the server (no windows open though, and it’s not an xhost problem since things like xclock work). On the second run (after setenv.sh) it doesn’t try X11. On my other machine (running Leopard) it fails similarly but I don’t recall the error about /var/mail. Here’s the transcript:


$ ./use_trac
bash-3.2$ trac-admin
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 3: requires: command not found
X connection to /tmp/launch-csQcUz/org.x:0 broken (explicit kill or server shutdown).
from: can’t read /var/mail/pkg_resources
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: syntax error near unexpected token `newline’
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: `sys.exit(’
bash-3.2$ . scripts/setenv.sh
bash-3.2$ trac-admin
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 3: requires: command not found
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Applications/trac-0.11.6-1/common/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 4: 5208 Trace/BPT trap import sys
from: can’t read /var/mail/pkg_resources
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: syntax error near unexpected token `newline’
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: `sys.exit(’
bash-3.2$ uname -a
Darwin iMac.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386

 
Avatar andrew 14 post(s)

Actually, it’s pretty much the same on Leopard as Snow Leopard, except it didn’t try to do anything with X11:


$ ./use_trac
bash-3.2$ trac-admin
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 3: requires: command not found
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 4: import: command not found
from: can’t read /var/mail/pkg_resources
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: syntax error near unexpected token `newline’
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: `sys.exit(’
bash-3.2$ . scripts/setenv.sh
bash-3.2$ trac-admin
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 3: requires: command not found
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 4: import: command not found
from: can’t read /var/mail/pkg_resources
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: syntax error near unexpected token `newline’
/Applications/trac-0.11.6-1/trac/bin/trac-admin: line 7: `sys.exit(’
bash-3.2$ uname -a
Darwin hostname-removed 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Please try the following:

$ ./use_trac
$ python /Applications/trac-0.11.6-1/trac/bin/trac-admin

or replace the following in the /Applications/trac-0.11.6-1/trac/bin/trac-admin:

#!/opt/bitnami/python/bin/python

with

#!/usr/bin/env /opt/bitnami/python/bin/python

and then run the follwing commands:

$ ./use_trac
$ trac-admin

We will fix this issue in the next version. I hope it helps.

 
Avatar andrew 14 post(s)

Thanks for the reply. I tried both fixes and I’m a little confused by the result — I’m sure this illustrates my lack of python experience, so forgive me for that. For the first solution, trac-admin with no args spits out the help as expected, which is encouraging, but if I try to run a command, it goes into an interactive mode using the command in the path, and then fails because the path doesn’t exist!


$ ./use_trac
bash-3.2$ cat trac/bin/trac-admin
#!/Applications/trac-0.11.6-1/python/bin/python

  1. EASY-INSTALL-ENTRY-SCRIPT: ‘Trac==0.11.6’,‘console_scripts’,‘trac-admin’
    requires = ‘Trac==0.11.6’
    import sys
    from pkg_resources import load_entry_point

sys.exit(
load_entry_point(‘Trac==0.11.6’, ‘console_scripts’, ‘trac-admin’)()
)
bash-3.2$ python /Applications/trac-0.11.6-1/trac/bin/trac-admin resync
Welcome to trac-admin 0.11.6
Interactive Trac administration console.
Copyright © 2003-2009 Edgewall Software

Type: ‘?’ or ‘help’ for help on commands.

Trac [/Applications/trac-0.11.6-1/resync]> help resync
resync
— Re-synchronize trac with the repository

resync
— Re-synchronize only the given

Trac [/Applications/trac-0.11.6-1/resync]> resync
Failed to open environment. [Errno 2] No such file or directory: ‘/Applications/trac-0.11.6-1/resync/VERSION
Traceback (most recent call last):
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/admin/console.py”, line 177, in env_open
self.__env = Environment(self.envname)
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/env.py”, line 209, in init
self.verify()
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/env.py”, line 277, in verify
fd = open(os.path.join(self.path, ‘VERSION’), ‘r’)
IOError: [Errno 2] No such file or directory: ‘/Applications/trac-0.11.6-1/resync/VERSION
bash-3.2$

It does the same thing if I use “bogus” as the comment, for example.


bash-3.2$ python /Applications/trac-0.11.6-1/trac/bin/trac-admin bogus
Welcome to trac-admin 0.11.6
Interactive Trac administration console.
Copyright © 2003-2009 Edgewall Software

Type: ‘?’ or ‘help’ for help on commands.

Trac [/Applications/trac-0.11.6-1/bogus]> resync
Failed to open environment. [Errno 2] No such file or directory: ‘/Applications/trac-0.11.6-1/bogus/VERSION
Traceback (most recent call last):
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/admin/console.py”, line 177, in env_open
self.__env = Environment(self.envname)
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/env.py”, line 209, in init
self.verify()
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/env.py”, line 277, in verify
fd = open(os.path.join(self.path, ‘VERSION’), ‘r’)
IOError: [Errno 2] No such file or directory: ‘/Applications/trac-0.11.6-1/bogus/VERSION
bash-3.2$

For the second suggestion, I assume I should replace the “/opt/bitnami” path with my /Applications/trac path, but I tried it both ways to be sure, and with my correct path it behaves the same as the above description:


$ ./use_trac
bash-3.2$ cat trac/bin/trac-admin
#!/usr/bin/env /Applications/trac-0.11.6-1/python/bin/python

  1. EASY-INSTALL-ENTRY-SCRIPT: ‘Trac==0.11.6’,‘console_scripts’,‘trac-admin’
    requires = ‘Trac==0.11.6’
    import sys
    from pkg_resources import load_entry_point

sys.exit(
load_entry_point(‘Trac==0.11.6’, ‘console_scripts’, ‘trac-admin’)()
)
bash-3.2$ trac-admin resync
Welcome to trac-admin 0.11.6
Interactive Trac administration console.
Copyright © 2003-2009 Edgewall Software

Type: ‘?’ or ‘help’ for help on commands.

Trac [/Applications/trac-0.11.6-1/resync]> resync
Failed to open environment. [Errno 2] No such file or directory: ‘/Applications/trac-0.11.6-1/resync/VERSION
Traceback (most recent call last):
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/admin/console.py”, line 177, in env_open
self.__env = Environment(self.envname)
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/env.py”, line 209, in init
self.verify()
File “/Applications/trac-0.11.6-1/trac/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/env.py”, line 277, in verify
fd = open(os.path.join(self.path, ‘VERSION’), ‘r’)
IOError: [Errno 2] No such file or directory: ‘/Applications/trac-0.11.6-1/resync/VERSION
bash-3.2$

 
Avatar victoria Administrator 134 post(s)

Hi,

Is it possible that you are not the using trac-admin tool correctly?

bash-3.2$ trac-admin help trac-admin - The Trac Administration Console 0.11.6

Usage: trac-admin </path/to/projenv> [command [subcommand] [option …]]

Before the command, you need to include the path to the project. For instance if you want to create a new project you can execute:

trac-admin projects/NEWPROJECT initenv

and you will be prompted to enter more information about the settings for the new project.

Also you could use:

trac-admin projects/NEWPROJECT

and in the trac-admin console execute initenv.

Most of the trac-admin ommands requires the project to exist, so if ‘bogus’ doesn’t exist, the resync command will fail.

Please let us know if this is what if happening. Thanks.

 
Avatar andrew 14 post(s)

Oh that’s embarrassing — you’re right, I was not using trac-admin correctly! I haven’t used it much before and ran into this when it complained about needing a resync, and I was omitting the path. I was confused when it interpreted my single argument (which I was thinking was a command) as a repository instead. Thanks for setting me straight. When used correctly, trac-admin with the fix to the file as suggested above (putting in /usr/bin/env) works for me now, so I’m in business.

Thanks again!

 
Avatar andrew 14 post(s)

(Correction, I should have said it was interpreting my single argument as a (trac) project, not repository. Also, I wanted to add that this testing has been on Mac OS X 10.6.3, in case you’re tracking that.)

Forums Trac