Note that there are some explanatory texts on larger screens.

plurals
  1. POPython Scripts Are Opening Python 2.7 Interpreter
    text
    copied!<p>I've recently installed several Python packages on Kubuntu 12.04 (<code>iPython</code>, <code>matplotlib</code>, <code>numpy</code>, <code>ipython-notebook</code>, <code>ipython-qtconsole</code>, <code>python-scipy</code>). Now when I try and run a python script from the command line (<code>./script.py</code>) I get thrown into the python interpreter.</p> <p>example:</p> <pre><code>user@machine:~/$ ./script.py Welcome to Python 2.7! This is the online help utility. If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://docs.python.org/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, or topics, type "modules", "keywords", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose summaries contain a given word such as "spam", type "modules spam". help&gt; </code></pre> <p>Why is this happening?</p> <p>What can I do to make this stop?</p> <p>Is there any option other than removing iPython?</p> <p>EDIT: I should mention the script is a python module. I don't know if that has anything to do with it. I am able to run a simple <code>hello world</code> script just fine.</p> <p>@Adam Mihalcin: <code>#!/usr/bin/python</code></p> <p>EDIT 2: It looks like this is not related to iPython. I removed iPython and I'm still running into this problem. Here are the contents of the file. (this is happening with most of my Python files)</p> <pre><code>#!/usr/bin/python # Import libraries import sys import subprocess def createCommand(project): # Create the basic command command = "git clone " + project subprocess.call(command, shell = True) return 0 def helpMenu(): return 0; def validateInput(user_input): # validity key valid = 0 if (len(user_input) &lt; 3): help() return 1 if (user_input[1] == '-cl'): if (len(user_input) == 3): valid = 1 return 0 if (valid == 0): help() return 1 def main(user_input): # Validate inputs failure = validateInput(user_input) # Return if there was a failure if (failure == 1): return 1; # Create the git commands failure = createCommand(user_input[2]) # Return if there was a failure if (failure == 1): return 1; return 0; if (__name__ == '__main__'): main(sys.argv) </code></pre> <p>EDIT 3: False Alarm!</p> <p>This is embarrassing. It turns out I knew I was going to run into namespace issue with my <code>help()</code> function. I changed it to <code>helpMenu()</code> but forgot to change where it's called.</p> <p>I'm so sorry for wasted post. :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload