Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ValueError Invalid file for CanvasProcessing example #29

Open
pyjsorg opened this Issue Apr 27, 2012 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

pyjsorg commented Apr 27, 2012

What steps will reproduce the problem?

  1. build and install pyjs
  2. cd examples
  3. python canvasprocessing

What is the expected output? What do you see instead?
expected: successful compilation. Instead we get:

Building : CanvasProcessing
PYJSPATH : [
/mnt/run_default/newhome/ubuntu/tmp/pyjamas/examples/canvasprocessing
/mnt/run_default/newhome/ubuntu/tmp/pyjamas/library
/mnt/run_default/newhome/ubuntu/tmp/pyjamas/addons
]
Traceback (most recent call last):
File "../../bin/pyjsbuild", line 21, in <module>
pyjs.browser.build_script()
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/browser.py", line 539, in build_script
runtime_options, args)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/browser.py", line 392, in build
l()
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 275, in call
self.visit_modules(self.modules, platform)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 329, in visit_modules
self.visit_module(p, override_paths, platform, module_name=mn)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 382, in visit_module
self.keep_lib_files)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 158, in out_translate
deps, js_libs = parse_outfile(out_file)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 93, in parse_outfile
raise ValueError("Invalid file: %s" % out_file)
ValueError: Invalid file: /mnt/run_default/newhome/ubuntu/tmp/pyjamas/examples/canvasprocessing/CanvasProcessing.js

Please use labels and text to provide additional information.

Original issue: http://code.google.com/p/pyjamas/issues/detail?id=694 (February 25, 2012 16:21:13)

Contributor

pyjsorg commented Apr 27, 2012

From yangofz...@gmail.com on February 25, 2012 16:31:13:
Using the 'build.sh' command located in the examples/canvasprocessing we get a slightly different compilation error:

$ ./build.sh
Building : CanvasProcessing
PYJSPATH : [
/mnt/run_default/newhome/ubuntu/tmp/pyjamas/examples/canvasprocessing
/mnt/run_default/newhome/ubuntu/tmp/pyjamas/library
/mnt/run_default/newhome/ubuntu/tmp/pyjamas/addons
]
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/builtin/pyjslib.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/lib/sys.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/dynamic.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjamas/init.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjamas/DOM.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjd.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjamas/Window.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjamas/Location.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjamas/ui/init.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/library/pyjamas/ui/Event.py
Translating file : /mnt/run_default/newhome/ubuntu/tmp/pyjamas/examples/canvasprocessing/CanvasProcessing.py
Traceback (most recent call last):
File "../../bin/pyjsbuild", line 21, in
pyjs.browser.build_script()
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/browser.py", line 539, in build_script
runtime_options, args)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/browser.py", line 392, in build
l()
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 275, in call
self.visit_modules(self.modules, platform)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 329, in visit_modules
self.visit_module(p, override_paths, platform, module_name=mn)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 382, in visit_module
self.keep_lib_files)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/linker.py", line 151, in out_translate
raise translator.TranslationError(stderr_value, None)
pyjs.translator_proto.TranslationError: line Unknown:
Traceback (most recent call last):
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator.py", line 69, in
main()
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator.py", line 56, in main
*_get_compile_options(options))
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator_proto.py", line 4447, in translate
module_name, sources[0], src, tree, output, *_kw)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator_proto.py", line 899, in init
self._discard(child, None)
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator_proto.py", line 3478, in _discard
optlocal_var=isinstance(node.expr.node, self.ast.Name),
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator_proto.py", line 2510, in _callfunc
optlocal_var=optlocal_var,
File "/mnt/run_default/newhome/ubuntu/tmp/pyjamas/pyjs/src/pyjs/translator_proto.py", line 2389, in _callfunc_code
raise TranslationError(e.msg, v, self.module_name)
translator_proto.TranslationError: CanvasProcessing line 10:
Cannot include file 'processing.js': [Errno 2] No such file or directory: 'processing.js'
CallFunc(Name('jsinclude'), [Const('processing.js')], None, None)

None

Contributor

pyjsorg commented Apr 27, 2012

From yangofz...@gmail.com on February 25, 2012 16:36:17:
$ git bisect good
227a272 is the first bad commit
commit 227a272
Author: Luke Leighton lkcl@lkcl.net
Date: Tue Sep 21 16:29:21 2010 +0100

call out to pyjscompile command

:040000 040000 cf6f2a3e3a2c252eedeabcaeeaf587bd9b23fc66 3dc2cc524f77b421d5f776eb3de08f119adbd2e1 M pyjs

Contributor

pyjsorg commented Apr 27, 2012

From yangofz...@gmail.com on February 25, 2012 21:09:05:
diff --git a/examples/canvasprocessing/CanvasProcessing.py b/examples/canvasproc
index 82c69c7..cfe0fa3 100644
--- a/examples/canvasprocessing/CanvasProcessing.py
+++ b/examples/canvasprocessing/CanvasProcessing.py
@@ -4,10 +4,10 @@ from pyjamas.DOM import getFirstChild
from pyjamas import Window
from pyjamas.ui.HTML import HTML
import math
-from pyjamas import jsinclude
+from pyjamas import jsimport

Include the processing.js in the module scope

-jsinclude("processing.js")
+jsimport("processing.js")
from javascript import Processing # defined by processing.js

@@ -43,7 +43,7 @@ def mouseMoved():
class ProcessingCanvas(GWTCanvas):
def init(self):
GWTCanvas.init(self, 150, 150, 150, 150)

  •    self.c = getFirstChild(self.getElement())
    
  •    self.c = self.getCanvasElement()
    self.p = Processing (self.c)
    global p
    p = self.p
    
Contributor

pyjsorg commented Apr 27, 2012

From yangofz...@gmail.com on February 25, 2012 22:03:07:
examples/canvasprocessing/download.sh
patch to examples/canvasprocessing/{main.py,build.sh} attached

Contributor

pyjsorg commented Apr 27, 2012

From yangofz...@gmail.com on February 25, 2012 22:40:16:
Compiles correctly but now I get a pop window with:

CanvasProcessing undefined: called Processing constructor as if it were a function: missing 'new'.

along with expected text:

"Note that this is an example of using processing.js.
See http://ejohn.org/blog/processingjs/ for more info.
Since processing.js is built for state-of-the-art browser
that properly implement canvas, IE is not supported."

I do phase the same issue. Any available fix so far?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment