[Geany-Users] Use python virtualenvs in Geany

Lex Trotman elextr at xxxxx
Mon Feb 3 10:28:27 UTC 2014


On 3 February 2014 20:48, Sayth Renshaw <flebber.crue at gmail.com> wrote:

> Thanks Enrico that does seem to work on the file I have
>
> using bin/python "%f" and %p as my working directory.
>
> I can't however get a working version of a /bin/sh -c %p/bin/activate;
> python %f style virtualenv command. I have tried many versions but just
> can't get it working. This one finds activate and the file but fails.
>

Did you actually include the "/bin/sh -c" as part of the command?  Because,
as I said before, the whole command is already prefixed by /bin/sh -c
inside Geany.  So then when you included it in the command it ran the part
before the semicolon in a subshell, so the activate just ran in the
sub-shell, and the python ran in the top level shell which didn't know any
of the activate settings

Just run:

 ./bin/activate; python %f

with working dir %p

Cheers
Lex


> /bin/sh -c /home/sayth/Projects/Test/bin/activate; python file1.py (in
> directory: /home/sayth/Projects/Test)
>
> Traceback (most recent call last):
>   File "file1.py", line 3, in <module>
>     import django
> ImportError: No module named django
> Compilation failed.
>
> Sayth
>
>
>
>
> On Sun, Feb 2, 2014 at 10:02 PM, Enrico Tröger <enrico.troeger at uvena.de>wrote:
>
>> On 02/02/14 01:12, Sayth Renshaw wrote:
>> > OK using vanilla virtualenv(no wrapper) and with built in project from
>> > geany I have ~/Projects/Test/bin/activate for virtualenv.
>> >
>> > The project is open and so %p as working directory works perfectly,
>> however
>> > it returns error on source /bin/sh:1 :source "not found.
>> >
>> > Updated the command to source bin/activate; python "%f" as thats the
>> usual
>> > command line activation. still same error.
>>
>> I'm afraid I wasn't clear enough about what I meant:
>> Instead of using the 'bin/activate' script at all, just use the Python
>> interpreter in the virtualenv's bin directory as this should know the
>> paths already.
>>
>> Something like this could be your build command:
>>
>> %p/env/bin/python "%f"
>>
>> (provided that your virtualenv is called 'env' in the project directory)
>>
>> Regards,
>> Enrico
>>
>> --
>> Get my GPG key from http://www.uvena.de/pub.asc
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.geany.org
>> https://lists.geany.org/cgi-bin/mailman/listinfo/users
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/users/attachments/20140203/ef576fd0/attachment.html>


More information about the Users mailing list