From: Frank W. <fwi...@gm...> - 2006-06-08 20:17:18
|
Fair enough, I'll see that it gets in there. On 6/8/06, Raghuram Devarakonda <ra...@sy...> wrote: > > How about this? > > *************** > Q. importing (using __import__) a module with "-" in name fails with the > error "Illegal Class name". Why? > > A. Dashes are not allowed in class names. This is a Java limitation and > not a Jython limitation per se. Class names must be Java identifiers. > **************** > > Thanks, > Raghu. > > Frank Wierzbicki wrote: > > This should probably go into the User FAQ -- anyone want to supply > > some verbiage, if so I'll see that it gets added to the User FAQ. > > > > Thanks, > > > > -Frank > > > > On 6/8/06, Raghuram Devarakonda <ra...@sy...> wrote: > >> > >> ok. That makes sense. May be, a section can be maintained that lists > >> differences with python (if it is not already there). This section can > >> list things like these even if it is not jython's limitation per se. > >> > >> Thanks, > >> Raghu. > >> > >> Frank Wierzbicki wrote: > >> > Dashes are not allowed in class names. This is a Java limitation and > >> > not a Jython limitation per se. Class names must be Java identifiers > >> > -- see > >> > > >> > http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8 > >> > > >> > -Frank > >> > > >> > On 6/8/06, Raghuram Devarakonda <ra...@sy...> wrote: > >> >> > >> >> Hi, > >> >> > >> >> I have a 0 length file called "test-mod.py" in current directory. I > >> get > >> >> the following errors when I try to import it. > >> >> > >> >> *********************** > >> >> > >> >> $ jython > >> >> Jython 2.1 on java1.4.2_06 (JIT: null) > >> >> Type "copyright", "credits" or "license" for more information. > >> >> >>> __import__("test-mod") > >> >> Traceback (innermost last): > >> >> File "<console>", line 1, in ? > >> >> java.lang.ClassFormatError: test-mod$py (Illegal Class name > >> >> "test-mod$py") > >> >> at java.lang.ClassLoader.defineClass0(Native Method) > >> >> at java.lang.ClassLoader.defineClass(ClassLoader.java:539) > >> >> at > >> >> > >> org.python.core.BytecodeLoader2.loadClassFromBytes(BytecodeLoader2.java) > >> >> at > >> org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java) > >> >> at > >> org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java) > >> >> at org.python.core.imp.createFromSource(imp.java) > >> >> at org.python.core.imp.loadFromPath(imp.java) > >> >> at org.python.core.imp.loadFromPath(imp.java) > >> >> at org.python.core.imp.load(imp.java) > >> >> at org.python.core.imp.import_next(imp.java) > >> >> at org.python.core.imp.import_name(imp.java) > >> >> at org.python.core.imp.importName(imp.java) > >> >> at org.python.core.ImportFunction.load(__builtin__.java) > >> >> at org.python.core.ImportFunction.__call__(__builtin__.java) > >> >> at org.python.core.PyObject.__call__(PyObject.java) > >> >> at org.python.pycode._pyx1.f$0(<console>:1) > >> >> at org.python.pycode._pyx1.call_function(<console>) > >> >> at org.python.core.PyTableCode.call(PyTableCode.java) > >> >> at org.python.core.PyCode.call(PyCode.java) > >> >> at org.python.core.Py.runCode(Py.java) > >> >> at org.python.core.Py.exec(Py.java) > >> >> at > >> >> org.python.util.PythonInterpreter.exec(PythonInterpreter.java) > >> >> at > >> >> > >> org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java) > >> > >> >> > >> >> at > >> >> > >> org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java) > >> > >> >> > >> >> at > >> >> > >> org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java) > >> > >> >> > >> >> at > >> >> org.python.util.InteractiveConsole.push(InteractiveConsole.java) > >> >> at > >> >> org.python.util.InteractiveConsole.interact(InteractiveConsole.java) > >> >> at org.python.util.jython.main(jython.java) > >> >> > >> >> java.lang.ClassFormatError: java.lang.ClassFormatError: test-mod$py > >> >> (Illegal Class name "test-mod$py") > >> >> > >> >> ********************* > >> >> > >> >> The behaviour is same with jython 2.2. Is this expected? Python works > >> >> with this import, however. > >> >> > >> >> Thanks, > >> >> Raghu. > >> >> > >> >> > >> >> > >> >> _______________________________________________ > >> >> Jython-users mailing list > >> >> Jyt...@li... > >> >> https://lists.sourceforge.net/lists/listinfo/jython-users > >> >> > >> > > >> > > > |