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

Support for Python 3.9 #674

Open
MuuNU opened this issue Oct 30, 2020 · 12 comments
Open

Support for Python 3.9 #674

MuuNU opened this issue Oct 30, 2020 · 12 comments

Comments

@MuuNU
Copy link

MuuNU commented Oct 30, 2020

I tried to run example file and got this

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Roaming\Python\Python39\site-packages\flexxamples\demos\demo.py", line 7, in <module>
    from flexx import flx
ImportError: cannot import name 'flx' from 'flexx' (C:\Users\Admin\AppData\Roaming\Python\Python39\site-packages\flexx\__init__.py)

$ pip list

Package                Version    
---------------------- ---------  
astroid                2.4.2      
autopep8               1.5.4      
certifi                2020.6.20  
chardet                3.0.4      
colorama               0.4.4      
dialite                0.5.3      
flake8                 3.8.4      
flexx                  0.8.1      
idna                   2.10       
isort                  5.6.4      
jedi                   0.17.2     
lazy-object-proxy      1.4.3      
mccabe                 0.6.1      
parso                  0.7.1      
pip                    20.2.4     
pluggy                 0.13.1     
pscript                0.7.4      
pycodestyle            2.6.0      
pydocstyle             5.1.1      
pyflakes               2.2.0      
pylint                 2.6.0      
PySide2                5.15.1     
PySimpleGUI            4.30.0     
python-jsonrpc-server  0.4.0      
python-language-server 0.35.1     
requests               2.24.0     
rocket-python          1.2.15     
rocketchat-API         1.9.1      
rope                   0.18.0     
setuptools             50.3.2     
shiboken2              5.15.1     
six                    1.15.0     
snowballstemmer        2.0.0      
toml                   0.10.1     
tornado                6.0.4      
ujson                  4.0.1      
urllib3                1.25.11    
webruntime             0.5.8      
wrapt                  1.12.1     
yapf                   0.30.0     

$ python --version
Python 3.9.0

@MuuNU
Copy link
Author

MuuNU commented Oct 30, 2020

In files:

\flexx\app\_app.py
\pscript\commonast.py

I found this lines:

from base64 import encodestring as encodebytes
from base64 import encodestring as encodebytes, decodestring as decodebytes

But in base64.py no encodestring/decodestring functions, because they was deleted in 3,9 branch of python

Please fix it, or add to documentation attention about flexx don`t work with 3,9 python

@jrversteegh
Copy link
Contributor

jrversteegh commented Oct 30, 2020

Looks like python 2.7 compatibility imports maybe. I guess they can just be replaced by

from base64 import encodebytes, decodebytes

edit:
Just tried that, but looks like there is a little bit more work to do...

@almarklein almarklein changed the title Import Error cannot import name 'flx' from 'flexx' Support for Python 3.9 Nov 2, 2020
@almarklein
Copy link
Member

I renamed the title to reflect the bigger picture.

@diego-rapoport
Copy link

Looks like python 2.7 compatibility imports maybe. I guess they can just be replaced by

from base64 import encodebytes, decodebytes

edit:
Just tried that, but looks like there is a little bit more work to do...

I did:

from base64 import encodebytes

and it worked with python 3.9.2 and flexx 0.8.1

@almarklein
Copy link
Member

Thanks! Yeah replacing these imports might be enough. We should also update CI to make sure the tests pass for py39 too.

@mschroen
Copy link

mschroen commented Jun 4, 2021

I just installed flexx and the simplest example does not run because of this dusty bug. Can you please fix it in the next release? I'd like to use flexx for code that should run for many different users. We cannot expect everyone to change that line of code in the flexx package themselves ;-)

@almarklein
Copy link
Member

It has been fixed in master. But I have not created a new release yet. In part because I'd like to be sure that everything works on py3.9 (in CI). Ideally we'd also move CI from Travis to GH Actions ...

Anyway, you can pip install -U https://github.com/flexxui/flexx/archive/master.zip to get the latest version

@tticknor
Copy link

tticknor commented May 4, 2022

Not a proficient user of Flexx, but following some recent updates it seems to not work properly for me on Windows10 with conda-managed python 3.9(.10 or .12).

Similar results on several similarly-configured machines. Running the basic demo.py from flexxamples, it renders the "Starting Flexx App" title, but nothing else. First error reported in the browser console is:

Uncaught SyntaxError: missing ) after argument list flexx-core.js:1658

which appears to be a malformed call to the JS function $Loop._process_actions

In order to isolate, I started a fresh Windows Sandbox Win10 VM, installed a fresh mini-conda environment (Python 3.9.10) and created several child environments for various versions of Flexx.

  • v0.8.4 and v0.8.3 fail as described herein;
  • v0.8.2 works as expected;
  • v0.8.1 works with the patching described earlier for this issue.

I have not had time to investigate in further detail, for my limited purposes sticking with 0.8.2 is probably fine.

Thank you for the work you have been putting into this.

@almarklein
Copy link
Member

@tticknor Could you try updating pscript? The latest version is 0.7.7

@almarklein
Copy link
Member

This looks like #711, where the new pscript caused an error in Flexx, which needed a fix. Maybe a similar error is triggered with the new Flexx, but an old pscript ...

@tticknor
Copy link

Using pscript 0.7.7 resolves the problem I noted above, all seems to work as expected.

  • Latest pscript version on conda-forge is 0.7.5, hence conda install of Flexx > 0.8.2 does not provide working configuration.
  • installing Flexx via pip (into an otherwise conda installation) offers pscript 0.7.7 and does provide a working configuration.

Thank you for the suggestion and feedback.

@almarklein
Copy link
Member

Ah, that makes sense. I've stopped actively maintaining my conda recipes since binary wheels have become ubiquitous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants