Skip to content

Loading…

pyjsbuild --dynamic=".*" fails for dynamic imports involving a classname (from X import Y?) #331

Open
pyjsorg opened this Issue · 3 comments

1 participant

@pyjsorg

What steps will reproduce the problem?
1) create a folder, "static"
2) create file, "index.py", with this content:

from pyjamas.ui.RootPanel import RootPanel

if name == 'main':
pass

3) build app into static folder, w/dynamic module loading:

>>> pyjsbuild --dynamic=".*" -mdo static index.py

4) serve the static folder:

>>> cd static; python -m SimpleHTTPServer

5) try to load the page, "http://localhost:8000"

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

EXPECTED:
blank page to load, no import errors

ACTUAL:
index ImportError: No module named pyjamas.ui.RootPanel.RootPanel,
pyjamas.ui.RootPanel.RootPanel in context null

Please use labels and text to provide additional information.

the code in dynamic.js/py seems to be trying to pull the file
"lib/pyjamas.ui.RootPanel.RootPanel" instead of the actual module file at
"lib/pyjamas.ui.RootPanel". if you rebuild the app without --dynamic
everything works as expected.

Original issue: http://code.google.com/p/pyjamas/issues/detail?id=388 (March 31, 2010 03:07:24)

@pyjsorg

From exto...@gmail.com on March 31, 2010 18:33:12:
er as an attachment...

@pyjsorg

From exto...@gmail.com on March 31, 2010 23:26:16:
i can confirm dynamic load works for:

import pyjamas.ui.RootPanel
import pyjamas.ui.RootPanel as rp

then either use fully qualified name or rp. does not work for:

from pyjamas.ui.RootPanel import RootPanel

i am working on pyjslib.py import to fix this... seems that the JS import
mechanism never tries to dynamically load the parent first.

@pyjsorg

From exto...@gmail.com on April 01, 2010 01:51:49:
here is a preliminary patch for dynamically loading the parent; i'm not sure what all
is going on here:

what is...
JS("$pyjs.track.module = save_track_module;")

when do i need to (seems not consistent)...
sys.modules[parentName] = module

patch allows the simple case to run, but fails on my actual app with:

index ReferenceError: jsonrpc is not defined

(which coincidentally is the last module to be loaded... this isn't the most
informative post, im still trying to get a working pyjamas-desktop (hulahop won't
compile on archlinux...) ill try to get a stack trace from pyjs (im enabling debug,
but the console is empty other than XHR requests? [Chrome])

feedback appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.