reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Import errors inside reflex under the hood

Open Darkstrouk opened this issue 1 year ago β€’ 3 comments

Hi, team So Idk why u chose name ur packages inside reflex lib same names as packages but when i trying to run a reflex.py in my venv/reflex/reflex.py it throws an error:

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1534, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/darkstrouk/Documents/test_sql_chat/sql_chat/my_env/lib/python3.9/site-packages/reflex/reflex.py", line 16, in <module>
    from .reflex import constants
ImportError: attempted relative import with no known parent package

The same situation in ur chat repo - u named chat 2 packages and 1 folder and there is a lot of problems within it - it is forcing me to chane ur lib code but what to do with this import errors - idk, as well as ur AI assistant

pls help me with it if i just dont know about some special knowledge or hust refactor ur lib code

Specifics :

  • Python Version: 3.9.6
  • Reflex Version: latest
  • OS: MacOs

Darkstrouk avatar Jun 17 '24 09:06 Darkstrouk

Do you get this error when you do reflex run?

picklelo avatar Jun 17 '24 21:06 picklelo

@Darkstrouk how are running your reflex app in pycharm? You don't need to run the reflex.py module if that's what you're doing. You need to run reflex init in your cli in a new directory and then reflex run in the new directory to run the app. Refer to this page in the docs for more info on how to do that.

ElijahAhianyo avatar Jun 18 '24 10:06 ElijahAhianyo

closing this now, feel free to reopen if you feel the need to.

ElijahAhianyo avatar Jun 26 '24 20:06 ElijahAhianyo