Skip to content

Commit ce0188b

Browse files
author
Greg Lindahl
committed
duckdb is py3.8 min, work around windows quirk
1 parent ad4c028 commit ce0188b

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
os: [ubuntu-latest]
2020
EXTRA: [false] # used to force includes to get included
2121
include:
22-
- python-version: '3.7'
22+
- python-version: '3.8'
23+
# see https://github.com/duckdb/duckdb/blob/main/.github/workflows/Python.yml for duckdb python versions
2324
os: ubuntu-22.04 # oldest version on github actions
2425
EXTRA: true
2526
- python-version: '3.11'
@@ -28,7 +29,7 @@ jobs:
2829
- python-version: '3.13'
2930
os: macos-latest
3031
EXTRA: true
31-
- python-version: '3.8' # duckdb didn't compile for 3.7 and doze 2022 10.0.20348
32+
- python-version: '3.8'
3233
os: windows-latest
3334
EXTRA: true
3435
- python-version: '3.13'

duck.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import glob
33
import json
44
import os.path
5-
import subprocess
65
import sys
76
import gzip
87
import platform
8+
import io
99

1010
import duckdb
1111

@@ -84,6 +84,9 @@ def get_files(algo, crawl):
8484

8585
def main(algo, crawl):
8686
windows = True if platform.system() == 'Windows' else False
87+
if windows:
88+
# windows stdout is often cp1252
89+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
8790
files = get_files(algo, crawl)
8891
retries_left = 100
8992

@@ -110,8 +113,7 @@ def main(algo, crawl):
110113
retries_left = 100
111114
while True:
112115
try:
113-
# if you print this in windows, it fails: UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-15: character maps to <undefined>
114-
res = duckdb.sql('SELECT COUNT(*) FROM ccindex;')
116+
print(duckdb.sql('SELECT COUNT(*) FROM ccindex;'))
115117
break
116118
except duckdb.InvalidInputException as e:
117119
# duckdb.duckdb.InvalidInputException: Invalid Input Error: No magic bytes found at end of file 'https://...'
@@ -122,7 +124,6 @@ def main(algo, crawl):
122124
retries_left -= 1
123125
else:
124126
raise
125-
print(res) # windows workaround
126127

127128
sq2 = f'''
128129
select

0 commit comments

Comments
 (0)