Beginner Question: Specify Input Files in config.yml


Super newbie question - I have a couple of files in the tests project folder - tests/setA/ How do I specify these input files required by my Python script, in the circleci configuration file?

Here’s the configuration file I have at the moment.

# Python CircleCI 2.0 configuration file
# Check for more details
version: 2
      # specify the version you desire here
      # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
      - image: circleci/python:3.6.1
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

      - checkout

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements/requirements.txt

      # run tests!
      - run:
          name: run tests
          command: |
            . venv/bin/activate
            python3 tests/setA/

#      - store_artifacts:
#          path: test-reports
#          destination: test-reports


I would guess this file is available after you’ve checked out, and will be available at tests/setA/ or ~/repo/tests/setA/

I don’t think you’ve said what happens with the config file you have presented?


Hi, Thanks for getting back. The ‘run tests’ phase of the build fails with the below error message:

#!/bin/bash -eo pipefail
. venv/bin/activate
python3 tests/setA/
process: [Errno 2] No such file or directory: 'Table1.csv’
Exited with code 255

Here is the folder structure of my Python project:

|               |__
|               |__
                |           |______Table1.csv
                |           |______Table2.csv
                |           |  #invokes functions in 


OK. So, your Python code or a file that calls needs to find a file called Table1.csv. How is that file referenced? May we see the relevant bit of Python code?

(I appreciate you’re a beginner, but if you can learn from my counter-questions, that would be awesome. If you get an error, always put that in the first post, and if your error comes from a piece of code, then show that code as well. That would’ve saved two replies from me, and two replies from you, meaning you get your answer faster!)


You read my mind - you added the dir structure already. Nice one!


Appreciate your help.

Here’s the code in

import sys
import os


from import *



yay! Got it to work!


Awesome, what was the answer? I was going to suggest ~repo/tests/setA/Table1.csv, as I don’t know how Python works in terms of relative directory references.


I meant, got the formatting to work. SMH


Ah, gotcha. Try my suggestion above, then. You’d need to add that for both CSV file references.


Would you be able to please post the configuration file with the edit you’ve suggested?


No, I am suggesting a change in Swap the reference to Table1.csv for the ref I have suggested, and ditto for Table2.csv.


Perfect, the build passed! Yay! Thanks a lot!

Here’s the code if it helps another beginner sometime:

import sys
import os

# Locate Compare package
# Import the functions.
from import *

main(os.path.join(os.path.dirname(__file__), 'Table1.csv'),
     os.path.join(os.path.dirname(__file__), 'Table2.csv'),
     os.path.join(os.path.dirname(__file__), 'ComparisionReport_SetA'),


Deploy of possible

closed #15