Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with Jupyter Notebook? #86

Open
renato-umeton opened this issue Feb 1, 2018 · 1 comment
Open

Not compatible with Jupyter Notebook? #86

renato-umeton opened this issue Feb 1, 2018 · 1 comment

Comments

@renato-umeton
Copy link

renato-umeton commented Feb 1, 2018

Creating your @dataspyre hello-world app in a JupyterNotebook cell raises an error, @adamhajari :

Same exact code outside of jupyter works just fine. 😮

from spyre import server

class SimpleApp(server.App):
    title = "Simple App"
    inputs = [{
        "type": "text",
        "key": "words",
        "label": "write words here",
        "value": "hello world", 
        "action_id": "simple_html_output"
    }]

    outputs = [{
        "type": "html",
        "id": "simple_html_output"
    }]

    def getHTML(self, params):
        words = params["words"]
        return "Here's what you wrote in the textbox: <b>%s</b>" % words

app = SimpleApp()

app.launch()

error:

     20         self.JS_PATH = os.path.join(self.ROOT_DIR, 'public', 'js')
     21         self.CSS_PATH = os.path.join(self.ROOT_DIR, 'public', 'css')
---> 22         self.APP_PATH = os.path.dirname(os.path.realpath(__main__.__file__))
     23 
     24     def getHTML(self):

AttributeError: 'module' object has no attribute '__file__'

Can you help me figure out how to overcome this? Thanks!

import sys; sys.version
'2.7.14 |Anaconda custom (64-bit)| (default, Oct  5 2017, 02:28:52) \n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]'

jupyter notebook --version
5.0.0
@Morarin1
Copy link

I get the same error! Could you fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants