LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-07-2002, 06:45 PM   #1
Poorman
Member
 
Registered: Jun 2002
Location: Bradenton, Florida
Distribution: Red Hat 9.0
Posts: 32

Rep: Reputation: 15
Angry Python 1.5


I just started learning python programming today. For starters, I am more than a little confused on the whole writing code, saving the code, correcting the code and using the file. I started up python and got the >>>. I can not figure out from reading the book how am i supposed to write and save programs.

Am I to write everything in vi and save the file with a .py extension? Then go into python and somehow start it up?

Am I to write everything starting at the >>>? If I do, how do I save my file and what not, how do I correct lines after it has given me an error?

Am i supposed to save everything in vi to the python library on my computer /usr/bin/lib/python1.5 with all the other python files? The book says to change my path environment varibale to the /usr/bin... from above. If i do, wont that change my home directory?

The #!/usr/bin/python line does what? The book states that it tells the system where to direct its attention when the script is run in main mode? What does taht mean? Isnt the system supposed to direct its attention to the .../lib/python1.5 directory??



I think that is it for now. I know this is probably easy stuff for you guys, but I just can seem to make the connection i guess.


Thanks,
Poorman
 
Old 07-07-2002, 07:18 PM   #2
pickledbeans
Member
 
Registered: Jun 2002
Location: Bailey, CO
Distribution: Slackware
Posts: 483

Rep: Reputation: 31
First, thing upgrade to Slack-8.1 or least 8.0
Second, Python 1.5. is no longer supported, upgrade to current stable version, try the python.tgz from 8.0 in the /d
directory.

As long as the python is in you path you fine.

#!/path/to/python is what's called a shebang.
It tell the shell for to use to exicute the script
You should get in a habit of placing one at the top
of EVERY script you write, BASH, Perl.

Suggestions to help with vi create a file (in your home dir)
called .exec

------- .exrc ------------
set showmode
set showmatch
set tabstop=3

Here's the Python home world:
http://python.org
I would also suggtest subscribing to the python-help
and python-tutor mailing list, they were very helpful to me l
 
Old 07-08-2002, 01:28 AM   #3
RefriedBean
Member
 
Registered: Jun 2002
Location: N 37 33.327 E 126 55.650
Distribution: Gentoo, Slackware, OpenZaurus
Posts: 186

Rep: Reputation: 30
Hi!
Well, actually its quite easy.
All you have to do is make new blank file, and put the lines that PickledBeans said in top, type in the code, save the file, make it executable (chmod +x yourfile.py) and run it .

Here's an example
Code:
#!/usr/bin/python
#Just write your app here
   print 'hello!'
   print 'the total is :', 3+3
Alternatively you could launch the app by typing in 'python app.py'

Good Luck!
Have fun!
RefriedBean
 
Old 07-09-2002, 12:18 AM   #4
rverlander
Member
 
Registered: May 2002
Distribution: A few
Posts: 488

Rep: Reputation: 30
geez get python 2.1/2.2 its easy to update 1.5 was released in 1999
 
Old 07-09-2002, 12:33 PM   #5
pickledbeans
Member
 
Registered: Jun 2002
Location: Bailey, CO
Distribution: Slackware
Posts: 483

Rep: Reputation: 31
Quote:
Originally posted by pickledbeans
First, thing upgrade to Slack-8.1 or least 8.0
Second, Python 1.5. is no longer supported, upgrade to current stable version, try the python.tgz from 8.0 in the /d directory.
l
The echo in this place is unreal

got to http://www.slackware.com/getsladk
select a mirror
sladkware-8.0
find the "d" diredtory
downlaod python.tgz


login in to you box as root
# upgradepkg python.tgz
# exit
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Processing Conflict: python-devel conflicts python< 2.3.4-13.1 guarriman Fedora 2 04-23-2009 08:02 PM
installing python library's (Python Numeric) Four Linux - Newbie 1 10-16-2005 03:31 PM
Python guru's - Is this a python bug? or is it me? bardinjw Programming 2 06-23-2005 09:17 AM
WineX, python-gnome, and python-gtk DrD Fedora 0 08-03-2004 01:11 PM
install python 2.3 ,necssary to remove python 2.2 ngan_yine Linux - Newbie 7 12-28-2003 05:07 PM


All times are GMT -5. The time now is 09:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration