Skip to content

SyntaxError: source code string cannot contain null bytes after packaging with nicegui-pack #5247

@romaintailhurat

Description

@romaintailhurat

First Check

  • I added a very descriptive title here.
  • This is not a Q&A. I am sure something is wrong with NiceGUI or its documentation.
  • I used the GitHub search to find a similar issue and came up empty.

Description

Hi!

I wrote a very simple app in order to test the packaging of NiceGUI:

from multiprocessing import freeze_support
freeze_support()
from nicegui import ui, native  # noqa

ui.label("TEST")

ui.run(reload=False, port=native.find_open_port())

My project is managed using uv, which I used to install NiceGUI (3.0.3) and the latest version of PyInstaller (6.16.0).

My system is macOS Tahoe 26.0.1.

I packaged the app with: uv run nicegui-pack --onefile --name "psg" main.py.

I'm trying to run the app with: ./dist/psg, the app launches but it display a 500 error page with the message SyntaxError: source code string cannot contain null bytes.

I checked: my source file doesn't contains any hidden null character.

I tested the app with both Safari and Firefox, same issue.

Thanks for considering my troubles.

NiceGUI Version

3.0.3

Python Version

3.13

Browser

Safari

Operating System

macOS

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    analysisStatus: Requires team/community input

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions