LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-30-2003, 03:46 PM   #1
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Rep: Reputation: 15
Python on Slackware 9.1


I installed everything that came with slackware and it shows that I have python but when I go to run it nothing happens. Anyone want to help a
 
Old 12-01-2003, 12:37 AM   #2
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
python is just a language...what's supposed to happen?
 
Old 12-01-2003, 05:08 AM   #3
sridharinfinity
Member
 
Registered: May 2003
Location: India
Distribution: slackware
Posts: 61

Rep: Reputation: 15
Know more about python here ... (a sure read) !
http://www.linuxjournal.com/article.php?sid=3882

And here is http://www.python.org
 
Old 12-02-2003, 07:08 AM   #4
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
How do I load python in Emacs? Or is there a better editor for it?
 
Old 12-02-2003, 09:28 PM   #5
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
you just write the code in any basic text editor. no need to load anything anywhere. some editors made specifically for python (pythonwin for ms I think it's called?) deal with the whitespace for you and let you know if you've coded incorrectly; basic text editors can be a lot trickier if you're not used to that style.
 
Old 12-03-2003, 07:23 AM   #6
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
Is Kwrite a good choice for a python editor?

Last edited by KnowNothing; 12-03-2003 at 05:25 PM.
 
Old 12-03-2003, 05:26 PM   #7
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
How do I save code so that it loads the program rather than code?
 
Old 12-03-2003, 06:39 PM   #8
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
I'm fairly new to Linux and have never used Python outside of Windows but I would think you should just make the file executable with the command chmod. You may have to compile it first but that's not required in Windoz...

chmod u+x filename, or whatever permissions you prefer. I think that should make it execute for you.
 
Old 12-03-2003, 08:00 PM   #9
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
how do you compile it?
 
Old 12-03-2003, 08:06 PM   #10
minio
Member
 
Registered: Sep 2003
Location: Czech Republic - Prague
Distribution: Slackware 9.1
Posts: 61

Rep: Reputation: 15
If you want to run your python file you should make it executable with chmod command and have #!/usr/bin/python on first line of your file.
 
Old 12-04-2003, 01:24 AM   #11
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
there's no need to compile python. it runs the same either way. But if you really want to, check the documentation on the py_compile or compileall modules.
 
Old 12-04-2003, 07:16 AM   #12
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
>>> chmod
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'chmod' is not defined

Thats what I got running the chmod command.

#!/usr/bin/python do I put this in the code itself?

#!/usr/installs/Python-2.3.2/Python
print "Hello world!"
raw_input("Press any key to continue...")

I changed #!/usr/bin/python because I installed a newer version of python to the directory in the code.

Last edited by KnowNothing; 12-04-2003 at 07:19 AM.
 
Old 12-05-2003, 06:09 AM   #13
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
don't do chmod in a python editor. do this in a terminal window and change the python file attributes. Just by the ">>>" I think that's where you were...
chmod 777 full/file/path/and/name/here, i.e., chmod 777 ~/python.files
that makes the file executable to everyone, not just you.
Other than that, you're python script is great!!
 
Old 12-05-2003, 07:43 AM   #14
KnowNothing
LQ Newbie
 
Registered: Nov 2003
Location: TX
Distribution: Fedora Core 5
Posts: 25

Original Poster
Rep: Reputation: 15
I ran "chmod 777 /usr/installs/Python-2.3.2/Projects/helloworld" and it didn't do anything, what am I doing wrong?
 
Old 12-05-2003, 11:16 PM   #15
Vincent_Vega
Member
 
Registered: Nov 2003
Location: Jacksonville, FL
Distribution: Slackware & Arch
Posts: 825

Rep: Reputation: 31
make sure the python program is in your PATH. At the prompt type "python filename" without the quotes. I'm not at a computer with Linux right now or I would just go figure it out for you. You might try commenting out/deleting that first line !#... since this is calling python to execute the script.
 
  


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
does python come pre-installed on slackware? habala Slackware 2 01-29-2005 06:06 PM
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 11:14 AM.

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