Functions-d 1.39__tar.gz → 1.41__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import shutil
7
7
  import time
8
8
  import urllib.request
9
9
  import WeComMsg
10
- import xlwings as xw
10
+ # import xlwings as xw
11
11
  import yagmail
12
12
  import HiveClient
13
13
  from PIL import ImageGrab, Image
@@ -20,7 +20,7 @@ from selenium.webdriver.edge.service import Service
20
20
  from selenium.webdriver.edge.options import Options
21
21
  from webdriver_manager.microsoft import EdgeChromiumDriverManager
22
22
  import psutil
23
- import pythoncom
23
+ # import pythoncom
24
24
  from tenacity import retry, stop_after_attempt, wait_fixed
25
25
  import requests
26
26
  import pandas as pd
@@ -122,7 +122,9 @@ class DataProcessingAndMessaging:
122
122
 
123
123
  # -------------------------- 初始化Edge驱动 --------------------------
124
124
  def init_edge_driver(self, headless=True):
125
- os.environ['WDM_ARCH'] = 'x86' # 强制32位驱动
125
+ import sys
126
+ if sys.platform == "win32":
127
+ os.environ['WDM_ARCH'] = 'x86' # 只有 Windows 才强制32位驱动
126
128
  edge_options = Options()
127
129
  edge_options.add_argument('--disable-gpu')
128
130
  edge_options.add_argument('--no-sandbox')
@@ -676,10 +678,10 @@ class DataProcessingAndMessaging:
676
678
 
677
679
  # -------------------------- 写入Excel数据 --------------------------
678
680
  def writer_excel_data(self, path, filename, send_file, sheet_data, headers):
681
+ import xlwings as xw
679
682
  self.logger.info('开始处理Excel表格')
680
683
  print('开始处理Excel表格')
681
684
  filename = path + filename
682
- send_file = send_file
683
685
  dfs = []
684
686
  sheet_names = []
685
687
  clear_ranges = []
@@ -755,6 +757,8 @@ class DataProcessingAndMessaging:
755
757
 
756
758
  # -------------------------- Excel截图(安全版) --------------------------
757
759
  def screen(self, filename, sheetname, screen_area, img_name):
760
+ import pythoncom
761
+ import xlwings as xw
758
762
  self.logger.info('开始截图')
759
763
  print('开始截图')
760
764
  pythoncom.CoInitialize()
@@ -1933,7 +1937,7 @@ class DataProcessingAndMessaging:
1933
1937
  final_name = short_name
1934
1938
  new_cols.append(final_name)
1935
1939
  df.columns = new_cols
1936
- self.logger.info(f"列名清洗完成,原列名:{old_columns} → 新列名:{list(df.columns)}")
1940
+ self.logger.info(f"列名清洗完成,共{len(df.columns)}个字段")
1937
1941
  print(f"列名清洗完成,共{len(df.columns)}个字段")
1938
1942
 
1939
1943
  # 增加优化参数,大幅提升PowerBI读取性能
@@ -1985,7 +1989,7 @@ class DataProcessingAndMessaging:
1985
1989
  final_name = short_name
1986
1990
  new_cols.append(final_name)
1987
1991
  df.columns = new_cols
1988
- self.logger.info(f"列名清洗完成,原列名:{old_columns} → 新列名:{list(df.columns)}")
1992
+ self.logger.info(f"列名清洗完成,共{len(df.columns)}个字段")
1989
1993
  print(f"列名清洗完成,共{len(df.columns)}个字段")
1990
1994
 
1991
1995
  # 导出csv,utf-8-sig解决中文乱码,不输出索引
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Functions_d
3
- Version: 1.39
3
+ Version: 1.41
4
4
  Summary: 包含数据处理、Hive交互、企业微信消息发送、Excel操作等功能的工具类库
5
5
  Author: DongYang
6
6
  Author-email: 649898871@qq.com
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Functions_d
3
- Version: 1.39
3
+ Version: 1.41
4
4
  Summary: 包含数据处理、Hive交互、企业微信消息发送、Excel操作等功能的工具类库
5
5
  Author: DongYang
6
6
  Author-email: 649898871@qq.com
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = Functions_d
3
- version = 1.39
3
+ version = 1.41
4
4
  author = DongYang
5
5
  author_email = 649898871@qq.com
6
6
  description = 包含数据处理、Hive交互、企业微信消息发送、Excel操作等功能的工具类库
File without changes
File without changes
File without changes