python-pptx trouble
- Lenguaje dominante
- Julia
- Estrellas
- 1.5k
- Forks
- 186
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Installed python-pptx like this
```
using Conda, PyCall
run(PyCall.python_cmd(`-m pip install python-pptx`))
```
In this example, the second last line fails, since `ERROR: KeyError: key "rgb" not found`.
```julia
using PyCall
pptx = pyimport("pptx")
RGBColor = pptx.dml.color.RGBColor
Inches = pptx.util.Inches
prs = pptx.Presentation()
title_slide_layout = get(prs.slide_layouts, 1)
slide = prs.slides.add_slide(title_slide_layout)
shape = slide.shapes.add_table(4, 3, Inches(1), Inches(1), Inches(3), Inches(2))
shape.table.cell(1,1).fill.solid()
isnothing(shape.table.cell(1,1).fill.fore_color.type) # true
shape.table.cell(1,1).fill.fore_color.rgb = RGBColor(255, 0, 0) # ERROR: KeyError: key "rgb" not found
prs.save("debug_rgb_jl.pptx")
```
For some reason `shape.table.cell(1,1).fill.fore_color.type` is `nothing`. whereas in the Python version it is `1`. Here is Python version of the above
```python
import pptx
from pptx.dml.color import RGBColor
from pptx.util import Inches
prs = pptx.Presentation()
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
shape = slide.shapes.add_table(4, 3, Inches(1), Inches(1), Inches(3), Inches(2))
shape.table.cell(1,1).fill.solid()
shape.table.cell(1,1).fill.fore_color.type == 1 # True
shape.table.cell(1,1).fill.fore_color.rgb = RGBColor(255, 0, 0)
prs.save("debug_rgb_py.pptx")
```
Also, in Julia, typing `shape.` results in `Error: Error in the keymap...`.
Julia v1.2, Conda v1.3.0, PyCall v1.91.2.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comience reproduciendo el ejemplo mediante PyCall.python_cmd, pyimport("pptx") y la asignación de RGBColor con las versiones indicadas de Julia, Conda y PyCall. Compruebe el comportamiento de PyCall con las propiedades de los objetos de Python y la finalización con tabulador de la REPL de Julia. Se considera terminado cuando la asignación del color ya no produce el rgb KeyError y shape. no produce el error de keymap indicado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- julia, python
- Área
- developer-experience, tooling
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100