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

Example script_executor #1240

Closed
v479038280 opened this issue Jul 24, 2023 · 13 comments · Fixed by #1331
Closed

Example script_executor #1240

v479038280 opened this issue Jul 24, 2023 · 13 comments · Fixed by #1331
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@v479038280
Copy link

Description

It seems that the example does not work
微信截图_20230724114809

I'm using Python 3.11.4

@rodja
Copy link
Member

rodja commented Jul 24, 2023

It works fine for me (Mac with Python 3.11). What OS are you on? And is there any console log output?

@v479038280
Copy link
Author

v479038280 commented Jul 24, 2023

It works fine for me (Mac with Python 3.11). What OS are you on? And is there any console log output?

here is the console outpus , nothing wrong, I'm using windows10
微信截图_20230724173232

@falkoschindler
Copy link
Contributor

What do you see if you run python3 hello.py in the console?

@v479038280
Copy link
Author

v479038280 commented Jul 24, 2023

What do you see if you run python3 hello.py in the console?

The result is same.
微信截图_20230725070131

@rodja
Copy link
Member

rodja commented Jul 25, 2023

We use python3 in the run_command calls. But you use simply python. Is python3 working for you? Otherwise you need to change the example and remove the 3.

@v479038280
Copy link
Author

v479038280 commented Jul 25, 2023

We use python3 in the run_command calls. But you use simply python. Is python3 working for you? Otherwise you need to change the example and remove the 3.

I change python3 to python ,it works

ui.button("python hello.py", on_click=lambda: run_command("python hello.py")).props(
    "no-caps"
)
ui.button("python slow.py", on_click=lambda: run_command("python slow.py")).props(
    "no-caps"
)

@rodja
Copy link
Member

rodja commented Jul 25, 2023

That's great. It seems we can not rely on the existence of python3 command. Maybe we need to probe for the right command at startup? Or take the python bin with which the app has been started?

@rodja rodja added bug Something isn't working help wanted Extra attention is needed labels Jul 25, 2023
@v479038280
Copy link
Author

v479038280 commented Jul 25, 2023

That's great. It seems we can not rely on the existence of python3 command. Maybe we need to probe for the right command at startup? Or take the python bin with which the app has been started?

I just ran these examples to see how it looks , and haven't looked throuth its code, this kind of bug is not actually a bug

@rodja
Copy link
Member

rodja commented Jul 25, 2023

this kind of bug is not actually a bug

True. But it is very inconvenient. I would love to see it fixed.

@falkoschindler
Copy link
Contributor

I'd vote for leaving it as it is. It is just an example and a look into the code would have unveiled the issue.
It is strange though, that the system didn't yield an error message shown in the dialog.
Anyway, that's why I asked for the output of python3 hello.py (which hasn't been answered).

@v479038280
Copy link
Author

I'm using python3.11.4,but I didnot install the python2,so I didn't need to use python3,I didn't notice that this is why it didn't work,

@falkoschindler
Copy link
Contributor

@rodja What about ./hello.py? This could be more stable. But we would need to make hello.py and slow.py executable.

@v479038280 Could you check if this works on your machine? The code would look like this:

ui.button('./hello.py', on_click=lambda: run_command('./hello.py')).props('no-caps')
ui.button('./slow.py', on_click=lambda: run_command('./slow.py')).props('no-caps')
with ui.row().classes('items-center'):
    ui.button('./hello.py "<message>"', on_click=lambda: run_command(f'./hello.py "{message.value}"')).props('no-caps')
    message = ui.input('message', value='NiceGUI')

@falkoschindler falkoschindler added the question Further information is requested label Jul 26, 2023
@v479038280
Copy link
Author

@rodja What about ./hello.py? This could be more stable. But we would need to make hello.py and slow.py executable.

@v479038280 Could you check if this works on your machine? The code would look like this:

ui.button('./hello.py', on_click=lambda: run_command('./hello.py')).props('no-caps')
ui.button('./slow.py', on_click=lambda: run_command('./slow.py')).props('no-caps')
with ui.row().classes('items-center'):
    ui.button('./hello.py "<message>"', on_click=lambda: run_command(f'./hello.py "{message.value}"')).props('no-caps')
    message = ui.input('message', value='NiceGUI')

Here is the result
微信截图_20230727000356

and the console output. not a valid Win32 application (不是有效的 Win32 应用程序) I'm using WIN10 64 PROFESSIONAL
微信截图_20230727000552

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants