[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] How can I add a path to the QProcess PATH environment variable?
From: J Barchan <jnbarchan () gmail ! com>
Date: 2018-11-23 15:56:23
Message-ID: CABz3M__yxjUsb0KFae0tgT+5hjv1zO9AGivdcpa5MkvZdjCRLA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Fri, 23 Nov 2018 at 15:44, Kyle Altendorf <sda@fstab.net> wrote:
>
>
> On November 23, 2018 10:38:33 AM EST, J Barchan <jnbarchan@gmail.com>
> wrote:
> > On Fri, 23 Nov 2018 at 15:27, Kyle Altendorf <sda@fstab.net> wrote:
> >
> > > Why not just specify the full path to execute? Setting PATH is for
> > > configuring other processes and being 'lazy' in a shell (reasonable
> > lazy,
> > > not bad lazy).
> > >
> > > Cheers,
> > > -kyle
> > >
> > > On November 23, 2018 4:14:42 AM EST, J Barchan <jnbarchan@gmail.com>
> > > wrote:
> > > > On Fri, 23 Nov 2018 at 09:04, <kristof.mulier@telenet.be> wrote:
> > > >
> > > > > Dear PyQt developers/users,
> > > > >
> > > > > I'm using a QProcess()-instance to execute commands. The
> > > > QProcess()-instance
> > > > > automatically inherits the standard environment, for example the
> > PATH
> > > > > environment variable. So if the command is an executable, it can
> > only
> > > > find
> > > > > it if it's in the PATH variable.
> > > > > Once the QProcess()-instance exists, I just can't add anything to
> > > > its
> > > > > PATH variable. Well, actually I can, but it doesn't have any
> > effect.
> > > > I've
> > > > > explained everything in great details on StackOverflow:
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> https://stackoverflow.com/questions/53438065/how-can-i-add-a-path-to-the-qprocess-path-environment-variable-pyqt5-on-python
>
> > > > >
> > > > > I would be very thankful if you can have a look at it :-)
> > > > >
> > > > > Kind greetings,
> > > > >
> > > > > Kristof Mulier
> > > > > _______________________________________________
> > > > > PyQt mailing list PyQt@riverbankcomputing.com
> > > > > https://www.riverbankcomputing.com/mailman/listinfo/pyqt
> > > >
> > > >
> > > > I have posted a comment at *SO*:
> > > >
> > > > > I think you're misunderstanding. You are trying to affect the PATH
> > > > > environment which gets passed to the sub-process. What you *want*
> > to
> > > > do
> > > > > is simply alter the PATH environment in the *parent*, it is that
> > > > which
> > > > > needs to find your executable before the sub-process can get
> > spawned.
> > > > And
> > > > > if you want to, then change your parent's PATH back *after* the
> > > > > sub-process has been spawned
> > > > >
> > >
> >
> > @Kyle
> > I would have suggested that! But the way I took the OP's full question
> > in
> > *SO* was "it *might* be on the PATH already, I don't know, so I just
> > want
> > to add something to the PATH to be sure just for this one-time spawn,
> > and
> > then let the OS find it somewhere for sure. And, I don't fancy doing
> > the
> > PATH search myself from code". :)
>
> If they know it's available in the new location and they put that first in
> the PATH, it's not going to look anywhere else. But sure, maybe there's
> more nuance somehow.
>
> Also, why the \r\n?
>
@Kyle, @kristof
Have put a couple of further comments into the *SO* thread to bring Kyle's
comments to OP's attention.
--
Kindest,
Jonathan
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_default" \
style="font-family:tahoma,sans-serif"><br></div><br><div class="gmail_quote"><div \
dir="ltr">On Fri, 23 Nov 2018 at 15:44, Kyle Altendorf <<a \
href="mailto:sda@fstab.net">sda@fstab.net</a>> wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><br> <br>
On November 23, 2018 10:38:33 AM EST, J Barchan <<a \
href="mailto:jnbarchan@gmail.com" target="_blank">jnbarchan@gmail.com</a>> \
wrote:<br> >On Fri, 23 Nov 2018 at 15:27, Kyle Altendorf <<a \
href="mailto:sda@fstab.net" target="_blank">sda@fstab.net</a>> wrote:<br> ><br>
>> Why not just specify the full path to execute? Setting PATH is for<br>
>> configuring other processes and being 'lazy' in a shell \
(reasonable<br> >lazy,<br>
>> not bad lazy).<br>
>><br>
>> Cheers,<br>
>> -kyle<br>
>><br>
>> On November 23, 2018 4:14:42 AM EST, J Barchan <<a \
href="mailto:jnbarchan@gmail.com" target="_blank">jnbarchan@gmail.com</a>><br> \
>> wrote:<br> >> >On Fri, 23 Nov 2018 at 09:04, <<a \
href="mailto:kristof.mulier@telenet.be" \
target="_blank">kristof.mulier@telenet.be</a>> wrote:<br> >> ><br>
>> >> Dear PyQt developers/users,<br>
>> >><br>
>> >> I'm using a QProcess()-instance to execute commands. The<br>
>> >QProcess()-instance<br>
>> >> automatically inherits the standard environment, for example \
the<br> >PATH<br>
>> >> environment variable. So if the command is an executable, it \
can<br> >only<br>
>> >find<br>
>> >> it if it's in the PATH variable.<br>
>> >> Once the QProcess()-instance exists, I just can't add \
anything to<br> >> >its<br>
>> >> PATH variable. Well, actually I can, but it doesn't have \
any<br> >effect.<br>
>> >I've<br>
>> >> explained everything in great details on StackOverflow:<br>
>> >><br>
>> >><br>
>> >><br>
>> ><br>
>><br>
><a href="https://stackoverflow.com/questions/53438065/how-can-i-add-a-path-to-the-qprocess-path-environment-variable-pyqt5-on-python" \
rel="noreferrer" target="_blank">https://stackoverflow.com/questions/53438065/how-can-i-add-a-path-to-the-qprocess-path-environment-variable-pyqt5-on-python</a><br>
>> >><br>
>> >> I would be very thankful if you can have a look at it :-)<br>
>> >><br>
>> >> Kind greetings,<br>
>> >><br>
>> >> Kristof Mulier<br>
>> >> _______________________________________________<br>
>> >> PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a><br> >> >> <a \
href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" \
target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br> \
>> ><br> >> ><br>
>> >I have posted a comment at *SO*:<br>
>> ><br>
>> >> I think you're misunderstanding. You are trying to affect the \
PATH<br> >> >> environment which gets passed to the sub-process. What you \
*want*<br> >to<br>
>> >do<br>
>> >> is simply alter the PATH environment in the *parent*, it is \
that<br> >> >which<br>
>> >> needs to find your executable before the sub-process can get<br>
>spawned.<br>
>> >And<br>
>> >> if you want to, then change your parent's PATH back *after* \
the<br> >> >> sub-process has been spawned<br>
>> >><br>
>><br>
><br>
>@Kyle<br>
>I would have suggested that! But the way I took the OP's full question<br>
>in<br>
>*SO* was "it *might* be on the PATH already, I don't know, so I just<br>
>want<br>
>to add something to the PATH to be sure just for this one-time spawn,<br>
>and<br>
>then let the OS find it somewhere for sure. And, I don't fancy doing<br>
>the<br>
>PATH search myself from code". :)<br>
<br>
If they know it's available in the new location and they put that first in the \
PATH, it's not going to look anywhere else. But sure, maybe there's more \
nuance somehow.<br> <br>
Also, why the \r\n?<br>
</blockquote></div><div><br></div><div><div style="font-family:tahoma,sans-serif" \
class="gmail_default">@Kyle, @kristof</div><div style="font-family:tahoma,sans-serif" \
class="gmail_default">Have put a couple of further comments into the <b>SO</b> thread \
to bring Kyle's comments to OP's attention.<br></div><br></div><br>-- \
<br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div \
dir="ltr"><div><div dir="ltr"><div><span \
style="font-family:tahoma,sans-serif">Kindest,</span></div><div><span \
style="font-family:tahoma,sans-serif">Jonathan</span></div></div></div></div></div></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic