Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   new machine : suddenly Python 3 appears (http://www.linux-archive.org/gentoo-user/704481-new-machine-suddenly-python-3-appears.html)

Philip Webb 09-17-2012 12:24 AM

new machine : suddenly Python 3 appears
 
We've been warned not to use Python 3 , so it's not installed in this box,
but it was included along with Python 2 in the Stage3 for the new machine.
I now find that 13 pkgs have been compiled relying on it
& Portage refuses to unmerge it. Is this safe ?

--
========================,,======================== ====================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca

Dale 09-17-2012 12:46 AM

new machine : suddenly Python 3 appears
 
Philip Webb wrote:
> We've been warned not to use Python 3 , so it's not installed in this box,
> but it was included along with Python 2 in the Stage3 for the new machine.
> I now find that 13 pkgs have been compiled relying on it
> & Portage refuses to unmerge it. Is this safe ?
>


If you want to get rid of python3, you need to put -python3 in your
make.conf and then do a emerge -Na world to rebuild. That should
rebuild everything that was built against python3 then you can unemerge
it and emerge shouldn't complain either. If it does, you need to make
sure why before removing it.

Hope that helps.

Dale

:-) :-)

--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

Michael Mol 09-17-2012 01:03 AM

new machine : suddenly Python 3 appears
 
On Sun, Sep 16, 2012 at 8:24 PM, Philip Webb <purslow@ca.inter.net> wrote:
> We've been warned not to use Python 3

Maybe I missed something...but by whom?


--
:wq

Dale 09-17-2012 01:18 AM

new machine : suddenly Python 3 appears
 
Michael Mol wrote:
> On Sun, Sep 16, 2012 at 8:24 PM, Philip Webb <purslow@ca.inter.net> wrote:
>> We've been warned not to use Python 3
> Maybe I missed something...but by whom?
>
>


I think he means that we are not supposed to set the system default to
python3. I'm just reading tea leaves, between the lines etc but that
was the way I took it.

Dale

:-) :-)

--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

Michael Mol 09-17-2012 01:24 AM

new machine : suddenly Python 3 appears
 
On Sun, Sep 16, 2012 at 9:18 PM, Dale <rdalek1967@gmail.com> wrote:
> Michael Mol wrote:
>> On Sun, Sep 16, 2012 at 8:24 PM, Philip Webb <purslow@ca.inter.net> wrote:
>>> We've been warned not to use Python 3
>> Maybe I missed something...but by whom?
>
> I think he means that we are not supposed to set the system default to
> python3. I'm just reading tea leaves, between the lines etc but that
> was the way I took it.

And portage's deps don't handle it? Weird.

--
:wq

Dale 09-17-2012 01:54 AM

new machine : suddenly Python 3 appears
 
Michael Mol wrote:
> On Sun, Sep 16, 2012 at 9:18 PM, Dale <rdalek1967@gmail.com> wrote:
>> Michael Mol wrote:
>>> On Sun, Sep 16, 2012 at 8:24 PM, Philip Webb <purslow@ca.inter.net> wrote:
>>>> We've been warned not to use Python 3
>>> Maybe I missed something...but by whom?
>> I think he means that we are not supposed to set the system default to
>> python3. I'm just reading tea leaves, between the lines etc but that
>> was the way I took it.
> And portage's deps don't handle it? Weird.
>


Well, it appears he just doesn't want python3 on his system. Cool by me
since he may have some good reason for it. So, if he wants it gone as
his post suggests, I just told him how to do it that hopefully won't
break things.

Dale

:-) :-)

--
I am only responsible for what I said ... Not for what you understood or how you interpreted my words!

Neil Bothwick 09-17-2012 08:04 AM

new machine : suddenly Python 3 appears
 
On Sun, 16 Sep 2012 20:24:01 -0400, Philip Webb wrote:

> We've been warned not to use Python 3 , so it's not installed in this
> box, but it was included along with Python 2 in the Stage3 for the new
> machine. I now find that 13 pkgs have been compiled relying on it
> & Portage refuses to unmerge it. Is this safe ?

Perfectly safe, because we weren't warned to not use it, only to not set
it as the default. That is reasonable because older scripts won't be
aware of the differences between python 2 and 3, while newer scripts can
explicitly call whichever version they need. The only problem with
setting python 3 as the default is that some older scripts may break.

Since portage became python3- aware there is no reason to not have it
installed beyond the 30MB of disk space it occupies.


--
Neil Bothwick

WinErr 00C: Memory hog error - More Ram needed. More! More! More!

Philip Webb 09-17-2012 05:14 PM

new machine : suddenly Python 3 appears
 
120917 Neil Bothwick wrote:
> On Sun, 16 Sep 2012 20:24:01 -0400, Philip Webb wrote:
>> We've been warned not to use Python 3 , so it's not installed in this
>> box, but it was included along with Python 2 in the Stage3 for the new
>> machine. I now find that 13 pkgs have been compiled relying on it
>> & Portage refuses to unmerge it. Is this safe ?
> Perfectly safe, because we weren't warned to not use it,
> only to not set it as the default. That is reasonable
> because older scripts aren't aware of the differences between Python 2/3,
> while newer scripts can explicitly call whichever version they need.
> The only problem with setting Python 3 as the default
> is that some older scripts may break.

I discovered this because my little script to do CLI calculations
-- by far the fastest of anything, if you don't need variables --
wouldn't work in the new machine till I did s/python/python2 .

In case others might like to use it, the script is :

#!/usr/bin/python2
from math import *
import sys
expression = sys.argv[1]
print ' ',eval(expression)

Its help is via 'pydoc math'. Expressions need quotes if they have brackets.

It was failing with a syntax error in the print line,
when the 1st line read #!/usr/bin/python ,
so I have to assume (1) that Python3 has been set as default
-- No ! I didn't do it ! -- & (2) its syntax for printing has changed.

Thanks for the polite explanation. Further comments welcome.

--
========================,,======================== ====================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca

David W Noon 09-17-2012 06:08 PM

new machine : suddenly Python 3 appears
 
On Mon, 17 Sep 2012 13:14:27 -0400, Philip Webb wrote about Re:
[gentoo-user] new machine : suddenly Python 3 appears:

> In case others might like to use it, the script is :
>
> #!/usr/bin/python2
> from math import *
> import sys
> expression = sys.argv[1]
> print ' ',eval(expression)

The above line uses obsolete syntax. A big RTFM is required to get the
new syntax, as print is no longer a statement, but a subroutine (or
"void function" in C-speak).

> Its help is via 'pydoc math'. Expressions need quotes if they have
> brackets.
>
> It was failing with a syntax error in the print line,
> when the 1st line read #!/usr/bin/python ,
> so I have to assume (1) that Python3 has been set as default
> -- No ! I didn't do it ! -- & (2) its syntax for printing has changed.

The latter -- and perhaps the former too, but that is irrelevant from
a going-forward point of view.

In fact, print changed a few years back, but Python 2,x tolerates the
old syntax unless you specify the -3 run-time option. This option was
also recommended a few years back, so that syntax that will be flagged
by Python 3.x can be detected early (i.e. a few years back). So, try
using
#!/usr/bin/python2 -3
for your hash-bang line on all your old Python scripts.
--
Regards,

Dave [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
dwnoon@ntlworld.com (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Philip Webb 09-17-2012 06:45 PM

new machine : suddenly Python 3 appears
 
120917 David W Noon wrote:
> On Mon, 17 Sep 2012 13:14:27 -0400, Philip Webb wrote re Python 2/3 :
>> print ' ',eval(expression)
> The above line uses obsolete syntax. Try using
> #!/usr/bin/python2 -3
> for your hash-bang line on all your old Python scripts.

Well, thanks for the info -- which is what I suspected -- ,
but just what is the correct Python3 syntax for that simple print line ?
This is my only Python script, which I got from somewhere long forgotten,
& I generally don't have a need to do Python programming.

While this subject is open, can anyone tell me
how to get Python3 started from CLI automatically to load the math item ?
-- ie to do 'from math import *' without my having to type it ?
That would make it possible to use 'python' instead of my script,
which would then allow me to use variables, sometimes an advantage.

--
========================,,======================== ====================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca


All times are GMT. The time now is 12:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.