-
Notifications
You must be signed in to change notification settings - Fork 284
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
Error when using stand alone file with state class #1147
Comments
That's interesting. I'll try to repro your example. But I've done this before with no problem (although I'm using MacOS with Chrome, so could be a Windows specific thing but seems odd). But your code looks fine to me at a glance. Here's an example of separated state that does work for me (but granted haven't worked on this project in a while): |
Hi, tomorrow I'll send you version of mesop do it fine on windows from my work pcנשלח מה-Galaxy שלי
-------- הודעה מקורית --------מאת: Richard To ***@***.***> תאריך: 14.12.2024 18:05 (GMT+02:00) אל: google/mesop ***@***.***> עותק: ustas4 ***@***.***>, Author ***@***.***> נושא: Re: [google/mesop] Error when using stand alone file with state class (Issue #1147)
That's interesting. I'll try to repro your example. But I've done this before with no problem (although I'm using MacOS with Chrome, so could be a Windows specific thing but seems odd).
But your code looks fine to me at a glance.
Here's an example of separated state that does work for me (but granted haven't worked on this project in a while):
https://github.com/richard-to/mesop-prompt-tuner/blob/main/main.py
https://github.com/richard-to/mesop-prompt-tuner/blob/main/state.py
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
OK, my work chrome version is90.0.4330.72(Official Build) (64-bit) Windows 10 Enterprise 2016 LTSBMesop 0.12.8 Python 3.13Separate file state.py work fineנשלח מה-Galaxy שלי
-------- הודעה מקורית --------מאת: Richard To ***@***.***> תאריך: 14.12.2024 18:05 (GMT+02:00) אל: google/mesop ***@***.***> עותק: ustas4 ***@***.***>, Author ***@***.***> נושא: Re: [google/mesop] Error when using stand alone file with state class (Issue #1147)
That's interesting. I'll try to repro your example. But I've done this before with no problem (although I'm using MacOS with Chrome, so could be a Windows specific thing but seems odd).
But your code looks fine to me at a glance.
Here's an example of separated state that does work for me (but granted haven't worked on this project in a while):
https://github.com/richard-to/mesop-prompt-tuner/blob/main/main.py
https://github.com/richard-to/mesop-prompt-tuner/blob/main/state.py
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hmm, yeah. That's pretty strange. Not sure what could be causing the difference in behavior. |
Describe the bug
using separated file contains class State impossible
To Reproduce
Steps to reproduce the behavior:
@me.stateclass
class State:
is_dialog_open: bool = False`_
use separated class in your main.py
_`import mesop as me
from my_state import State
...
@me.page(
on_load=load,
security_policy=me.SecurityPolicy(
allowed_iframe_parents=["https://google.github.io"]
),
path="/badge",
)
def app():
s = me.state(State)
..._
5.Start application as
mesop main.py`See error
**Mesop Developer Error: Tried to get the state instance for State, but it's not a state class.
Did you forget to decorate your state class State with @stateclass?**
A clear and concise description of what you expected to happen.
Screenshots
Desktop System Info
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: