为什么可以与文件系统一起使用的前和后编译后的脚本的不同功能?
对于此程序,我使用Python 3.10,pycharm和pyqt5
有一个程序将Excel文件带到.CSV:每个表:使用PANDAS将其转换为单独的文件。
该文件可以从任何目录中获取,但是输出文件始终在项目目录中。 在编写之前,程序检查是否存在具有相同名称的文件:
if os.path.isfile(f'{duplicate_name}{cur_sheet_name}.csv'):
# duplicate_name contains path to the directory
因此,如果有重复文件,则该程序将输入文件的名称添加到输出文件的名称中。 (我认为它应该检查输入目录中的文件是否,但由于某种原因,它仍然在项目'目录中写入和检查)
对于从IDE运行的重复项时,但是当我使用自动py-to-exe对其进行编译时,它不会检查重复项,而只是简单地覆盖现有文件。
它是将调用时导入到main.py的函数。
For this program i use Python 3.10, PyCharm, and PyQt5
There is a program that takes an excel file and converts it to .csv: each sheet into the separate file using Pandas.
The file can be taken from any directory, but the output file is always in the directory of the project.
Before the writing, the program checks if a file with the same name aleady exists:
if os.path.isfile(f'{duplicate_name}{cur_sheet_name}.csv'):
# duplicate_name contains path to the directory
So if there is a duplicate file, the program adds name of input file to the name of the output file. (I assume it should check if the file in the input directory, but still it writes and checks in the project' directory for some reason)
The thing is that the program checks for duplicates when I run it from IDE, but when I compile it using auto-py-to-exe — it doesn't checks for duplicates and simply over-writes the existing file.
It is a function that is imported to the main.py when called.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我忘了在写作周期中添加文件的路径,问题关闭了
I forgot to add a file's path to the writing cycle, question closed