posit-dev / posit-dev/shinylive

`Example Page`: Pyllusion example app is unable to render due to `Typeerror`

Open
#38 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
251
Forks
25
Avg merge
19m
Merged PRs (30d)
2

Description

If you navigate to the PyIllusion Example app, once the app is rendered you will observe a 'float' object cannot be interpreted as an integer
Shiny_examples

The server logs show this error

  File "/lib/python3.10/site-packages/pyllusion/Delboeuf/delboeuf_image.py", line 21, in _delboeuf_image
    image = PIL.Image.new("RGB", (width, height), color=background)
  File "/lib/python3.10/site-packages/PIL/Image.py", line 2785, in new
    return im._new(core.fill(mode, size, color))
TypeError: 'float' object cannot be interpreted as an integer

This error is caused because img.to_image (Line 129) does not convert the float object to Integer before returning.

This can be fixed by adding an explicit type conversion as shown below:

return img.to_image(width=int(width), height=int(height))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the img.to_image call on line 129 described in the issue and reproduce the PyIllusion example app at the linked PyShiny example page. Verify that the returned image dimensions are integers and that the app renders without the logged TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
web-dev
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.