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

Python 3.4 support? #5

Closed
ianozsvald opened this issue Jul 20, 2015 · 6 comments
Closed

Python 3.4 support? #5

ianozsvald opened this issue Jul 20, 2015 · 6 comments

Comments

@ianozsvald
Copy link

Hello, thanks for the library. This might be the tool that helps me stop showing other data scientists how to write new Flask(+swagger) apps from a template.

I'm a Python 3.4 developer (I'll also note #4), I can't get pyxley running. Firstly - maybe you could mark in the README that only Python 2.7 is supported at present?

I tried running 2to3 --write pyxley/ after a git-clone and it said it succeeded (so all the files might now be Python 3.4 compatible). I then ran python setup.py install which also succeeded. Oddly I had to run pip install pyreact by hand, I'm not sure if there's a problem with the conversion process.

I started to follow the guide here http://multithreaded.stitchfix.com/blog/2015/07/16/pyxley/ but the first imports fail (from pyxley.utils import FilterFrame - no .utils?). I then tried running the included examples but had errors due to the 2to3 conversion and str datatypes e.g.

pyxley/examples/datamaps/project $ python app.py

Traceback (most recent call last):
  File "app.py", line 55, in <module>
    sb = ui.render_layout(app, "./static/layout.js")
  File "/home/ian/anaconda/envs/scratch/lib/python3.4/site-packages/pyxley/ui.py", line 90, in render_layout
    static_path=path)
  File "/home/ian/anaconda/envs/scratch/lib/python3.4/site-packages/pyxley/react_template.py", line 64, in __init__
    self.to_js()
  File "/home/ian/anaconda/envs/scratch/lib/python3.4/site-packages/pyxley/react_template.py", line 25, in to_js
    self.write_to_file(js)
  File "/home/ian/anaconda/envs/scratch/lib/python3.4/site-packages/pyxley/react_template.py", line 17, in write_to_file
    f.write(s)
TypeError: 'str' does not support the buffer interface

The above error occurs for datamaps, metricsgraphics, datatables.

I'll try using Python 2.7 at some point.

@ppope
Copy link

ppope commented Jul 23, 2015

+1 to noting in README that only python 2.7 is supported currently

@nmkridler
Copy link
Contributor

I haven't had a chance to look at 3.4 yet, but thanks for looking in to this. In the meantime, I'll definitely add to the readme that only python 2.7 is currently supported.

@nmkridler
Copy link
Contributor

I got it working in python 3.4, there were some string/binary issues in the writing of layout.js. I'll try to push a fix soon.

@nmkridler
Copy link
Contributor

@ianozsvald Should be 3.4 compatible now. Also, I'll edit the blog to remove the FilterFrame bit. It was removed, but I didn't catch it in the blog.

@ianozsvald
Copy link
Author

@nmkridler Hi Nick - just to say "thanks" for fixing this, Python 3.4+ compatibility is much appreciated :-)

@qichaotang
Copy link

Hello,nmkridler,the error occurs
F:\Anaconda\python.exe F:/Anaconda/selenium/pyxley/examples/metricsgraphics/project/test.py
Traceback (most recent call last):
File "F:/Anaconda/selenium/pyxley/examples/metricsgraphics/project/test.py", line 80, in
sb = ui.render_layout(app, "./static/layout.js")
File "F:\Anaconda\lib\site-packages\pyxley\ui.py", line 135, in render_layout
static_path=path)
File "F:\Anaconda\lib\site-packages\pyxley\react_template.py", line 95, in init
self.to_js()
File "F:\Anaconda\lib\site-packages\pyxley\react_template.py", line 34, in to_js
js = self.transformer.transform_string(t.render(**self.args))
File "F:\Anaconda\lib\site-packages\react\jsx.py", line 45, in transform_string
raise TransformError(e.message[7:])
react.jsx.TransformError

Process finished with exit code 1

All examples occurred this problem,I need help.

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

No branches or pull requests

4 participants