Dear all,
I run into some troubles when using pyPreservica 2.06 with Python 3.8. Our server is running on Ubuntu 20.04 with default Python 3.8[1]. For my local test, I downloaded Python 3.8 (plus Python 3.10 and Python 3.11) from Microsoft store.
I created the virtual environment and installed dependencies:
```
PS C:\Users\garcm0b\Work\repo2preservica> python3.8.exe -m venv venv308 --prompt r2p_py308
PS C:\Users\garcm0b\Work\repo2preservica> . .\venv308\Scripts\activate
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica>
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica> python --version
Python 3.8.10
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica>
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica>
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica> pip install -U -r requirements.txt
```
But when I run the code, there is an error with `authorityAPI.py`
```
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica> python .\src\ingest.py
Traceback (most recent call last):
File ".\src\ingest.py", line 6, in <module>
import pyPreservica as PRES
File "C:\Users\garcm0b\Work\repo2preservica\venv308\lib\site-packages\pyPreservica\__init__.py", line 20, in <module>
from .authorityAPI import AuthorityAPI, Table
File "C:\Users\garcm0b\Work\repo2preservica\venv308\lib\site-packages\pyPreservica\authorityAPI.py", line 40, in <module>
class AuthorityAPI(AuthenticatedAPI):
File "C:\Users\garcm0b\Work\repo2preservica\venv308\lib\site-packages\pyPreservica\authorityAPI.py", line 147, in AuthorityAPI
def records(self, table: Table) -> list[dict]:
TypeError: 'type' object is not subscriptable
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica>
```
Then there was a second error:
```
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica> python .\src\ingest.py
Traceback (most recent call last):
(...)
File "C:\Users\garcm0b\Work\repo2preservica\venv308\lib\site-packages\pyPreservica\authorityAPI.py", line 205, in AuthorityAPI
def tables(self) -> set[Table]:
TypeError: 'type' object is not subscriptable
(r2p_py308) PS C:\Users\garcm0b\Work\repo2preservica>
```
After some research, it seems that the feature appear in python 3.9[2]. Following the suggestion in the post, I made the following changes to `authorityAPI.py`
```
from typing import List, Set
def records(self, table: Table) -> List[dict]: # Line 149 after importing 'typing'
def tables(self) -> Set[Table]: # Line 205
```
After this the code run successfully in python 3.8, and also 3.11:
```
(r2p) PS C:\Users\garcm0b\Work\repo2preservica> python --version
Python 3.11.5
(r2p) PS C:\Users\garcm0b\Work\repo2preservica>
(r2p) PS C:\Users\garcm0b\Work\repo2preservica> python .\src\ingest.py
INFO:root:do_upload: 'True'
INFO:root:Entity: 'pyPreservica version: 2.0.6 (Preservica 6.9 Compatible)
(...)
```
Best Regards
Marcelo
[1]
a-garcm0b@lthlibtest:~$ lsb_release -rc
Release: 20.04
Codename: focal
a-garcm0b@lthlibtest:~$
a-garcm0b@lthlibtest:~$ dpkg -l python3
(...)
ii python3 3.8.2-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
a-garcm0b@lthlibtest:~$
[2]