cjprecord / editra-plugins

Automatically exported from code.google.com/p/editra-plugins
0 stars 0 forks source link

IPyShell import error on binary editra 0.3 #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install editra binary for windows
2. install IPyshell plugin
3. restart editra editra, enable log, open plugin manager

What is the expected output? What do you see instead?

no error in log, ipyshell showup else we've got this error:
[21:29:09][pluginmgr][err] Couldn't Load IPyShell: cannot import name Release

standard install from source works.

Original issue reported on code.google.com by laurent....@gmail.com on 6 May 2008 at 7:32

GoogleCodeExporter commented 9 years ago
Ok I've replaced plugin.pyo by plugin.py in library.zip.
And disbaled exception handling as you suggered...
Here is the bug report:

#---- System Information ----#
Editra Version: 0.3.0
Operating System: Windows NT 6.0 (build 6001, Service Pack 1)
Python Version: 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit 
(Intel)]
wxPython Version: 2.8.7.1 (msw-unicode)
wxPython Info: (__WXMSW__, wxMSW, unicode, wx-assertions-on, SWIG-1.3.29)
Python Encoding: Default=ascii  File=mbcs
wxPython Encoding: cp1252
System Architecture: 32bit 
Byte order: little
Frozen: windows_exe
#---- End System Information ----#
#---- Runtime Variables ----#
AALIASING=False
ALPHA=255
APPSPLASH=True
AUTO_COMP=True
AUTO_INDENT=True
BRACKETHL=True
BSUNINDENT=True
CHECKMOD=True
CHECKUPDATE=True
CODE_FOLD=True
DEFAULT=False
DEFAULT_LEX=Plain Text
DEFAULT_VIEW=Automatic
EDGE=80
EOL=Windows (\r\n)
FFILTER=0
FHIST_LVL=9
FONT1=Courier New,10
FONT2=Arial,10
GUIDES=False
HLCARETLINE=False
ICONS=Tango
ICON_SZ=(24, 24)
INDENTWIDTH=4
IPython.background_color=BLACK
IPython.completion=IPYTHON
IPython.filter_cmd=True
IPython.filter_doc=True
IPython.filter_empty=True
IPython.filter_magic=True
KEY_PROFILE=None
LANG=Default
LASTCHECK=2041
MAXIMIZED=True
MODE=CODE
MYPROFILE=C:\Users\ldufrechou\Desktop\Ipython-dev\\.Editra\profiles\default.ppb
OPEN_NW=False
PRINT_MODE=BLACK/WHITE
REPORTER=True
SAVE_POS=True
SAVE_SESSION=False
SET_WPOS=True
SET_WSIZE=True
SHELF_ITEMS=[u'Editra Log']
SHOW_EDGE=True
SHOW_EOL=False
SHOW_LN=True
SHOW_WS=False
STATBAR=True
SYNTAX=True
SYNTHEME=Default
TABWIDTH=8
THEME=DEFAULT
TOOLBAR=True
USETABS=False
VI_EMU=False
WPOS=(-8, -8)
WRAP=False
WSIZE=(1696, 1036)
FTYPES=[u'py', u'zip']
#---- End Runtime Variables ----#

#---- Traceback Info ----#
*** Wed May 28 23:07:45 2008 ***
Traceback (most recent call last):
  File "Editra.py", line 646, in <module>
  File "Editra.py", line 578, in Main
  File "Editra.py", line 97, in __init__
  File "D:\Editra\library.zip\plugin.py", line 342, in __init__
  File "D:\Editra\library.zip\plugin.py", line 509, in InitPlugins
  File "pkg_resources.pyo", line 1912, in load
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPyShell\__init__.py", line 24, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPython\__init__.py", line 57, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPython\ipstruct.py", line 22, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPython\genutils.py", line 24, in <module>
ImportError: No module named commands

#---- End Traceback Info ----#

And here is the beginning of genutils.py:
from IPython import Release
__author__  = '%s <%s>' % Release.authors['Fernando']
__license__ = Release.license

#****************************************************************************
# required modules from the Python standard library
import __main__
import commands

The strange thing is that it can't find commands that is a standard plugin...
Arff..

I think that the py2exed editra doesn't include all the standard modules...

Is this a good diag?
If yes, then there is something wrong with editra py2exe package.

Original comment by laurent....@gmail.com on 28 May 2008 at 9:14

GoogleCodeExporter commented 9 years ago
Yes, py2exe will only include the modules that it finds Editra using. If you 
need
some modules from the standard lib that are not included I can add them to the 
build
script.

Please test by adding the commands module to the INCLUDES list in setup.py then 
run 

python setup.py py2exe

This will build a binary version of Editra in the dist folder you can then run
Editra.exe in that folder to test if that is the only other module needed.

Report back here with what modules are needed and I will add them for the next 
build.

Thanks,
cody

Original comment by CodyPrec...@gmail.com on 28 May 2008 at 9:39

