Python shell can't import from cwd

54 views
Skip to first unread message

Lewis Levin

unread,
Mar 22, 2013, 3:52:33 AM3/22/13
to edi...@googlegroups.com
Well, it should be simple to run the current module in the shell.  Launch is supposed to do that but it doesn't really handle arguments sensibly.  They're not actually passed in.  So, an import is really necessary so a specific function can be invoked with its arguments.

So, I just run the integrated Python shell.

os.chdir to the directory containing the module.

import the_module

Well, that won't work.  

This works in idle and in python run in the command shell.

In, Pyscripter, there is a menu command to import the buffer.  Easy.

In Wingware, you os.chdir, import, and run functions from the module--just like the shell.  Not as nice as Pyscripter, but entirely consistent with the way any Python interactive shell would work.

So, this looks like a pretty fundamental inconvenience in Editra.  Actually, a bug.

Cody

unread,
Mar 22, 2013, 8:36:04 AM3/22/13
to edi...@googlegroups.com
Hi,

On Fri, Mar 22, 2013 at 2:52 AM, Lewis Levin <lewis...@hotmail.com> wrote:
Well, it should be simple to run the current module in the shell.  Launch is supposed to do that but it doesn't really handle arguments sensibly.  They're not actually passed in.  So, an import is really necessary so a specific function can be invoked with its arguments.

How are you trying pass arguments? They certainly work for me without issue.
 

So, I just run the integrated Python shell.

os.chdir to the directory containing the module.

import the_module

Well, that won't work.  


Let me guess, your running a binary version of Editra?

Binary versions have their own Python binary builtin to the binary so they can only import modules that are builtin to Editra.

If you are working on Python code it is suggested to use easy_install or manually from the source package to install Editra for your Python so that it has full access to your local python environment.

PyShell was originally made as an example plugin to show how to use the plugin interfaces. It is not a full replacement for a python shell. It is really only intended to be useful for checking small scripts or behavior of basic commands. Its open source and Python so feel free to improve if you want, happy to accept any patches for it.


Cody

Lewis Levin

unread,
Mar 24, 2013, 4:20:56 PM3/24/13
to edi...@googlegroups.com
No, I installed with .tar.gz and python setup install.

So, I hear you.  I think this restriction also applies to the python source version of editra.

It's a nice effort but why not join up with one of the other python source ide's such as spyder?  It's more mature, different (qt instead of wxwidgets), and different focus (sci/math--but still useful as an ide).  It kills me to see open source projects always doing another overlapping "do my own thing".  It's great for learning and all, but so much wasted effort.  Multiple sets of bugs going unfixed, features partially implemented in multiple projects.  Why not share the effort?  It's just a general open source problem...

You support editra better than most of the projects support themselves. And to be fair, the Spyder group is also very active with fast replies...

Thanks for your quick reply.
Reply all
Reply to author
Forward
0 new messages