Skip to content

Design API Failing Due to PNG Path Resolution (Beam to Beam cover_plate_welded) #34

@Navnit-07

Description

@Navnit-07

Problem

POST /beam-beam-cover-plate-welded/design/ was returning:

expected str, bytes or os.PathLike object, not NoneType

The error was caused by this line in web_pattern():

files("osdag_core.data.ResourceFiles.images").joinpath("Uw.png")

importlib.resources.files() failed to resolve the image path correctly in the Django environment, resulting in an invalid/None path and crashing the API.

Fix

Replaced it with a direct Django filesystem path using settings.BASE_DIR:

image_path = os.path.join(
settings.BASE_DIR,
"osdag_core",
"data",
"ResourceFiles",
"images",
"Uw.png"
)

Result

Design API works correctly and the image loads without errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions