Skip to content

Choco on windows, Python38, example does not work #831

@Jonas231

Description

@Jonas231

Hello,
I have this problem (the code had worked before, but now it does not work anymore):

Problem Description

When I execute the below python code example from your documentation page. I get this error message:

File "C:\Users\herbst\raypier_optics\test_chaco.py", line 10, in <module>
    from chaco.api import Plot, ArrayPlotData

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\api.py", line 343, in <module>
    from chaco.overlays.api import (

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\overlays\api.py", line 63, in <module>
    from chaco.overlays.layers.api import (

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\overlays\layers\api.py", line 11, in <module>
    from .status_layer import ErrorLayer, StatusLayer, WarningLayer

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\chaco\overlays\layers\status_layer.py", line 17, in <module>
    from enable.savage.svg.document import SVGDocument

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\document.py", line 27, in <module>
    from . import css

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\css\__init__.py", line 10, in <module>
    from .transform import transformList

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\css\transform.py", line 18, in <module>
    from enable.savage.svg.pathdata import number, maybeComma

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\pathdata.py", line 117, in <module>
    lineTo = Group(Command("L") + Arguments(coordinatePairSequence))

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\pathdata.py", line 29, in Command
    return CaselessPreservingLiteral(char)

  File "C:\Users\herbst\Anaconda3\envs\myRaypier38\lib\site-packages\enable\savage\svg\pathdata.py", line 43, in __init__
    self.name = "'%s'" % matchString

AttributeError: can't set attribute

Reproduction Steps:
I used "pip install chaco" and "pip install --upgrade chaco" to install chaco.

from numpy import linspace, sin
from traits.api import HasTraits, Instance
from traitsui.api import View, Item
from chaco.api import Plot, ArrayPlotData
from enable.api import ComponentEditor

class LinePlot(HasTraits):
    plot = Instance(Plot)

    traits_view = View(
        Item('plot', editor=ComponentEditor(), show_label=False),
        width=500,
        height=500,
        resizable=True,
        title="Chaco Plot",
    )

    def _plot_default(self):
        x = linspace(-14, 14, 100)
        y = sin(x) * x**3
        plotdata = ArrayPlotData(x=x, y=y)

        plot = Plot(plotdata)
        plot.plot(("x", "y"), type="line", color="blue")
        plot.title = "sin(x) * x^3"
        return plot

if __name__ == "__main__":
    LinePlot().configure_traits()

Expected behavior:

I had hoped the example would work

OS, Python version: [Enter OS name and Python version]
Python 3.8.12 , Windows 10

Best regards,
Jonas

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions