pyinstaller onedir workaround for requests issue,

moved spec file to build folder


Former-commit-id: 4427eba5c993222cd2ebfdfc76a4685e25e18b0c
This commit is contained in:
Arthur Lu 2022-02-24 02:56:08 +00:00
parent 9a1a45f1c9
commit 4836f48a34
6 changed files with 58 additions and 50 deletions

3
.gitignore vendored
View File

@ -15,5 +15,4 @@
**/*.log **/*.log
**/errorlog.txt **/errorlog.txt
/dist/superscript.* /dist/*
/dist/superscript

View File

@ -1,4 +1,4 @@
pathtospec="../src/superscript.spec" pathtospec="superscript.spec"
pathtodist="../dist/" pathtodist="../dist/"
pathtowork="temp/" pathtowork="temp/"

50
build/superscript.spec Normal file
View File

@ -0,0 +1,50 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['../src/superscript.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=['dnspython', 'sklearn.utils._weight_vector', 'sklearn.utils._typedefs', 'sklearn.neighbors._partition_nodes', 'requests'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=['matplotlib'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher
)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='superscript',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='superscript'
)

View File

@ -4,7 +4,7 @@ import pandas as pd
def pull_new_tba_matches(apikey, competition, cutoff): def pull_new_tba_matches(apikey, competition, cutoff):
api_key= apikey api_key= apikey
x=requests.get("https://www.thebluealliance.com/api/v3/event/"+competition+"/matches/simple", headers={"X-TBA-Auth-Key":api_key}, verify=False) x=requests.get("https://www.thebluealliance.com/api/v3/event/"+competition+"/matches/simple", headers={"X-TBA-Auth-Key":api_key})
out = [] out = []
for i in x.json(): for i in x.json():
if i["actual_time"] != None and i["actual_time"]-cutoff >= 0 and i["comp_level"] == "qm": if i["actual_time"] != None and i["actual_time"]-cutoff >= 0 and i["comp_level"] == "qm":
@ -51,7 +51,7 @@ def get_metrics_data_formatted(client, competition):
return out return out
def get_pit_data_formatted(client, competition): def get_pit_data_formatted(client, competition):
x=requests.get("https://titanscouting.epochml.org/api/fetchAllTeamNicknamesAtCompetition?competition="+competition, verify=False) x=requests.get("https://titanscouting.epochml.org/api/fetchAllTeamNicknamesAtCompetition?competition="+competition)
x = x.json() x = x.json()
x = x['data'] x = x['data']
x = x.keys() x = x.keys()

View File

@ -13,7 +13,7 @@ def get_team_competition():
"CLIENT_ID": trakey['CLIENT_ID'], "CLIENT_ID": trakey['CLIENT_ID'],
"CLIENT_SECRET": trakey['CLIENT_SECRET'] "CLIENT_SECRET": trakey['CLIENT_SECRET']
} }
response = requests.request("GET", url + endpoint, verify=False, params=params) response = requests.request("GET", url + endpoint, params=params)
json = response.json() json = response.json()
if json['success']: if json['success']:
return json['competition'] return json['competition']
@ -26,7 +26,7 @@ def get_team():
"CLIENT_ID": trakey['CLIENT_ID'], "CLIENT_ID": trakey['CLIENT_ID'],
"CLIENT_SECRET": trakey['CLIENT_SECRET'] "CLIENT_SECRET": trakey['CLIENT_SECRET']
} }
response = requests.request("GET", url + endpoint, verify=False, params=params) response = requests.request("GET", url + endpoint, params=params)
json = response.json() json = response.json()
if json['success']: if json['success']:
return json['team'] return json['team']
@ -41,7 +41,7 @@ def get_team_match_data(competition, team_num):
"CLIENT_ID": trakey['CLIENT_ID'], "CLIENT_ID": trakey['CLIENT_ID'],
"CLIENT_SECRET": trakey['CLIENT_SECRET'] "CLIENT_SECRET": trakey['CLIENT_SECRET']
} }
response = requests.request("GET", url + endpoint, verify=False, params=params) response = requests.request("GET", url + endpoint, params=params)
json = response.json() json = response.json()
if json['success']: if json['success']:
return json['data'][team_num] return json['data'][team_num]
@ -55,7 +55,7 @@ def get_teams_at_competition(competition):
"CLIENT_ID": trakey['CLIENT_ID'], "CLIENT_ID": trakey['CLIENT_ID'],
"CLIENT_SECRET": trakey['CLIENT_SECRET'] "CLIENT_SECRET": trakey['CLIENT_SECRET']
} }
response = requests.request("GET", url + endpoint, verify=False, params=params) response = requests.request("GET", url + endpoint, params=params)
json = response.json() json = response.json()
if json['success']: if json['success']:
return list(json['data'].keys()) return list(json['data'].keys())

View File

@ -1,41 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['superscript.py'],
pathex=['/workspaces/tra-data-analysis/src'],
binaries=[],
datas=[],
hiddenimports=[
"dnspython",
"sklearn.utils._weight_vector",
"sklearn.utils._typedefs",
"sklearn.neighbors._partition_nodes",
"requests",
],
hookspath=[],
runtime_hooks=[],
excludes=[
"matplotlib",
#"pandas"
],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[('W ignore', None, 'OPTION')],
name='superscript',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )