-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[🐛 BUG] Getting OS Error while using the GUI module. #1779
Comments
What Taipy version are you using? Do you use any tools that can conflict with Taipy? |
Taipy version is 3.1.1. I've tried it on multiple environments with python versions of 3.11 and 3.12 but got the same os error while calling the GUI module. |
Thank you for the quick answer! Are you coding in a cloud environment? Can you test: from taipy.gui import Gui
Gui(page="# Hello world").run() |
Did you create a brand new environment for your Taipy installation? Maybe, that could fix this issue. @FabienLelaquais @FredLL-Avaiga Do you have any idea? |
I tried both ways, on my pre-existing environment with 3.11 python version and on a new environment with 3.12. |
if think the problem is that you're trying in the console and we need a file... |
I guess we should give a proper error message |
True, I can replicate the issue: >>> from taipy.gui import Gui
>>> Gui("Hello").run()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\jacta\.conda\envs\4.0\Lib\site-packages\taipy\gui\gui.py", line 2705, in run
self.__var_dir.set_default(self.__frame)
File "C:\Users\jacta\.conda\envs\4.0\Lib\site-packages\taipy\gui\utils\_variable_directory.py", line 31, in set_default
self.add_frame(frame)
File "C:\Users\jacta\.conda\envs\4.0\Lib\site-packages\taipy\gui\utils\_variable_directory.py", line 38, in add_frame
imported_var_list = _get_imported_var(frame)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jacta\.conda\envs\4.0\Lib\site-packages\taipy\gui\utils\get_imported_var.py", line 21, in _get_imported_var
st = ast.parse(inspect.getsource(frame))
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jacta\.conda\envs\4.0\Lib\inspect.py", line 1279, in getsource
lines, lnum = getsourcelines(object)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jacta\.conda\envs\4.0\Lib\inspect.py", line 1261, in getsourcelines
lines, lnum = findsource(object)
^^^^^^^^^^^^^^^^^^
File "C:\Users\jacta\.conda\envs\4.0\Lib\inspect.py", line 1090, in findsource
raise OSError('could not get source code')
OSError: could not get source code You should use Python files to run a Taipy application. |
using python files should solve the issue. As far as I understood the issue is occurring due to the code being run on a python console |
It seems that you are already assigned to another issue @SGCODEX |
Hi @FlorianJacta, I can work on this issue. It would be great if you could explain the steps required to solve the issue/preferred solution since this will be my first PR for this repo. |
@aniketh-varma Let me assign the issue to you. Thanks for your help. For your questions, I let @FabienLelaquais @FredLL-Avaiga @dinhlongviolin1 @namnguyen20999 answer. They are the right persons. |
Hey @FabienLelaquais @FredLL-Avaiga @dinhlongviolin1 @namnguyen20999 , can you please help me with a preferred solution for the issue. |
Hi @RandomArnab, @aniketh-varma, and @SGCODEX. Unfortunately (or fortunately), @Paulie-Aditya is right (and @FlorianJacta confirms it): Taipy GUI cannot run straight from the console because it needs runtime information (like locating callback functions or tricky bindings) that are available only when the script is an actual file. As @FredLL-Avaiga points out, the least Taipy could do is document this limitation and issue a more informative error message. I recommend we keep this issue open, and I add a note on this discovery in the description. Thanks again, |
New Quest!A new Quest has been launched in @Avaiga’s repo. Some loot has been stashed in this issue to reward the solver! 🗡 Comment ⚔️ When you submit a PR, comment Questions? Check out the docs. |
This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines. |
This issue has been unassigned automatically because it has been marked as "🥶Waiting for contributor" for more than 14 days with no activity. |
What went wrong? 🤔
Can't use the GUI module properly from an interactive Python prompt.
=>
Proposed 'solution' (well it's not, really)
Taipy GUI cannot function properly in these conditions because it relies heavily on an actual Python source file, such as one available when running a script or from a Notebook session. Currently, there is no feasible workaround for this limitation.
To address this, we should document the limitation clearly and implement an error message that accurately explains the issue, replacing the existing cryptic exception message.
Acceptance Criteria
Code of Conduct
The text was updated successfully, but these errors were encountered: