Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScenarioObject name cannot be Empty or None #261

Closed
HLCaptain opened this issue Apr 8, 2024 · 4 comments
Closed

ScenarioObject name cannot be Empty or None #261

HLCaptain opened this issue Apr 8, 2024 · 4 comments

Comments

@HLCaptain
Copy link

When trying to get objects from a Scenario, I always get the exception: beamngpy.logging.BNGValueError: Name cannot be empty or None!. On the map I loaded (east_coast_usa), some static objects does not have a name and validate_object_name throws an error while creating the ScenarioObject in python. I suspect, as the built-in world editor allows objects to have an Empty or None name, the python API should as well.

@aivora-beamng
Copy link
Contributor

Hi,
can you please post the code that causes the error? The validate_object_name function is only called if the name is not None, so I'm not sure what's happening here.

@HLCaptain
Copy link
Author

HLCaptain commented Apr 12, 2024

Hi, problematic source code available here. You can start testing by running this file, then you should see some logs like this, after the level is loaded:

2024-04-12 21:06:46,987 |INFO     |beamngpy.BeamNGpy             |Successfully connected to BeamNG.tech.
2024-04-12 21:06:46,987 |INFO     |beamngpy.BeamNGpy             |Successfully connected to vehicle vehicle_38762.
2024-04-12 21:06:47,044 |INFO     |beamngpy.Camera               |Opened Camera: "vehicle_38762_camera"
Monitoring data for iteration 0
Snapping camera
Loading static instances from scenario...
Could not load static instances from scenario: Name cannot be empty or None!

Keep in mind, that I use BNG_HOME environment variable to find the current BeamNG.tech program. Error occurs with BeamNGpy v1.28 and BeamNG.tech v0.31.3.0.

I suspect, that the name is not None, but empty and that raises the BNGValueError.

@aivora-beamng
Copy link
Contributor

Hi, you're right and we will fix the bug in the next release of BeamNGpy. In the meantime, you can apply the patch to your copy of BeamNGpy by editing the beamngpy/scenario/scenario_object.py file as follows:

image

Thanks for the provided source code.

@aivora-beamng
Copy link
Contributor

Fixed in BeamNGpy v1.29, thank you for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants