Issue1246413

classification
Title: can\'t import Python package
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: cgroves Nosy List: cgroves, nobody, thehaas
Priority: high Keywords:

Created on 2005-07-27.23:38:15 by thehaas, last changed 2005-12-06.00:15:02 by nobody.

Messages
msg1012 (view) Author: Mike Hostetler (thehaas) Date: 2005-07-27.23:38:15
I have a Python library that I call that is in the same directory as my application.  It has a __init__.py that doesn't seem to be called:

$ dir WorkPoint
#wpWindows.py#  __init__.pyc    utils.pyc   wpWindows.py
TAGS            semantic.cache  wpJava.py   wpWindows.pyc
__init__.py     utils.py        wpJava.pyc

$ ./PerformWork.bat  cmd
ECHO is off.
Jython 2.2a1 on java1.4.2_03 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import WorkPoint
>>> s =WorkPoint.Session()
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: java package 'WorkPoint' has no attribute 'Session'
>>> dir(WorkPoint)
['__name__']


It looks like this in 2.1:
$ ./PerformWork.bat  cmd
ECHO is off.
Jython 2.1 on java1.4.2_03 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import WorkPoint
>>> s = WorkPoint.Session()
>>> dir(WorkPoint)
['JAVA', 'Session', 'WPexception', '__doc__', '__file__', '__name__', '__path__'
, 'isJava', 'sys', 'wpJava', 'wpWrapper']
msg1013 (view) Author: Nobody/Anonymous (nobody) Date: 2005-12-06.00:15:02
Logged In: NO 

I have a similar problem -- it looks like when there is a
java package and a python package with the same part of
their name, the class loader can get confused.  For example, 

from edu.umass.mallet.base.fst import *
from mallet.crfs import *

will work from some directories and not from others. 
changing the name of the python package to mallethon.crfs is
a functional workaround. 
History
Date User Action Args
2005-07-27 23:38:15thehaascreate