Running Python Scripts
I have Red Hat Enterprise Linux 6.3 installed on two machines. When I try to run a python script on either of them (the same script for testing) it seems to start but immediately end. No pop-ups are present after starting the scripts.
After running the program, it should be asking to change values but it never shows up. Any suggestions on what could be wrong? |
Quote:
- How are you running this script? From the GUI or from a terminal or ???? - What command are you using to execute the script? - Are you sure the script works correctly? |
Quote:
-I've changed the directory to the where the files are and used 'python (file name)' -I got the script from someone else but on his machine (same OS and build) it ran just fine. |
Quote:
This should work from a terminal: Code:
cd /path/to/script_directory If your script isn't too long you might want to post it (do use [code] ... [/code] tags) so we can have a look. |
I just noticed a message after attempting to run the program in the terminal. "ImportError: no module named argparse"
I tried seeing if I have it using this command | python -c "import argparse; print argparse" and the same message appears. |
What version of Python are you running?
|
Assuming you use python 2.x: The argparse module isn't installed by default and I do believe also not part of the default packages that are available.
A little search comes up with this: python-argparse-1.2.1-2.el6.noarch.rpm I do believe argparse became part of native python in version 3.2 |
It is version 2.6.6.
|
Quote:
|
I'm attempting to install the version 3.2.5 and when I do the './configure' there is a message saying "no acceptable C compiler in $Path"
I downloaded the file from the website and it was saved to my Downloads folder. I unzipped it and that is when I ran './configure' Is there something I am doing wrong up to this point? |
Quote:
|
Ok. Thanks for all the feedback. I had assumed the GCC would have been installed when I installed the OS. Finally got the GCC installed and finishing installing Python 3.2.5. If I have any other problems I'll be sure to ask for your help again. Thank!
|
GCC is not installed by default. This is because it is an insecure program to have installed, and is widely used for evil on linux systems. Any compiler can be used for evil on an insecure system. So it is a good idea to use GCC to compile whatever you need, then uninstall it.
|
Ok so following the instructions and running the install, it looks as though everything is fine. Then I tried to run my script again and it still says that the argparse module isn't installed. I checked again the version I have for python and I had assumed it would be 3.2.5 but it still says I am on 2.6.6.
I followed the read me instructions that followed like this: - ./configure - make - make test - yum make install |
First, uninstall the older version of Python. Then places the python binary in your PATH.
|
All times are GMT -5. The time now is 11:55 PM. |