Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Root path Flask IDE
#1
Hi,
I have a problem running an app built with Flask in PyCharm, but it is working correctly in the shell.
It seems to come from a root path, does anyone know how to fix it ?
Thanks,
Here is the code : the classical

#! /usr/bin/python
# -*- coding:utf-8 -*-
 
from flask import Flask
import os
app = Flask(__name__)
 
@app.route('/')
def index():
    return "Hello !"
 
if __name__ == '__main__':
    app.run(debug=True)
Reply
#2
(Oct-30-2018, 09:29 AM)vandelouw Wrote: I have a problem running an app built with Flask in PyCharm
Exactly what problem do you have? Do you get any errors/traceback? What python version you use, what OS, etc.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Hi Buran,
yes sorry to have forgotten, here is the traceback of the error :

Error:
Traceback (most recent call last): File "<input>", line 6, in <module> File "/Users/romainvandelouw/anaconda/envs/pycharm/lib/python3.6/site-packages/flask/app.py", line 370, in __init__ root_path=root_path File "/Users/romainvandelouw/anaconda/envs/pycharm/lib/python3.6/site-packages/flask/helpers.py", line 884, in __init__ root_path = get_root_path(self.import_name) File "/Users/romainvandelouw/anaconda/envs/pycharm/lib/python3.6/site-packages/flask/helpers.py", line 756, in get_root_path 'provided.' % import_name) RuntimeError: No root path can be found for the provided module "builtins". This can happen because the module came from an import hook that does not provide file name information or because it's a namespace package. In this case the root path needs to be explicitly provided.
I'm running on a Mac, with Python3.6
Reply
#4
Hi Larz60+,
thanks, I'll be more careful next time !
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020