0

I need help with Hiding Warnings from Executable which I have created using Pyinstaller library and below is Command I have used while creating the executable file.

pyinstaller -y -F "D:/Vipul Garg Backup/ABCD/PythonScript/DataTransformationFile.py"

I am using Pyinstaller version 3.6 and Python 3.7.5 and I have tried to make the following changes in .spec file.

1.for d in a.datas:
    if 'pyconfig' in d[0]: 
        a.datas.remove(d)
        break   
2.a.datas = list({tuple(map(str.upper, t)) for t in a.datas})

But nothing worked out it is giving warning still below.

WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "site-packages\pygsheets\sheet.py", line 37, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\VIPUL~1.GAR\\AppData\\Local\\Temp\\_MEI165202\\pygsheets\\data\\sheets_discovery.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\__init__.py", line 36, in autodetect
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 33, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 37, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\__init__.py", line 41, in autodetect
  File "c:\users\vipul.garg\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 41, in <module>
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "site-packages\pygsheets\drive.py", line 49, in __init__
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\VIPUL~1.GAR\\AppData\\Local\\Temp\\_MEI165202\\pygsheets\\data\\drive_discovery.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\__init__.py", line 36, in autodetect
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 33, in <module>
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\googleapiclient\discovery_cache\file_cache.py", line 37, in <module>
ModuleNotFoundError: No module named 'oauth2client'

I am using the following imports in my Script.

import pandas as pd
from pandas import ExcelWriter
from datetime import date
import csv
from xlsxwriter.workbook import Workbook
import glob
import json
import os
import sys
import warnings
import pygsheets
import time
import smtplib
import linecache

I have added below code to my python file in order to ignore warnings and it is not showing me any kind of warnings when I run my python script via Pycharm.

 if not sys.warnoptions:
    warnings.simplefilter("ignore")
Vipul_Garg
  • 43
  • 1
  • 8
  • Sometimes pyinstaller is weird about importing certain modules. – exe Mar 31 '20 at 05:47
  • I think if you have all the modules in a folder with your script it might fix the problem but not 100 percent sure. – exe Mar 31 '20 at 05:48
  • I think script take it and read it from my Local path C:\\Users\\VIPUL~1.GAR\\AppData\\Local\\Temp\\ – Vipul_Garg Mar 31 '20 at 05:53

0 Answers0