question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module "ImportError" at specific url path

See original GitHub issue

When I run window.runCode("import smartpy") at cryptocodeschool root url path it works perfectly fine.

But, when I try running the same command at a specific URL path directly ( for example https://develop.cryptocodeschool.in/tezos/lesson/module-01/chapter-15 ) it throws an error :

"Traceback (most recent call last):
  module __main__ line 212, in run
    import smartpy
ImportError: 'No module named smartpy'"

I have initialized brython using brython({ debug: 1, indexedDB: false }); command.

I have also tried using brython({ debug: 1, pythonpath: '.', hint: 'py' }); command for initialization. In this case it throws this error: Screenshot 2020-11-01 at 5 21 58 PM

Repo link: https://github.com/buidl-labs/crypto-code-school-inside-tezos

The codebase is based on Gatsby. I don’t if it’s a gatsby thing or maybe I am initializing the Brython incorrectly cause it seems to work fine at the root URL but if I go to a specific URL directly it throws an error in that case.

All the related files are in the static folder and Brython is being initialized inside the gatsby-browser.js file.

I have been stuck at it for a while now and any help would be really help 🙏…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
PierreQuentelcommented, Nov 4, 2020

Cool ! I close the issue then.

0reactions
bhaskarSinghcommented, Nov 4, 2020

Yes, it’s working now. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module import error even though sys.path shows the directory?
I am having trouble installing a package through its directory (not possible to install through pip, only folder available) on my mac.
Read more >
cannot import name 'url' from 'django.conf.urls' solved in Django
ImportError : cannot import name ' url ' from 'django.conf. urls ' solved in DjangoTo clear more you could read ...
Read more >
importlib — The implementation of import — Python 3.11.1 ...
An abstract method that is to return the value of __file__ for the specified module. If no path is available, ImportError is raised....
Read more >
ES Module loading with abolute path fails on windows #31710
the issue is that C:/ is ambiguous with a URL. (like HTTP:/ ) and we use URLs in the loader.
Read more >
ModuleNotFoundError: No module named x
How to fix ModuleNotFoundError and ImportError? Now we're up to speed with how the basic import statement is executed and what is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found