Code Monkey home page Code Monkey logo

Comments (15)

vbabiy avatar vbabiy commented on May 18, 2024

Ah. My bad. The script's call to "tempfile" fails
(http://manpages.ubuntu.com/manpages/lucid/man1/tempfile.1.html), so it
doesn't generate the temporary file for the old prompt, and everything falls
apart from there.

I'll change this to something more standard. It looks like mktemp is the
favoured way of doing the same thing?

If you swap that line in activate.fish (line 49), from:

set -l oldpromptfile (tempfile)

to:

set -l oldpromptfile (mktemp)

does it start working for you?


Original Comment By: Christopher Nilsson

from virtualenv.

vbabiy avatar vbabiy commented on May 18, 2024

I've pushed some updates to my fork, over at:
http://bitbucket.org/otherchirps/virtualenv .

It should now use mktemp, instead of tempfile. Hopefully that's more
widespread. Also, should mktemp be unavailable, it will fallback to a simple
prompt change. (There'll still be an error, complaining about mktemp not being
found, but at least it won't just bomb out without letting you know the
virtual env vars are "in play".)

From what I can tell, it seems to fix the problem.

Please review. If all is well, I'll send a pull request.


Original Comment By: Christopher Nilsson

from virtualenv.

vbabiy avatar vbabiy commented on May 18, 2024

Works like a charm.


Original Comment By: Wilfred

from virtualenv.

vbabiy avatar vbabiy commented on May 18, 2024

On OSX, mktime doesn't work like on linux (not the same arguments). The only
portable way is to use python: python -c 'import tempfile;print(tempfile.mkstemp()[1])'


Original Comment By: chs

from virtualenv.

vbabiy avatar vbabiy commented on May 18, 2024

Ah...

I don’t have a Mac available, so perhaps someone else can confirm this for me.
Judging by the docs it looks that on Mac OS X (and in turn, some of the
BSDs), mktemp requires a mandatory argument. Either you have to supply a
full filename template, or use the -t flag, which will append the given
filename pattern to the $TMPDIR. eg. "mktemp -t foo.XXX" gives
"/tmp/foo.ulG".

For linux & friends using the GNU Coreutils implementation (which is what
I tested under), mktemp doesn’t require any arguments, since it will happily
assume an implicit -t with a default value.

Spinning up a python interpreter, as suggested, would work well. However, it’s
probably lighter to simply supply the optional arguments (eg. “mktemp -t tmp.oldpromptcontents.XXXX”, or something), since this should work across all
these platforms as well. I’ve uploaded this change to my fork, as before. Let
me know if it works for you or not.

Of course, if my reading of this is wrong, calling on python will probably be
the best way to go. Definitely portable. And since we’re trying to activate a
virtualenv, it’s a safe bet python is available. :)

/ManPages/man1/mktemp.1.html

invocation.html#mktemp-invocation


Original Comment By: Christopher Nilsson

from virtualenv.

KangOl avatar KangOl commented on May 18, 2024

it work with mktemp -t tmp.oldpromptcontents.XXXX

from virtualenv.

maxcountryman avatar maxcountryman commented on May 18, 2024

+1 would be great to see this patched

from virtualenv.

carljm avatar carljm commented on May 18, 2024

Fixed in 9be1f43 - thanks @dsc.

from virtualenv.

dsc avatar dsc commented on May 18, 2024

Sorry I didn't reply earlier -- I couldn't get to the bottom of the reason for the changes to ez_setup.py and then it fell off my plate. Great to see it merged into master!

from virtualenv.

skeet70 avatar skeet70 commented on May 18, 2024

I'm still having a problem with this, heres what I get when running . bin/activate.fish with both fish 1.23.1 and beta r2 fishfish and virtualenv 1.8.2:

fish: Could not locate end of block. The 'end' command is missing, misspelled or a ';' is missing.
/private/tmp/.psub.99273.11049 (line 1): function _old_fish_prompt
                                         ^
in . (source) call of file '/private/tmp/.psub.99273.11049',
    called on line 50 of file '/env/research_experiment/django_apache/bin/activate.fish',

in . (source) call of file '/env/research_experiment/django_apache/bin/activate.fish',
    called on standard input,


       function − function ‐ create a function

function ‐ create a function
   # snipped fish man page on function

.: Error while reading file '/private/tmp/.psub.99273.11049'
fish: Unknown command '_old_fish_prompt'
/env/research_experiment/django_apache/bin/activate.fish (line 57): _old_fish_prompt
                                                                    ^
in command substitution
    called on line 69 of file '/env/research_experiment/django_apache/bin/activate.fish',

in function 'fish_prompt',
    called on standard input,

in command substitution
    called on standard input,

Environment is successfully set up though, and prompt changes to a blue (env_name). Every command works but throws:

(django_apache)virtualenv --version
1.8.2
fish: Unknown command '_old_fish_prompt'
/env/research_experiment/django_apache/bin/activate.fish (line 57): _old_fish_prompt
                                                                    ^
in command substitution
    called on line 69 of file '/env/research_experiment/django_apache/bin/activate.fish',

in function 'fish_prompt',
    called on standard input,

in command substitution
    called on standard input,

Something I need to change, or a bug?

from virtualenv.

gabriel4649 avatar gabriel4649 commented on May 18, 2024

I'm getting the same errors as skeet70

from virtualenv.

sumeet avatar sumeet commented on May 18, 2024

confirmed, same error. i'm on snow leopard, virtualenv 1.8.2 and python 2.6.

from virtualenv.

mcassiano avatar mcassiano commented on May 18, 2024

Keeps throwing error below in every command.
Mountain Lion running virtualenv 1.9.1

.: Error encountered while sourcing file ' -- psub -Q -o hf --':
.: Value too large to be stored in data type
fish: Unknown command '_old_fish_prompt'
/Users/matheus/Desktop/work/env/bin/activate.fish (line 57): _old_fish_prompt
                                                                ^
in command substitution
    called on line 69 of file '/Users/matheus/Desktop/work/env/bin/activate.fish',

in function 'fish_prompt',
    called on standard input,

in command substitution
    called on standard input,

from virtualenv.

gabriel4649 avatar gabriel4649 commented on May 18, 2024

For Fish users I would recommend to just move to Virtual Fish, it works really great. I never got this to work but Virtual Fish works flawlessly.

from virtualenv.

mcassiano avatar mcassiano commented on May 18, 2024

I'll check it out. Thanks :)

from virtualenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.