open-contracting / ocdskit

A suite of command-line tools for working with OCDS data
https://ocdskit.readthedocs.io
BSD 3-Clause "New" or "Revised" License
17 stars 6 forks source link

compile: Crash on Windows #146

Closed duncandewhurst closed 3 years ago

duncandewhurst commented 3 years ago

Noted whilst testing the OCDS Kit Learning Lab on Windows 10.

The compile command crashes with the following Traceback:

Traceback (most recent call last):
  File "C:\Users\Duncan\AppData\Local\Programs\Python\Python38-32\Scripts\ocdskit-script.py", line 11, in <module>
    load_entry_point('ocdskit==0.2.9', 'console_scripts', 'ocdskit')()
  File "c:\users\duncan\appdata\local\programs\python\python38-32\lib\site-packages\ocdskit\cli\__main__.py", line 61, in main
    command.handle()
  File "c:\users\duncan\appdata\local\programs\python\python38-32\lib\site-packages\ocdskit\cli\commands\compile.py", line 40, in handle
    for output in merge(self.items(), streaming=True, **kwargs):
  File "c:\users\duncan\appdata\local\programs\python\python38-32\lib\site-packages\ocdskit\combine.py", line 156, in merge
    with Packager() as packager:
  File "c:\users\duncan\appdata\local\programs\python\python38-32\lib\site-packages\ocdskit\packager.py", line 36, in __enter__
    self.backend = SQLiteBackend()
  File "c:\users\duncan\appdata\local\programs\python\python38-32\lib\site-packages\ocdskit\packager.py", line 224, in __init__
    self.connection = sqlite3.connect(self.file.name, detect_types=sqlite3.PARSE_DECLTYPES)
sqlite3.OperationalError: unable to open database file

Edit: For reference I used the following command: type HC1_datos_2020.json | ocdskit compile > honduras_compiled_releases.json with this data.

jpmckinney commented 3 years ago

OCDS Kit gets a temporary file using tempfile.NamedTemporaryFile. However, it seems to be a limitation of Windows that this file cannot be opened a second time by SQLite. So, we'll need a different cross-platform solution.

jpmckinney commented 3 years ago

Try installing from GitHub pip install -e git+https://github.com/open-contracting/ocdskit.git#egg=ocdskit

You might need to start with a fresh environment.

duncandewhurst commented 3 years ago

Thanks for the fix - it's working now!