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

Convert JSON to CSV: Missing module source and missing undefined variable #59

Open
sam-genoese opened this issue Apr 8, 2022 · 0 comments

Comments

@sam-genoese
Copy link

sam-genoese commented Apr 8, 2022

I get the following errors when trying to convert the JSON files to CSV. I am new to programming so I'd appreciate assistance resolving the issue.

Line 10: import simplejson as json
Import "simplejson" could not be resolved from source Pylance(reportMissingModuleSource) [Ln 10, Col 8]

Line 96: if isinstance(line_value, unicode):
"unicode" is not defined Pylance(reportUndefinedVariable) [Ln 96, Col 35]

def get_row(line_contents, column_names):
    """Return a csv compatible row given column names and a dict."""
    row = []
    for column_name in column_names:
        line_value = get_nested_value(
                        line_contents,
                        column_name,
                        )
        if isinstance(line_value, unicode):
            row.append('{0}'.format(line_value.encode('utf-8')))
        elif line_value is not None:
            row.append('{0}'.format(line_value))
        else:
            row.append('')
    return row
@sam-genoese sam-genoese changed the title Convert JSON to CSV: Missing module source and missing underfined variable Convert JSON to CSV: Missing module source and missing undefined variable Apr 8, 2022
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