简体   繁体   English

为什么每次使用 ursina 引擎时,我的 python 程序都会给我一个 filenotfound WinError 3?

[英]Why is my python program giving me a filenotfound WinError 3 every time I use the ursina engine?

I have installed the Ursina game engine recently and I am getting started with it, but as I write a basic program it gives me a traceback contradicting some built in programs in ursina and ending with a Filenotfound Winerror 3 pointing to a music folder which has nothing to do with python, I double checked if Ursina is installed properly but it was not the case, and I checkedthe folder it is pointing to which as expected contained only music.我最近安装了 Ursina 游戏引擎,我开始使用它,但是当我编写一个基本程序时,它给了我一个与 ursina 中的一些内置程序相矛盾的回溯,并以 Filenotfound Winerror 3 指向一个没有任何内容的音乐文件夹结束与 python 相关,我仔细检查了 Ursina 是否安装正确但不是这样,我检查了它指向的文件夹,正如预期的那样,它只包含音乐。 Is there a problem with the path of the engine?引擎的路径有问题吗? I hope you can answer me.我希望你能回答我。 Anyway here is the code:无论如何这里是代码:

from ursina import *           # this will import everything we need from ursina with just one line.

app = Ursina()

player = Entity(
    model = 'cube' ,           # finds a 3d model by name
    color = color.orange,
    scale_y = 2
    )

def update():                  # update gets automatically called by the engine.
    player.x += held_keys['d'] * .1
    player.x -= held_keys['a'] * .1


app.run()

The error message:错误信息:

package_folder: C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina asset_folder: c:\Users\user\Desktop screen resolution: (1920, 1080) Traceback (most recent call last): File "c:\Users\user\Desktop\geme.py", line 1, in from ursina import * # this will import everything we need from ursina with just one line. package_folder: C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursinaasset_folder: c:\Users\user\Desktop 屏幕分辨率: (1920,108 回溯最近) ): File "c:\Users\user\Desktop\geme.py", line 1, in from ursina import * # 这将只用一行从 ursina 导入我们需要的一切。 File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina_ init _.py", line 28, in文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina_init _.py ”,第 28 行,在
from ursina.raycaster import raycast, boxcast File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\raycaster.py", line 14, in从 ursina.raycaster 导入 raycast,boxcast 文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\raycaster.py”,第 14 行,在
class Raycaster(Entity): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\raycaster.py", line 16, in Raycaster class Raycaster(实体):文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\raycaster.py”,第 16 行,在 Raycaster
_boxcast_box = Entity(model='cube', origin_z=-.5, collider='box', color=color.white33, enabled=False, eternal=True) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\entity.py", line 105, in init _boxcast_box = Entity(model='cube', origin_z=-.5, collider='box', color=color.white33, enabled=False, forever=True) 文件“C:\Users\user\AppData\Local\Programs \Python\Python39\lib\site-packages\ursina\entity.py",第 105 行,在init
setattr(self, key, kwargs[key]) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\entity.py", line 201, in setattr setattr(self, key, kwargs[key]) 文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\entity.py”,第 201 行,在setattr
m = load_model(value, application.asset_folder) File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\mesh_importer.py", line 38, in load_model for filename in path.glob(f'**/{name}{filetype}'): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 1166, in glob for p in selector.select_from(self): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 599, in _select_from for starting_point in self._iterate_directories(parent_path, is_dir, scandir): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 589, in _iterate_directories for p in self._iterate_directories(path, is_dir, scandir): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 589, in _iterate_directories for p in self._iterate_directories(path, is_dir, scandir): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 589, in _iterate_directories for p in self. m = load_model(value, application.asset_folder) 文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\ursina\mesh_importer.py”,第 38 行,在 load_model 中用于文件名path.glob(f'**/{name}{filetype}'):文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py”,第 1166 行,在 glob 中p in selector.select_from(self): File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 599, in _select_from for starting_point in self._iterate_directories(parent_path, is_dir , scandir): 文件 "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py",第 589 行,在 _iterate_directories for p in self._iterate_directories(path, is_dir, scandir): 文件“C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py”,第 589 行,在 _iterate_directories for p in self._iterate_directories(path, is_dir, scandir):文件“C:\Users \user\AppData\Local\Programs\Python\Python39\lib\pathlib.py",第 589 行,在 _iterate_directories for p in self. _iterate_directories(path, is_dir, scandir): [Previous line repeated 12 more times] File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py", line 578, in _iterate_directories with scandir(parent_path) as scandir_it: FileNotFoundError: [WinError 3] The system cannot find the path specified: 'c:\Users\user\Desktop\Education\Music\Plugins & wav\unison midi pack\Chord-Templates-s8nrci\Chord Templates\Blues Chord Templates Pack\Major\Ab_Major\Substitute Chords\Borrowed Chords\Dominant\Dominant7 b5 Chords\Dominant7 b5 Chord Inversions\A#7 b5 Inversions' _iterate_directories(path, is_dir, scandir): [上一行重复了 12 次以上] 文件 "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\pathlib.py",第 578 行,在 _iterate_directories 和 scandir (parent_path) as scandir_it: FileNotFoundError: [WinError 3] 系统找不到指定的路径:'c:\Users\user\Desktop\Education\Music\Plugins & wav\unison midi pack\Chord-Templates-s8nrci\Chord Templates \Blues Chord Templates Pack\Major\Ab_Major\Substitute Chords\Borrowed Chords\Dominant\Dominant7 b5 Chords\Dominant7 b5 Chord Inversions\A#7 b5 Inversions'

Since you put your script directly on the Desktop, you made that your project folder.由于您将脚本直接放在桌面上,因此您将其设为项目文件夹。 So when you try to load a model, ursina will search all your files and folders on the desktop for a file matching that name.因此,当您尝试加载 model 时,ursina 将搜索桌面上的所有文件和文件夹以查找与该名称匹配的文件。

Move your scripts and relevant assets into a separate folder.将您的脚本和相关资产移动到单独的文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的Python脚本每次运行都会给我一个错误? - Why is my Python script giving me an error every time it runs? 为什么Eclipse每次尝试运行我的Python程序时都会要求'ant build'? - Why does Eclipse ask me to 'ant build' every time I try to run my Python program? 为什么我的简单 python 程序给我错误 - Why is my simple python program giving me errors 为什么当我运行这个程序时 python 给我一个 UnboundLocalError ? - Why is python giving me an UnboundLocalError when I run this program? 用于 Python 的 Ursina 游戏引擎在我添加一定数量的实体后不允许我全屏游戏 - Ursina Game Engine for Python won't let me fullscreen the game after I add a certain number of entities 为什么该Python程序给我一个错误? - Why is this Python program giving me an error? 我的 Python 套接字程序有问题 [WinError 10057] - I'm having a problem with my Python socket program [WinError 10057] 为什么Python中的if语句给我一个错误? - Why is my if statement in Python giving me an error? 为什么我的python程序给出了if / else语句中的变量未定义的错误? - Why is my python program giving me the error that a variable in an if/else statement is undefined? 为什么我的独立程序退出而不给我机会阅读结果(python)? - Why does my standalone program exits without giving me a chance to read the results (python)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM