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

Included examples may fail with "'module' object has no attribute '__path__'" on baremetal ports (e.g. ESP8266) #15

Open
chrisb2 opened this issue Aug 11, 2017 · 1 comment

Comments

@chrisb2
Copy link

chrisb2 commented Aug 11, 2017

Environment: NodeMcu clone ESP8266 with picoweb built into custom firmware

  1. Copy example_webapp2.py to esp8266 and squares.tpl into templates dir
  2. Connect to network as station
  3. Add IP address as host parameter in last line of example_webapp2.py
  4. Reset
  5. At REPL: import example_webapp2.py
  6. From PC on network: http://ip-address-esp8266:8081/squares

Results in:

24.000 <HTTPRequest object at 3fff3e50> <StreamWriter <socket state=2 timeout=0 incoming=3fffac78 off=23>> "GET /squares"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "example_webapp2.py", line 24, in <module>
  File "picoweb/__init__.py", line 240, in run
  File "uasyncio/core.py", line 121, in run_forever
  File "uasyncio/core.py", line 85, in run_forever
  File "picoweb/__init__.py", line 156, in _handle
  File "example_webapp2.py", line 18, in squares
  File "picoweb/__init__.py", line 194, in render_template
  File "picoweb/__init__.py", line 190, in _load_template
  File "utemplate/source.py", line 153, in __init__
AttributeError: 'module' object has no attribute '__path__'

Work-around:
Update:
app = picoweb.WebApp(__name__)
To:
app = picoweb.WebApp(None)

@pfalcon pfalcon changed the title example_webapp2.py /squares HTTP request fails example_webapp2.py /squares HTTP request fails running on ESP8266 Nov 1, 2017
@pfalcon pfalcon changed the title example_webapp2.py /squares HTTP request fails running on ESP8266 Included examples may fail with "'module' object has no attribute '__path__'" on baremetal ports (e.g. ESP8266) Dec 1, 2017
@GHPS
Copy link

GHPS commented Mar 14, 2019

I had the same problem with the latest release version of picoweb under
MicroPython 1.10 on an ESP32. So the problem is still there...

The work-around (deleting the reference to __name__) worked fine
though it took me a while to find this issue report and the solution.

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