You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
如果在WIndows环境中运行flask db相关的指令时遇到了"unable to open database file"的报错,请尝试做上面的修改。导致错误的原因是在Windows环境中路径使用\,在原来的代码中可能构造出非法的URL;而修改后的代码使用as_posix()将其转换成URL-friendly的格式。
Reacted by code4DB, Warmybloodwolf, auditoriumh, qyx-qyx-qyx, Macrocosmos and BlacksheepJane
For me, I tested the CrackSQL on my manjaro linux. Chinese characters exist in my path to the project. as_url() function will REPLACE the Unicode with percenta-code for better compatibility.
e.g: (since there has no senstive info in my path, I give it directly).
/home/illusionary/文档/大三/工科创/Final-Proj/dataset/CrackSQL/backend/instance/info.db
/home/illusionary/%E6%96%87%E6%A1%A3/%E5%A4%A7%E4%B8%89/%E5%B7%A5%E7%A7%91%E5%88%9B/Final-Proj/dataset/CrackSQL/backend/instance/info.db
However, this will cause "unable to open database file" as well. Use as_posix() will solve this problem because this function DO NOT make this replacement.
It's exactly not the only correction for my problem. Actually, If I DO NOT make the replacement of Chinese character, this problem will not exist as well. So this problem appears when you use a path containing Chinese character, which is a crucial point. However, my Manjaro OS supports Unicode, different OS may have different situation.
Activity
[-]Error of flask db in Windows[/-][+]Error of `flask db` in Windows Solution[/+][-]Error of `flask db` in Windows Solution[/-][+]Solution for Error of `flask db` in Windows[/+]TianshuoQi commentedon May 23, 2025
如果在WIndows环境中运行
flask db相关的指令时遇到了"unable to open database file"的报错,请尝试做上面的修改。导致错误的原因是在Windows环境中路径使用\,在原来的代码中可能构造出非法的URL;而修改后的代码使用as_posix()将其转换成URL-friendly的格式。code4DB commentedon May 24, 2025
Thanks for your solution, CrackSQL is tested over Linux by default :)
illusionarydream commentedon Jun 10, 2025
For me, I tested the CrackSQL on my manjaro linux. Chinese characters exist in my path to the project. as_url() function will REPLACE the Unicode with percenta-code for better compatibility.
e.g: (since there has no senstive info in my path, I give it directly).
/home/illusionary/文档/大三/工科创/Final-Proj/dataset/CrackSQL/backend/instance/info.db
/home/illusionary/%E6%96%87%E6%A1%A3/%E5%A4%A7%E4%B8%89/%E5%B7%A5%E7%A7%91%E5%88%9B/Final-Proj/dataset/CrackSQL/backend/instance/info.db
However, this will cause "unable to open database file" as well. Use as_posix() will solve this problem because this function DO NOT make this replacement.
code4DB commentedon Jun 11, 2025
@illusionarydream Hi! Do you mean the
as_posix()function is the correction solution for your problem?illusionarydream commentedon Jun 11, 2025
It's exactly not the only correction for my problem. Actually, If I DO NOT make the replacement of Chinese character, this problem will not exist as well. So this problem appears when you use a path containing Chinese character, which is a crucial point. However, my Manjaro OS supports Unicode, different OS may have different situation.