python - 如何使用 camelot 模块创建可执行文件?
问题描述
我正在尝试使用 auto-py-to-exe 从我的脚本创建可执行文件。一旦我运行这个 exe 文件,就会出现以下错误:
Traceback(最近一次调用最后一次):ModuleNotFoundError 中的文件“GUI_PDF_scraper.py”,第 5 行:没有名为“camelot”的模块
下面的代码:
from tkinter import *
from tkinter import filedialog
import os
import camelot
import shutil
import pandas as pd
# ======================== functions ==============================================================================
file_name = []
def search_for_file_path():
global file_name
current_dir = os.getcwd()
file = filedialog.askopenfile(parent=window, initialdir=current_dir, title='Please select a directory')
file_name = file.name
file_entry.insert(0, file_name)
def scrapping():
global file_name
dfs = []
# camelot reader / this two lines reads and export pdf pages to separate CSV files
tables = camelot.read_pdf(str(file_name), pages="1-end")
tables.export('data.csv', f='csv', compress=False)
for root, dirs, files in os.walk("./"):
# select file name
for file in files:
# check the extension of files
if file.endswith('.csv'):
# append dataframes to the list of dataframes
dfs.append(pd.read_csv(file))
# creation of concatenated dataframes(panda) / if df is just one concatenation is not needed
if len(dfs) < 2:
dfs[0].to_csv("result_/final_file.csv", index=False)
else:
merged = pd.concat(dfs)
merged.to_csv("result_/final_file.csv", index=False)
# working files move to trash and removal from trash directory
source = os.listdir("./")
destination = "./trash_"
for files in source:
if files.endswith(".csv"):
shutil.move(files, destination)
os.remove(f"trash_/{files}")
解决方案
推荐阅读
- react-native - React Native 0.61 按钮样式的新方法是什么
- datatables - 如何使用 datatable.js 过滤表中的一列?
- django - 在将 Firebase Cloud Messaging 与 Django-Push-Notifications 结合使用时,如何使用 TTL 来防止消息积压?
- python - 在 python 中安装 mod_wsgi 时出错?
- java - 无法从 3.5.0 更新到 Android Studio 3.5.1
- javascript - 在 Chrome 浏览器中具有固定列的 DataTable 显示标题和正文之间的空间
- javascript - jsTree插件:当它包含在每个项目中时按钮无法工作
- c# - 模拟 GetItemLinqQueryable 和扩展方法 ToFeedIterator()
- regex - 通过前缀匹配单词
- ios - Podfile 的安装后挂钩在 CocoaPods 中引发错误