Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Rohan Jaswal
    @rohanjaswal2507
    What is the best way to do that? Any example.
    The javascript module doesn't have any objects, models or anything else.
    I want that I should be able to run this type of python code in ipython
    import module1
    return_value = module1.f1(arg1, arg2)
    Douglas Blank
    @dsblank
    I think that is a great question to ask! This would allow using any JS from Python. I don't know exactly how to answer your question (may have to ask in the ipython/ipywidgets github). I think the answer will involve backbone.js. Perhaps looking at these will help: https://github.com/ipython/ipywidgets/tree/master/docs/source/examples
    Douglas Blank
    @dsblank
    From the ipython/ipython gitter group from @minrk:
    "flexx provides an API for calling JavaScript from Python, but I'm not sure if it works in IPython.
    @jdfreder made ipython-jsobject with similar goals some time ago, but I don't think it's been touched in some time."
    Rohan Jaswal
    @rohanjaswal2507
    Yeah, just saw that message. let me have a look into this.
    Thank you! :smile:
    Rohan Jaswal
    @rohanjaswal2507
    @dsblank I went through flexx and I don't think this can help us in achieving what we want to.
    Douglas Blank
    @dsblank
    Ok. @jdfreder's ipython-jsobject looks useful.
    Tim Ruffles
    @timruffles
    Hi Rohan - wouldn't you want to use the comms already built into ipython? https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Low%20Level.html#Comms
    @rohanjaswal2507 it's always going to be an RPC communication. You'll need to make a decision about how biojs widget authors should expose an API to allow their widgets to be exposed to the ipython context
    Rohan Jaswal
    @rohanjaswal2507
    @timruffles Yes, That is the approach I would use while creating widgets. But, I just wanted to know if there is some method which could help in using generic code from some javascript library.
    Tim Ruffles
    @timruffles
    I mean you could whip up something like JSON RPC etc, but to avoid the X y problem: why do you want to do that?
    Rohan Jaswal
    @rohanjaswal2507
    I just wanted to know if there exists any approach to do that.
    Rohan Jaswal
    @rohanjaswal2507
    @dsblank I am trying to create a widget to parse urls using clustal today.
    While doing that, I am facing some problems.
    I am sharing the screenshot of browser console
    And here is the link to the gist containing the code for that widget.
    https://gist.github.com/rohanjaswal2507/16cd78d5684de859a9d9f23e394fad81
    Where am I going wrong?
    I created some simple widgets earlier. Those were working fine.
    Douglas Blank
    @dsblank
    Do you see any errors in the JavaScript console?
    Rohan Jaswal
    @rohanjaswal2507
    No these were the only errors I could see.
    Douglas Blank
    @dsblank
    What browser are you using?
    Rohan Jaswal
    @rohanjaswal2507
    I am using firefox
    Rohan Jaswal
    @rohanjaswal2507
    Neither working in chrome
    Douglas Blank
    @dsblank
    In chrome, I get errors. But that might be because of cross-site scripting prevention
    Rohan Jaswal
    @rohanjaswal2507
    Okay. So, what should I do now?
    Douglas Blank
    @dsblank
    What version of the Jupyter API are targeting/using?
    Rohan Jaswal
    @rohanjaswal2507
    @dsblank 4.1.0
    Tim Ruffles
    @timruffles
    is there some magic exposing MsaParseUrl?
    the only thing I see registered with iPython is MsaParseUrlView
    Tim Ruffles
    @timruffles
    ignore me, didn't read the whole code sample :)
    can you put console.log() messages in your JS code?
    Rohan Jaswal
    @rohanjaswal2507
    @timruffles Yes, let me do that.
    @timruffles bt where exactly you want me to put console.log()?
    *console.log()
    Rohan Jaswal
    @rohanjaswal2507
    @timruffles I put console.log() statements in JS code.
    Here is the gist:
    https://gist.github.com/rohanjaswal2507/119974d4c40f9cb8f2ea858b06dd9c5a
    And these are the errors I am receiving in the console.
    http://imgur.com/MSjUJfh
    Douglas Blank
    @dsblank
    I would either ask on one of the jupyter gitter chats, or ask in the ipywidgets github issues. It looks clear that there are errors here.
    Rohan Jaswal
    @rohanjaswal2507
    @dsblank what are these errors related to? Moreover, the errors this time are different while the code is same.
    How is that possible?
    Douglas Blank
    @dsblank
    I don't know... I would have to dive into the issue. But you can get help from the jupyter people, I suspect. Is this based on @jdfreder's ipython-jsobject?
    Rohan Jaswal
    @rohanjaswal2507
    @dsblank Not exactly based on his work.
    Douglas Blank
    @dsblank
    Does his work directly?
    Rohan Jaswal
    @rohanjaswal2507
    After running some widgets that integrate js in IPython, I noticed that this problem is very common.
    Error: Script error for "nbextensions/widgets/widgets/js/widget" http://requirejs.org/docs/errors.html#scripterror
    Douglas Blank
    @dsblank
    Made an issue here: jdfreder/ipython-jsobject#4
    Rohan Jaswal
    @rohanjaswal2507
    Cool. Will catch up there.
    Douglas Blank
    @dsblank
    @rohanjaswal2507 did you see @jdfreder's update? Can you try those changes and see if you can get his code to work?
    Rohan Jaswal
    @rohanjaswal2507
    @dsblank I am trying to get his code working. As he mentioned about the troubles with static assets installation, I am facing some troubles. Have asked him for more help.