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

运行exe时,参数的路径中的\被当做转义符 #72

Closed
Hellcat1005 opened this issue Jul 2, 2022 · 2 comments
Closed

运行exe时,参数的路径中的\被当做转义符 #72

Hellcat1005 opened this issue Jul 2, 2022 · 2 comments
Assignees
Labels
Report 已加入ToDo 不错的Feature

Comments

@Hellcat1005
Copy link

Hellcat1005 commented Jul 2, 2022

QPT版本

1.0b4.dev1

操作系统版本

Windows 10

CPU型号

Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz

核心信息填写

我希望实现的功能是:将某个待处理文件拖拽至exe上进行处理。当文件被拖拽到exe上时,可通过sys.argv[1]获取待处理文件路径,将该路径输入到我的业务代码中。

当我在python环境中执行:python main.py path\to\my\file时,此时的sys.argv[1]为path\\to\\my\\file,代码执行正常。

当我在cmd中执行:Debug.exe path\to\my\file时,提示转义符的问题:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 4-5: truncated \UXXXXXXXX escape

将路径改为/或者\\之后,可以正常执行,但是这样无法实现前面说的将文件拖拽到exe上执行的方案。

@GT-ZhangAcer
Copy link
Member

之前测试的时候没考虑过拖动的这个情况,加入ToDo后续修复

@GT-ZhangAcer
Copy link
Member

最新版本1.0b7已经适配,预计11.28日前同步各大pip镜像源,感谢支持。

@GT-ZhangAcer GT-ZhangAcer moved this from Todo to Done in QPT核心框架建设 Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Report 已加入ToDo 不错的Feature
Projects
Status: Done
Development

No branches or pull requests

2 participants