GoogleCodeExporter commented 9 years ago
Hum don't you think it should be better to include all standard module?
I mean, if people don't want to install python and source version, we should 
provide
them at least the basic python distribution no?
This can be source of bug for other plugins that are hard to track and, for 
example
ipython, i can't be sure no new standard module will not be included in the 
future.

Original comment by laurent....@gmail.com on 28 May 2008 at 10:02

GoogleCodeExporter commented 9 years ago
Here it improve a little the problem:

INCLUDES = ['syntax.*', 'ed_log', 'shutil', 'subprocess', 'zipfile', 'commands',
'doctest', 'os', 're', 'shlex', 'sys', 'tempfile',
            'time', 'types', 'warnings', 'md5', 'Queue', 'pydoc', 'site']
I've got a problem with 'site' package.

#---- Traceback Info ----#
*** Thu May 29 00:23:40 2008 ***
Traceback (most recent call last):
  File "Editra.py", line 646, in <module>
  File "Editra.py", line 578, in Main
  File "Editra.py", line 97, in __init__
  File "plugin.pyo", line 342, in __init__
  File "plugin.pyo", line 509, in InitPlugins
  File "pkg_resources.pyo", line 1912, in load
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPyShell\__init__.py", line 24, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPython\gui\wx\ipython_view.py", line 39, in <module>
  File "zipextimporter.pyo", line 82, in load_module
  File "build\bdist.win32\egg\IPython\gui\wx\ipshell_nonblocking.py", line 25, in
<module>
  File "zipextimporter.pyo", line 82, in load_module
  File "site.pyo", line 73, in <module>
  File "site.pyo", line 38, in __boot
ImportError: Couldn't find the real 'site' module

;_;

Tryied to remove it my code but then satrting editra blow up :)
It seems taht site needs to be included anyway in other ipython part and can't 
be
included with py2exe...
Will check later, I'm ultra busy at work ;)

Original comment by laurent....@gmail.com on 28 May 2008 at 10:28

GoogleCodeExporter commented 9 years ago
I am not so sure, I would like to keep the binary distributions as small as 
possible
so that downloads are faster and it saves bandwith on my server. Also Editra is 
not a
python editor so much as it is a general purpose code editor so many users are 
not
python devs and don't need all kinds of extra unused packages shipped with it.

I would think that most python devs would use the source version of Editra as it
provides better usage for autocompletion and what not since it can access the 
python
and all installed libs on the system and not just the ones bundled into the 
binary
package but the majority of downloads that come directly off my server are for 
the
binary packages so its hard to tell.

I have some plans to improve the plugin manager to allow for dependancy 
tracking and
installation of components through the setuptools mechanisms that will remove 
the
need of having to bundle packages into the plugins directly. These plans 
however are
a ways down the path on my schedule so not too sure on details nor timeframe 
yet.

So the short answer is for now I only want to bundle what is required into the
binaries. Also, I am not even sure if py2exe has an option for bundling 
everything or
not. So if we need a couple of modules for Ipython to work I am fine with 
adding them
to the INCLUDES of py2exe/py2app.

cody

Original comment by CodyPrec...@gmail.com on 28 May 2008 at 10:36

GoogleCodeExporter commented 9 years ago
Spent a few minutes doing some debugging. There are all kinds of unused imports 
in
ipyshell_nonblocking.py and many of them are the same that are showing up on the
erors you are getting. Simply remove them. There are still some issues with 
loading
the plugin after this but this is all I had time to check for now.

#--- START PATCH ----#

Index: IPython/gui/wx/ipshell_nonblocking.py
===================================================================
--- IPython/gui/wx/ipshell_nonblocking.py   (revision 559)
+++ IPython/gui/wx/ipshell_nonblocking.py   (working copy)
@@ -21,10 +21,7 @@
 import sys
 import os
 import locale
-import time
-import pydoc,__builtin__,site
 from thread_ex import ThreadEx
-from StringIO import StringIO

 try:
         import IPython

#--- END PATCH ---#

Also there should be no need to add (sys, os, re, time) to the INCLUDES as they 
are
used throughout Editra and are included in the build by default already.

You might want to consider installing and running pylint on your code it can 
help allot.

cody

Original comment by CodyPrec...@gmail.com on 2 Jun 2008 at 1:41

GoogleCodeExporter commented 9 years ago
Ok, I did some more work on this, this evening.

updated to Ipython 0.9.1

The only problem now is still the import errors when running a binary version 
of Editra.

It seems that the problem is caused by how IPython does its imports.

Many of the modules inside of IPython do something like this:

from IPython import Release

All of these lines are causing the problem. Changing them to relative imports

import Release

Fixes the problem but there are so many and it doesn't work for subpackages 
that need
to import something from the module a level above.

So I am a bit stumped right now. The only thing that I think will fix this is to
somehow find the path to the package in the egg and adjust sys.path. But I 
think that
that is now the only issue left.

cody

Original comment by CodyPrec...@gmail.com on 25 Oct 2008 at 4:02

GoogleCodeExporter commented 9 years ago
Closing this issue as out of date as the ipyshell plugin is not currently active

Original comment by CodyPrec...@gmail.com on 31 Jan 2011 at 6:55