I'm making a weather simulator with Python's Ursina engine, but I cannot load models.
The error stack:
C:\Users\x\Desktop\WeatherSim>WeatherSim.py ... Loading assets: Assets/Models/Plane.obj Traceback (most recent call last): File "C:\Users\x\Desktop\WeatherSim\WeatherSim.py", line 207, in <module> Assets.LoadM("Empty","Assets/Models/Plane.obj") File "C:\Users\x\Desktop\WeatherSim\WeatherSim.py", line 163, in LoadM setattr(self,n,load_model(obj_to_ursinamesh(obj))) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\x\AppData\Local\Programs\Python\Python311\Lib\site-packages\ursina\mesh_importer.py", line 224, in obj_to_ursinamesh for f in path.glob(f'**/{name}.obj'): ^^^^^^^^^ AttributeError: 'str' object has no attribute 'glob' C:\Users\x\Desktop\WeatherSim> Some code (imports, the Assets.LoadM() function and the function call):
from contextlib import contextmanager ... @contextmanager def no_stdout(): with open(os.devnull, "w") as devnull: old_stdout = sys.stdout sys.stdout = devnull try: yield finally: sys.stdout = old_stdout ... with no_stdout(): from ursina import * from ursina.mesh_importer import * app = Ursina() ... class _assets: ... # load a model and assigns it to the new attribute with name n to _assets def LoadM(self,n,obj): setattr(self,n,load_model(obj_to_ursinamesh(obj))) Assets = _assets() ... # the \r and end="" is so that it prints every "Load assets: ..." line in one line print("\rLoading assets: Assets/Models/Plane.obj",end="") Assets.LoadM("MeshPlane","Assets/Models/Plane.obj") Also, I don't want to use Ursina's built-in plane mesh since mine has special UV coordinates, sizes, etc.
What is the cause of this error?