![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
python help please.
this is my first program and it doesn't work. the myscript.py just opens gedit. here is the code.
PHP Code:
thanks.
__________________
CPU: Quad Q6600 @ 3.2GHz | GPU: Radeon HD 4870 | Mobo: Asus P5Q P45 | RAM: OCZ 4GB 1066GHz | HDD: 2x 1TB Samsung
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Manager
Join Date: Sep 2004
Location: Colorado
Posts: 987
OS: Mac OS 9.1, Mac OS X 10.5.8, WinXP Pro, FreeBSD 6.0, Gentoo Linux
|
Re: python help please.
You want #!/usr/bin/env python as the top line. Remove the one before it. You need to do the chmod command outside the script to give it executable permissions (no $ before it - that's just a symbol found on many bash prompts).
gedit most likely opens because your system is configured to open files in their default program when entered as the first part of a command line (i.e. a normal file specified like a command).
__________________
![]() Has it been a few days since I replied to your thread? Don't panic! I'm a busy college student and may forget a post if I'm extra busy (or it might just take me a while to be able to do a decent reply). If you still need help and are awaiting my reply after a few days, PM me about it. When posting what errors you get, please give the full message. It makes helping you much easier. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
|
Re: python help please.
ok thanks. the file now asks me what to do when i click the file. when i click run in terminal though it opens then closes instantly. my guess is that its reaching the end of the code then closing. how do i fix this?
__________________
CPU: Quad Q6600 @ 3.2GHz | GPU: Radeon HD 4870 | Mobo: Asus P5Q P45 | RAM: OCZ 4GB 1066GHz | HDD: 2x 1TB Samsung
|
|
|
|
|
|
#4 (permalink) |
|
Manager
Join Date: Sep 2004
Location: Colorado
Posts: 987
OS: Mac OS 9.1, Mac OS X 10.5.8, WinXP Pro, FreeBSD 6.0, Gentoo Linux
|
Re: python help please.
You should open the terminal, then navigate to where the Python script is. Then you can run it with ./myscript.py
Also, I believe you need to remove the '>>>' in front of the print statement.
__________________
![]() Has it been a few days since I replied to your thread? Don't panic! I'm a busy college student and may forget a post if I'm extra busy (or it might just take me a while to be able to do a decent reply). If you still need help and are awaiting my reply after a few days, PM me about it. When posting what errors you get, please give the full message. It makes helping you much easier. |
|
|
|
![]() |
| Thread Tools | |
|
|