gatech-csl / jes

The Jython Environment for Students allows students to write Jython programs that can manipulate pictures, sounds, and videos.
http://mediacomputation.org/
59 stars 38 forks source link

Trying to import JES libraries in Jython 2.2.1 #49

Open leafstorm opened 10 years ago

leafstorm commented 10 years ago

From jason.r....@gmail.com on May 16, 2011 15:07:55

What steps will reproduce the problem? 1. Starting Jython 2.2.1 shell

  1. Using the following commands (pg 227 in Intro to Computing and Programming in Python):

import sys sys.path.insert(0,"C:\Program Files\JES 4.3\Sources") from media import *

  1. These lines cause a series of "ClassNotFound Exceptions" starting on line 183 in media.py (in the Sources directory).

If I comment out lines 184-204 in media.py (namely the makeEmptySound function and the makeEmptySoundBySeconds function), the lines above work and I am able to use the majority of the JES library. What is the expected output? What do you see instead? Expected successful import of all items in media.py. Get an error instead. What version of the product are you using? On what operating system? Using JES 4.3, Jython 2.2.1, on Windows Vista Please provide any additional information below. I should note that I had no issues utilizing the image/color functions in the library outside the JES.

Original issue: http://code.google.com/p/mediacomp-jes/issues/detail?id=49

leafstorm commented 10 years ago

From kristoff...@gmail.com on May 05, 2014 02:11:38

This problem is remaining when running Jython 2.7.b2 and Windows 7. I am glad I stumbled on this thread after many attempts. //Annica

benevolentprof commented 9 years ago

I encountered this problem on a Mac running Jython 2.5.3 on OS X 10.9.5. JES works fine.

I followed the instructions in the textbook (Introduction to Computing & Programming in Python) in Section 9.6.

The problem seems to be with "import Sound" on line 93. Here is the error message.

import sys sys.path ['', '/Users/ses/jython2.5.3/Lib/site-packages/setuptools-1.1.5-py2.5.egg', '/Users/ses/jython2.5.3/Lib/site-packages/pip-1.4.1-py2.5.egg', '/Users/ses/jython2.5.3/Lib', 'classpath', 'pyclasspath/', '/Users/ses/jython2.5.3/Lib/site-packages'] sys.path.insert(0, "/Users/ses/Documents/teaching/cct374/jes-4-3.app/Contents/Resources/Java") from media import * Traceback (most recent call last): File "", line 1, in File "/Users/ses/Documents/teaching/cct374/jes-4-3.app/Contents/Resources/Java/media.py", line 93, in import Sound at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:249) at org.python.core.Py.loadAndInitClass(Py.java:909) at org.python.core.Py.findClassInternal(Py.java:844) at org.python.core.Py.findClassEx(Py.java:895) at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133) at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:28) at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122) at org.python.core.PyJavaPackage.findattr_ex(PyJavaPackage.java:137) at org.python.core.PyObject.findattr(PyObject.java:863) at org.python.core.packagecache.PackageManager.lookupName(PackageManager.java:136) at org.python.core.JavaImporter.find_module(JavaImporter.java:39) at org.python.core.JavaImporter.find_module(JavaImporter.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597)

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: javazoom/jl/converter/Converter

If I comment out line 93, the problem shifts to line 179. (And, not surprisingly, JES stops working.) The error message is as follows.

from media import * Traceback (most recent call last): File "", line 1, in File "/Users/ses/Documents/teaching/cct374/jes-4-3.app/Contents/Resources/Java/media.py", line 179, in def makeEmptySound(numSamples, samplingRate = Sound.SAMPLE_RATE): NameError: name 'Sound' is not defined

I comment out the makeEmptySound() function, and then the makeEmptySoundBySeconds() functions. It now works, but I can't use sound, which is OK. But JES won't launch, which is a problem. (I suppose I could get around this by making a copy of the JES resources.) Anyhow, suffice it to say that it's a bug.

mjguzdial commented 9 years ago

I know that that section of the book worked for a prior version of Jython, but I'm not surprised that there are differences that make it harder to work as-is with a newer version of Jython. Not clear I'd call it a bug with JES, though.


From: Susan Elliott Sim [notifications@github.com] Sent: Wednesday, March 11, 2015 11:14 PM To: gatech-csl/jes Subject: Re: [jes] Trying to import JES libraries in Jython 2.2.1 (#49)

I encountered this problem on a Mac running Jython 2.5.3 on OS X 10.9.5. JES works fine.

I followed the instructions in the textbook (Introduction to Computing & Programming in Python) in Section 9.6.

The problem seems to be with "import Sound" on line 93. Here is the error message.

import sys sys.path ['', '/Users/ses/jython2.5.3/Lib/site-packages/setuptools-1.1.5-py2.5.egg', '/Users/ses/jython2.5.3/Lib/site-packages/pip-1.4.1-py2.5.egg', '/Users/ses/jython2.5.3/Lib', 'classpath', 'pyclasspath/', '/Users/ses/jython2.5.3/Lib/site-packages'] sys.path.insert(0, "/Users/ses/Documents/teaching/cct374/jes-4-3.app/Contents/Resources/Java") from media import * Traceback (most recent call last): File "", line 1, in File "/Users/ses/Documents/teaching/cct374/jes-4-3.app/Contents/Resources/Java/media.py", line 93, in import Sound at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:249) at org.python.core.Py.loadAndInitClass(Py.java:909) at org.python.core.Py.findClassInternal(Py.java:844) at org.python.core.Py.findClassEx(Py.java:895) at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133) at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:28) at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122) at org.python.core.PyJavaPackage.findattr_ex(PyJavaPackage.java:137) at org.python.core.PyObject.findattr(PyObject.java:863) at org.python.core.packagecache.PackageManager.lookupName(PackageManager.java:136) at org.python.core.JavaImporter.find_module(JavaImporter.java:39) at org.python.core.JavaImporter.find_module(JavaImporter.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597)

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: javazoom/jl/converter/Converter

If I comment out line 93, the problem shifts to line 179. (And, not surprisingly, JES stops working.) The error message is as follows.

from media import * Traceback (most recent call last): File "", line 1, in File "/Users/ses/Documents/teaching/cct374/jes-4-3.app/Contents/Resources/Java/media.py", line 179, in def makeEmptySound(numSamples, samplingRate = Sound.SAMPLE_RATE): NameError: name 'Sound' is not defined

I comment out the makeEmptySound() function, and then the makeEmptySoundBySeconds() functions. It now works, but I can't use sound, which is OK. But JES won't launch, which is a problem. (I suppose I could get around this by making a copy of the JES resources.) Anyhow, suffice it to say that it's a bug.

— Reply to this email directly or view it on GitHubhttps://github.com/gatech-csl/jes/issues/49#issuecomment-78416744.