AstraLuma / xontrib-avox

autovox policy based on project directories
GNU General Public License v3.0
10 stars 3 forks source link

Shows `Unconfigured $PROJECT_DIRS.` if loaded through xonfig #3

Closed alairock closed 4 years ago

alairock commented 8 years ago

Having defined $PROJECT_DIRS in my .xonshrc, on boot I get the following error:

Warning: Unconfigured $PROJECT_DIRS. Using ~/code

From chat:

getting Warning: Unconfigured $PROJECT_DIRS. Using ~/code I have it defined: $PROJECT_DIRS = [os.path.expanduser('~/dev')]

Jamie Bliss @astronouth7303 12:01 are you loading xontribs in xonfig or xonshrc? i think it's throwing that error because it tries to do stuff on load, and it's not defined at load time (disclaimer: avox is not part of the xonsh project, but i happen to be the maintainer)

Skyler Lewis @alairock 12:03 xontribs are being loaded in the ~/.configs/xonsh/config.json Using: "xontribs": [ "vox", "prompt_ret_code", "docker_tabcomplete", "autoxsh", "avox", "z" }

Jamie Bliss @astronouth7303 12:03 it's not hurting, but it'll keep printing that

Skyler Lewis @alairock 12:03 Makes sense.

Jamie Bliss @astronouth7303 12:03 please file a bug in astronouth7303/xontrib-avox i'll fix it if i can figure out a way to do so

...

Jamie Bliss @astronouth7303 12:05 the work around is to load avox in xonshrc and not in xonfig unfortunately, at this time the only way to "fix" it is to have it not try to work when you load it so if you load it or xonsh starts in a project directory, it wouldn't pick that up

brianmay commented 7 years ago

I am seeing this error even if I set $PROJECT_DIRS both in ~/.configs/xonsh/config.json and in ~/.xonshrc.

Furthermore, if xonsh is started in the project dir, it doesn't activate the avox environment. I have to cd to another directory (produces an error when it tries to deactivate the environment that was never activated), and then CC back into the directory again.

xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
xontrib.voxapi.NoEnvironmentActive: No environment currently active.
Exception raised in event handler; ignored.
brianmay commented 7 years ago

Whoops, my bad. I misread that. Need to load avox from ~/.xonshrc. That seems to help.

Worth noting that the xonsh first time configuration prefers to use ~/.configs/xonsh/config.json.

AstraLuma commented 7 years ago

I'll have to look in to supporting config.json more.

brianmay commented 7 years ago

It appears that loading avox should happen after inserting items at the start of $PATH. Otherwise you end up with a PATH that looks like:

$PATH=/usr/local/bin:/Users/brianmay/.virtualenvs/<myproject>/bin:/usr/bin:/bin

Which looks OK initially. However when leaving the environment, both first two items are removed, leaving you with:

$PATH=/usr/bin:/bin

Which is missing the /usr/local/bin.

Loading avox last, means it gets the first item in the stack, which is probably what it expects.

AstraLuma commented 7 years ago

Ok, yup. I need to change how it's initialized.

AstraLuma commented 4 years ago

Closing this since xonsh itself removed the xonfig feature.