吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 349|回复: 6
收起左侧

[求助] ddddocr求助,求python大佬指教

[复制链接]
877 发表于 2024-5-30 21:55
35吾爱币
本帖最后由 877 于 2024-5-31 19:30 编辑

欢迎使用ddddocr,本项目专注带动行业内卷,
文件已保存到:
字体文件已成功保存到:font_file.ttf

进程已结束,退出代码为 -1073741819 (0xC0000005)

文件字体都有保存,但是接下来需要替换文字,出现 进程已结束,退出代码为 -1073741819 (0xC0000005)
这是什么原因呢?

最佳答案

查看完整内容

[mw_shl_code=python,true]import os import logging # 配置日志记录 logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') def delete_file(file_path): """ 删除指定路径的文件,如果文件不存在或删除失败,记录相应的日志信息。 :param file_path: 要删除的文件路径 """ if os.path.exists(file_path): try: os.remove(fil ...

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

捷豹网络丶贱仔 发表于 2024-5-30 21:56
[Python] 纯文本查看 复制代码
import os
import logging

# 配置日志记录
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

def delete_file(file_path):
    """
    删除指定路径的文件,如果文件不存在或删除失败,记录相应的日志信息。

    :param file_path: 要删除的文件路径
    """
    if os.path.exists(file_path):
        try:
            os.remove(file_path)
            logging.info(f"文件 {file_path} 已成功删除。")
        except FileNotFoundError:
            logging.error(f"文件 {file_path} 不存在。")
        except PermissionError:
            logging.error(f"没有权限删除文件 {file_path}。")
        except Exception as e:
            logging.error(f"删除文件 {file_path} 时发生未知错误: {e}")
    else:
        logging.warning(f"文件 {file_path} 不存在。")

# 使用示例
font_file_path = 'font_file.ttf'
delete_file(font_file_path)
anning666 发表于 2024-5-31 13:26

  • 源码发出来看看,demo版如下
from ddddocr import DdddOcr

ocr = DdddOcr()
with open('demo.png', 'rb') as f:
    image_bytes = f.read()
result = ocr.classification(image_bytes)
print(result)

'''
欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:xxxx.com
训练数据支持来源于:http://xxxxxx/preview
爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder
谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口:https://xxxxx
uxzr
'''
 楼主| 877 发表于 2024-5-31 14:55
本帖最后由 877 于 2024-6-1 11:42 编辑

大佬好最终没有替换文字,请技术高超的大神帮忙修正~
目的下载的txt内容,替换为正确的~
感谢大佬~
 楼主| 877 发表于 2024-5-31 19:24
anning666 发表于 2024-5-31 13:26
[md]- 源码发出来看看,demo版如下

```

大佬,您看能解决不?运行后出现
进程已结束,退出代码为 -1073741819 (0xC0000005)
anning666 发表于 2024-6-3 08:45
877 发表于 2024-5-31 19:24
大佬,您看能解决不?运行后出现
进程已结束,退出代码为 -1073741819 (0xC0000005)
  • 我目前到了这一步报错了,font_file.ttf这个文件是脚本自动生成的,还是提前准备好的字体文件?
'''
欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com
训练数据支持来源于:http://146.56.204.113:19199/preview
爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder
谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口:https://yescaptcha.com/i/NSwk7i
Traceback (most recent call last):
  File "D:/......
    next_url = get_firstsession(firstsession_url, i)
  File "D:/......
    os.remove(font_file_path)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。: 'font_file.ttf'
文件已保存到:未找到标题.txt
'''
捷豹网络丶贱仔 发表于 2024-6-5 03:49
[Python] 纯文本查看 复制代码
import os

font_file_path = 'font_file.ttf'

# 检查文件是否存在
if os.path.exists(font_file_path):
    try:
        os.remove(font_file_path)
        print(f"文件 {font_file_path} 已成功删除。")
    except Exception as e:
        print(f"删除文件 {font_file_path} 时发生错误: {e}")
else:
    print(f"文件 {font_file_path} 不存在。")
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-6-28 10:55

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表