[Tutor] upgrading Python

2007-10-13 Thread LandSurveyor
I wish to upgrade Python from the [Vers.] 2.3.4 that came packaged with my 
Mandrake 10.1 Linux OS to the current 2.5.1.  The 'hash/bang' line of my python 
scripts is "#!/usr/bin/python".  There are two files, both executables, in my 
/usr/bin directory; they are 1)python, and 2)python2.3.

I just simply don't know what to do next!?  The advise I can google to is 
typically overly generous, full of contradictions (sometime within the same 
post..."Well you can do this, but if you wanna do that instead...").  Well, I 
don't know why "I want to do this", or "do that instead".  I just want to know 
where to put my new version of python, and when I unzip/configure/and so on..., 
will I end up with:

1)an application that will pick up seamlessly and run my apps?
2)will pythontutor still be available?
3)will I have an upgraded & accessible package of modules?
4)will I need to modify the "hash/bang" line?
5)when I type 'python' on a command line, how will I access the new 2.5.1 
rather than the older version?  i.e., where do I go to modify the results of 
that request?

Oh, and could I-as I understand (to a limited degree) Linux- install the entire 
package within my home directory, following the principle that I am a user 
without admin privileges, and then change the "hash/bang" line to redirect to 
my 'embedded' version, and thus be running 2.5.1 within my own little world?  
And if I did so, the same questions persist.  If I asked for a module, would I 
get the one from my 2.5.1, or the module that exists in the older 2.3.4?  And 
when I entered 'python' from a command line (to access the interpreter) how 
would I get my 2.5.1 version, rather than the older 2.3.4.

It's just amazing, the array of niggling little questions that no one thinks 
about, but that create unmountable stumbling blocks once they pop up in the 
middle of your path, isn't it!?  But, they are enough to completely stop me in 
my tracks, and they are the nitty-gritty questions that no one seems to think 
important enough to address and clarify.

Thanks, folks.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] upgrading Python

2007-10-14 Thread LandSurveyor
Thanks for the 'meaty' response.  Therein was the nitty-gritty I could actually 
use.  Learned a bunch too...had never used a link before.  Didn't know why I 
would want to.  BTW, I met with HUGE success!

Anyway...my approach was to take the road of a user (with my own '/home' 
account, and no SU privileges.  That only went so far.  I installed the new 
Python (2.5.1) in a directory within my home that I called, incisively, 
'/usrlowell'.  Therein I opened up the .tgz file, and got as far as 'make', 
when it required me to have SU privileges (so much for the theory that I could 
do all I wished within my own 'world').  That speed bump has undermined a 
number of concepts I thought I'd figured out-regarding autonomy for a user-so I 
don't know now what I don't know.).

Long and the short of it, the 'make' and 'make install' continued in the 
/usr/bin environ (i.e., departed from my '/home' directories).  I did not at 
first 'rm' the /usr/bin/python file-was too nervous to try it!  What I did, 
though was go into my new dedicated /home/usrlowell/'newPythonPlace' directory, 
and found another file named 'python*'.  On command line I entered ./python, 
and sure enough I got python 2.5.1.  Wow!  Then I went back to /usr/bin, erased 
the 'python' file, created a link to my dedicated (/home/etc...etc) file, and 
sure enough, "which python" continues to yield /usr/bin/python, but "python" 
brings up the new 2.5.1.

The experience has shaken some of my established ideas of how Linux works, but 
it's been a great leap forward for me (as someone once said, "Do that which you 
are afraid to do").

Thanks for all the help.   BTW, I think-with this post-I've figured out how to 
correctly reply within this tutor envronment.  I THINK!?

-Original Message-
>From: bhaaluu <[EMAIL PROTECTED]>
>Sent: Oct 13, 2007 5:47 PM
>To: LandSurveyor <[EMAIL PROTECTED]>
>Cc: tutor@python.org
>Subject: Re: [Tutor] upgrading Python
>
>Greetings,
>On my system I can have several python versions installed because
>they install as python2.3, python2.4, etc.
>
>$ which python
>/usr/bin/python
>$ ls -l /usr/bin/python
>... /usr/bin/python -> python2.4
>
>Here, we can see that "python" is just a link to /usr/bin/python2.4
>So, I can install python 2.5, and simply change the link so when I
>enter "python" at the prompt, it will start python2.5.
>
>$ man ln
>ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
>
>So, after installing python 2.5, change to /usr/bin, remove /usr/bin/python
>$ cd /usr/bin
>$ rm python
>
>And now make a new link to python2.5 (you may have to be root!):
># ln -s /usr/bin/python2.5 python
>
>If I'm not mistaken, the library files, and so forth are stored in different
>directories, so installing a new version, won't corrupt an older version.
>/lib/python2.4/site-packages
>
>See how python 2.4 is in the python2.4 directory?
>
>If, for some reason, you want the other version, just start it with the
>absolute pathname:
>$ /usr/bin/python2.3
>
>I hope this is helpful? I don't use Mandrake, so I'm unfamiliar with
>its package manager, or how to do upgrades for it. The above are
>generic *nix commands that should work with any distro.
>
>apt-get and Synaptic rock! =)
>-- 
>b h a a l u u at g m a i l dot c o m
>http://www.geocities.com/ek.bhaaluu/index.html
>
>On 10/13/07, LandSurveyor <[EMAIL PROTECTED]> wrote:
>> I wish to upgrade Python from the [Vers.] 2.3.4 that came packaged with my 
>> Mandrake 10.1 Linux OS to the current 2.5.1.  The 'hash/bang' line of my 
>> python scripts is "#!/usr/bin/python".  There are two files, both 
>> executables, in my /usr/bin directory; they are 1)python, and 2)python2.3.
>>
>> I just simply don't know what to do next!?  The advise I can google to is 
>> typically overly generous, full of contradictions (sometime within the same 
>> post..."Well you can do this, but if you wanna do that instead...").  Well, 
>> I don't know why "I want to do this", or "do that instead".  I just want to 
>> know where to put my new version of python, and when I unzip/configure/and 
>> so on..., will I end up with:
>>
>> 1)an application that will pick up seamlessly and run my apps?
>> 2)will pythontutor still be available?
>> 3)will I have an upgraded & accessible package of modules?
>> 4)will I need to modify the "hash/bang" line?
>> 5)when I type 'python' on a command line, how will I access the new 2.5.1 
>> rather than 

Re: [Tutor] upgrading Python

2007-10-14 Thread LandSurveyor
 Some interesting (!?) things happened when I upgraded from Python 2.3 to Python 2.5.1.  My editor of choice is Vim, the platform is MandrakeLinux 10.1...the digraphs I have incorporated from the Vim environment into my scripts no longer work.  The resultant error message referred me to pep-0263Within my code, I have two adjacent 'try/except' sequences.  The 'try' line waits for user input, and the 'except' offers default data if a response is bypassed.  What happens now is that both of those 'try' queries print simultaneously on the same line, i.e., not in sequence, the 2nd one following a response to the first.This is what I have discovered so far.   What could be happening?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] upgrading Python

2007-10-20 Thread LandSurveyor
If I could be so bold...as to return for a moment to my long since buried 
question:  What happened to the once pleasant relation between Python & 
digraphs.  Given that digraphs are a form offered by Vim (not intrinsic to 
Python[?]), they worked when I was using Python 2.3.  Now, with the upgrade to 
Python 2.5.1, digraphs do not work.  Googling offers me any number of arcane 
and generalized theories.  Not a lot of use to me.  I would like to know what 
will work.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Please suggest a Python Book

2006-11-25 Thread LandSurveyor
"Python Programming for the absolute beginner" auth: Michael Dawson

Although touted as, and directed toward, a new programmer, the book is an 
excellent 'sing along' tome that illustrates good examples with a good 
structure of creating small working scripts, and gets very well into some heavy 
subjects, including OOP, GUI programming.  A well written, well thought out 
effort.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] display text in colors

2007-01-01 Thread LandSurveyor
I would like to direct a python script to display 'print' strings in various 
(chosen) colors; for example:

print \
"""
color this line blue   # in the printout display-be it screen or hardcopy
color this line green  # in the printout display-be it screen or hardcopy
"""
what I tried doing was:
import os
then the line... just before the print command (I 
borrowed this formatting from my $PS1 format.

Nadda.  Didn't work.  What might I try?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] display text in colors

2007-01-01 Thread LandSurveyor
Oh!...sorry.  My OS is Mandrake 10.1.
Coupla other little 'minor' details I sorta left out.  I had attempted to echo 
a random string on my command line by surrounding it with [again] the same 
color-code that works on my CLI prompt line ($PS1).  That was the color coding 
I had tried to inject into a likely(?) spot in my code script.  i.e., I have 
sort of approached this is a shell (rather than Python) issue, by trying to 
invoke an OS command (from inside my script) that-maybe-otherwise works.
BTW, I couldn't get anything to work on the command line either:

[EMAIL PROTECTED] >>echo \[\e[31;1m\]"See if this goes to color red?"\[\e\0m\]

-Original Message-
>From: Luke Paireepinart <[EMAIL PROTECTED]>
>Sent: Jan 1, 2007 2:55 PM
>To: LandSurveyor <[EMAIL PROTECTED]>
>Cc: tutor@python.org
>Subject: Re: [Tutor] display text in colors
>
>LandSurveyor wrote:
>> I would like to direct a python script to display 'print' strings in various 
>> (chosen) colors; for example:
>>
>> print \
>> """
>> color this line blue   # in the printout display-be it screen or hardcopy
>> color this line green  # in the printout display-be it screen or hardcopy
>> """
>> what I tried doing was:
>> import os
>> then the line... just before the print command (I 
>> borrowed this formatting from my $PS1 format.
>>
>> Nadda.  Didn't work.  What might I try?
>>   
>Uh, I think it's pretty important what operating system you're using here.
>Could you let us know before we try to help further?
>Thanks,
>-Luke
>

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor