Giter Site home page Giter Site logo

lol_extract_voice's Introduction

My GitHub Status

Virace's GitHub stats

Projects

Readme Card Readme Card Readme Card Readme Card Readme Card

Languages

Top Langs

lol_extract_voice's People

Contributors

dependabot[bot] avatar virace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lol_extract_voice's Issues

bug,index.py的278行使用的open("w+")创建的文件的上层目录不存在导致运行必报错,附解决办法

lol_extract_voice/index.py

Lines 264 to 280 in 613457e

def check_game_version(game_path):
"""
检查游戏版本文件, 用来判断是否更新资源
:param game_path:
:return:
"""
old_version = ''
if os.path.exists(LOCAL_VERSION_FILE):
with open(LOCAL_VERSION_FILE, encoding='utf-8') as f:
old_version = f.read()
new_version = get_game_version_by_local(game_path)
if old_version == new_version:
return False
else:
with open(LOCAL_VERSION_FILE, 'w+', encoding='utf-8') as f:
f.write(new_version)
return True

一.运行环境:
os版本: win10 latest
python版本: Python 3.9.5
英雄联盟服务器及版本: CN, latest
python库版本:latest

二.debug过程(只想解决问题的可以不看):
1.按照README.md一步步弄好,最后python test.py时,会报错:

D:\lol_extract_voice>python test.py
Traceback (most recent call last):
  File "D:\lol_extract_voice\test.py", line 3, in <module>
    main(r'C:\英雄联盟',
  File "D:\lol_extract_voice\Utils\wrapper.py", line 24, in wrapper
    ret = func(*args)
  File "D:\lol_extract_voice\index.py", line 202, in main
    update = check_game_version(game_path)
  File "D:\lol_extract_voice\index.py", line 278, in check_game_version
    with open(LOCAL_VERSION_FILE, 'w+', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\lol_extract_voice\\Temp\\game_version'

2.查看index.py的278行和上下代码及相关代码,发现LOCAL_VERSION_FILE引用自config.py文件,此文件很简单,查看源代码并打印相关变量可以得知LOCAL_VERSION_FILE的值为lol_extract_voice目录下的Temp文件夹下的game_version文件,查看lol_extract_voice目录发现Temp文件夹并不存在,因此报错代码使用open("w+")创建文件时会报错

三.解决方法:
第一种,最快,不需要改动源代码,但是希望作者可以尽快修复此bug:
在lol_extract_voice目录下创建Temp文件夹,然后正常使用即可

第二种,需要修改源代码:
思路:在创建game_version文件文件之前,判断上层目录Temp文件夹是否存在,不存在则创建
具体方法:
1.在config.py的12行之后添加以下代码:
TEMP_FOLDER = 'Temp'
将原config.py的13行
修改为以下代码:
TEMP_PATH = os.path.join(BASE_PATH, TEMP_FOLDER)
3.在index.py的24行添加导入TEMP_FOLDER和TEMP_PATH:
from config import LOCAL_VERSION_FILE, TEMP_FOLDER, TEMP_PATH
4.在index.py的269行之后添加以下代码

    if not os.path.exists(TEMP_PATH):
        os.makedirs(TEMP_FOLDER)

然后正常使用即可

四.建议:
把Temp文件夹放在其他文件夹里,或者把缓存文件放在其他文件夹里,或者把README.md里要创建的test.py文件改名为其他文件名,不然运行test.py时输入t再按tab会先出来Temp,多少有点麻烦

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.