• Iliya Manolov's avatar
    Fixed multiple import errors in Jupyter · 99b525a1
    Iliya Manolov authored
    Copypasta from the other MR [here](nexedi/erp5!230 (comment 22890)). I found a problem and tried again from scratch. I will close that Merge Request once this one has been approved...
    
    
    
    @Tyagov
    Currently, when running a Jupyter notebook using some types of imports leads to errors. With this fix the following ways to import things are working:
    ```python
    import string                  # worked before fix
    import string as s             # worked before fix
    from string import ascii_lowercase             # worked before fix
    from string import ascii_lowercase, ascii_uppercase, digits           # fixed - used to import only the first thing
    from string import ascii_lowercase as a, ascii_uppercase as b         # fixed - used to give "Error at Server Side"
    from string import *                                                  # fixed - used to give "Error at Server Side"
    from string import Template                                           # works
    ```
    This was happening because after executing every cell the code would move between SlapOS nodes and lose the imported modules/classes/stuff. This was partially fixed before, but this fix should cover all use cases. I have also added tests for these cases in testExecuteJupyter...
    
    /reviewed-on nexedi/erp5!233
    99b525a1
extension.erp5.JupyterCompile.py 39.7 KB