ocean-data-factory-sweden / kso

Notebooks to upload/download marine footage, connect to a citizen science project, train machine learning models and publish marine biological observations.
GNU General Public License v3.0
4 stars 12 forks source link

Tutorial 4 Issue Initiating project database #246

Closed Bergylta closed 10 months ago

Bergylta commented 10 months ago

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

Project: GU Input:

# Find project
project = p_utils.find_project(project_name=project_name.value)
# Initialise pp
pp = ProjectProcessor(project)

Output:

PermissionError                           Traceback (most recent call last)
Cell In[5], line 4
      2 project = p_utils.find_project(project_name=project_name.value)
      3 # Initialise pp
----> 4 pp = ProjectProcessor(project)

File /usr/src/app/kso/kso_utils/kso_utils/project.py:68, in ProjectProcessor.__init__(self, project)
     65 self.map_init_csv()
     67 # Create empty db and populate with local csv files data
---> 68 self.setup_db()
     70 # Mount Snic server if needed
     71 if self.project.server == "SNIC":

File /usr/src/app/kso/kso_utils/kso_utils/project.py:161, in ProjectProcessor.setup_db(self)
    155 """
    156 The function creates a database and populates it with the data from the local csv files.
    157 It also return the db connection
    158 :return: The database connection object.
    159 """
    160 # Create a new database for the project
--> 161 db_utils.create_db(self.project.db_path)
    163 # Connect to the database and add the db connection to project
    164 self.db_connection = db_utils.create_connection(self.project.db_path)

File /usr/src/app/kso/kso_utils/kso_utils/db_utils.py:283, in create_db(db_path)
    281 # Delete previous database versions if exists
    282 if os.path.exists(db_path):
--> 283     os.remove(db_path)
    285 # Get sql command for db setup
    286 sql_setup = schema.sql

PermissionError: [Errno 1] Operation not permitted: '/tmp/gu.db'

Expected behavior

Should initiate the database of the project.

Environment

Additional context

Add any other context about the problem here.

jannesgg commented 10 months ago

@Bergylta This issue should be fixed by a3f5348596ab7b2c19db9ec614653117e28dd5ff