Export to GitHub

editra-plugins - issue #171

[PyShell] Running python code from interpreter without an explicit import command?


Posted on Apr 27, 2011 by Grumpy Giraffe

What Plugin does this relate to? What version of the Plugin? PyShell 0.8

What steps will reproduce the problem? 1. Enable PyShell, show in shelf 2. Try running a function from within your code, in interpreter

What is the expected output? What do you see instead? Function runs. Module not found.

(specifically) Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'hello_world' is not defined

What version of Editra are you using? On what operating system? Editra 0.6.37, PyShell 0.8, Launch 1.1, Windows 7 x64

Comment #1

Posted on Apr 27, 2011 by Happy Monkey

Hi,

What exactly are you trying to do?

If you haven't defined the function 'hello_world' in the shell session yet then the error your seeing is expected.

i.e)

def hello_world(): print "Hello world" hellow_world() Hello World

Comment #2

Posted on Apr 27, 2011 by Grumpy Giraffe

I open hello.py in editra.

[hello.py] def hello_world(): print "Hello World"

Then in PyShell if I type: hello_world() it gives me the aforementioned module not found error.

Launcher 1.1 just runs the program, PyShell seems to be just a python interpreter completely removed from the opened file. Why not link the capabilities of these two plugins to enable us to run programs in PyShell, and individual functions in PyShell?

Well anyways, being able to run the functions I've defined in my opened python files in PyShell would be appreciated.

Thanks,

Alec Taylor

Comment #3

Posted on May 26, 2011 by Happy Monkey

Issue 177 has been merged into this issue.

Comment #4

Posted on May 26, 2011 by Happy Monkey

(No comment was entered for this change.)

Comment #5

Posted on Aug 28, 2011 by Grumpy Giraffe

Any update on this feature request?

Comment #6

Posted on Aug 28, 2011 by Happy Monkey

No, this is not a high priority right now, also not sure if it a good idea to change this behavior or not. PyShell is already a little questionable to be using for more than small snippets of code since it runs in the same instance of Python as Editra which makes it possible to corrupt Editra's running environment in some cases.

A well written patches might change my mind but for now there is a number of other things in my queue that have priority over this.

Status: Pending

Labels:
Type-Enhancement Priority-Low