Python import myapp Error for win10 [Solved]


#1

I follow the USER GUIDE https://plot.ly/dash/plugins
But in the Step 5, I can’t import myapp

In [1]: import myapp
File “< string >”, line 1
class src\components\ExampleComponent(Component):

                                                      ^

SyntaxError: unexpected character after line continuation character

how to solve it error …?


#2

the path in metadata.json is from “src/components/ExampleComponent” to “src\components\ExampleComponent” when using

python setup.py install

for win10 system… and make that error …
,and the bundle.js is not available …
so i copy the metadata.json and bundle.js to

python\Lib\site-packages\myapp-0.0.1-py3.6.egg\myapp

, and it pass to perform locally finally. :laughing:


#3

Exactly , for the win 10

  1. when using

npm install

the path in metadata.json is

“src\\components\\ExampleComponent.react.js”

, so the dash moudle can’t read it , you need just `

change \\ to /

  1. For __ init __ .py file, you need to remove “https://unpkg.com/react-dom@15.4.2/dist/react-dom.min.js” if you want to run your app locally.

then, you can run sucessfully :grinning: