Opened 6 years ago

# TRAC_ENV_PARENT_DIR is not defined error

Reported by: Owned by: rharman izzy normal TracUserSyncPlugin normal 0.11

I have configure your plugin on system however when I try to open User sync under the admin page I get the following error.

TRAC_ENV_PARENT_DIR is not defined - so we cannot do anything!

I am running trac 11.5 on a windows box with apache 2.2 and python 2.5.

I have multiple project configure and are using the TracEnvParentDir as below. I have tried with underscores but this does not help and stops my main page from running.

PythonOption TracEnvParentDir "D:/Trac/Projects"


Any help?

### comment:1 Changed 6 years ago by Ryan J Ollos

Description: modified (diff)

### comment:2 Changed 6 years ago by izzy

Sorry for the delayed reply - I'm quite busy at some other projects currently. I have no windows machine to test that - MS free zone here.

The TRAC_ENV_PARENTDIR is looked up with the following statement: parentdir = os.getenv('TRAC_ENV_PARENT_DIR'). The error message you are getting is fired if that returns FALSE.

When I last tried it, I was using mod_python and had it defined by PythonOption TracEnvParentDir /path/to/trac_parent. I however switched to mod_wsgi a while ago, so this went into the wsgi script as os.environ['TRAC_ENV_PARENT_DIR'] = '/path/to/trac_parent', which works fine here on Ubuntu 8.04 (just tested again to make sure).

You could look in your trac logs for a debug message starting with "TRAC_ENV_PARENT_DIR found:" to see what it has found. According to your description, there should be nothing mentioned after the colon (otherwise the error message should not appear).

I have no idea why why os.getenv('TRAC_ENV_PARENT_DIR') should not work on Windows.

### comment:3 Changed 6 years ago by rharman

No luck with the log file, could not see any entry as you have suggested. have attached the file.

### comment:4 Changed 6 years ago by rharman

any other suggestion for us poor folks in the MS world, would greatly appreciated.

thanks

### comment:5 Changed 6 years ago by izzy

Are you at least a bit familar with Python? If you can figure out why the environment variable cannot be read there - or rather, how that should work on Windows - I could try to adjust that. The only other thing I could think of is adding another input element so you could manually specify the directory, if that would help you?

### comment:6 Changed 6 years ago by rharman

Sorry Python and Trac are new to me. i would like to learn but have to many other distraction to give the effort it requires at the moment.

If you have the time and can add another input method (trac.ini?) would be great and make my life a lot easier.

Thanks

### comment:7 Changed 6 years ago by izzy

Status: new → assigned

I see what I can do, and when time permits. And yes, with the above mentioned "input" I meant a value stored in trac.ini - not something you had to enter over and over again ;)

I will update this ticket when I've accomplished something.

### comment:8 Changed 6 years ago by anonymous

I'm running Ubuntu 10.10 and am also getting this error, any ideas?

### comment:9 Changed 6 years ago by anonymous

I should add that I do have PythonOption TracEnvParentDir /path/to/trac_parent in my Apache VirtualHost options.

### comment:10 Changed 6 years ago by anonymous

Same problem. Still problem when I added

SetEnv TRAC_ENV_PARENT_DIR "/var/www/trac"


in trac.conf. I'm using CentOS 5.5, Apache 2.2.3, Python 2.4.3

### Modify Ticket

Change Properties