Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'file_path' referenced before assignment #2

Open
banderlog opened this issue Mar 18, 2021 · 0 comments

Comments

@banderlog
Copy link

The following code throws an error:

from mimic_fhir_transformation import transform_table


data_path = './data/mimic-iii-clinical-database-1.4/'
output_path = './data/test/'

patient_fhir = transform_table(os.path.join(data_path, 'PATIENTS.csv.gz'),
                               os.path.join(data_path, 'ADMISSIONS.csv.gz'),
                               output_path)

And the source of error:

def transform_table(table_file_path, output_path, auxiliary_table_path=''):
    if Path(table_file_path).suffix == '':
        file_path = Path(table_file_path).stem

    if Path(file_path).name == 'ADMISSIONS.csv':
        df = transform_admissions(table_file_path, output_path)
    ...

If Path(table_file_path).suffix != '', then you have no file_path at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant