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

Handle is_file error gracefully #51

Merged
merged 1 commit into from
Jan 30, 2019
Merged

Conversation

cabhishek
Copy link
Contributor

@cabhishek cabhishek commented Jan 29, 2019

from genie.jobs import PrestoJob
rj = PrestoJob().script('select * from dual\x00').execute()

For python2 above code throws
TypeError: stat() argument 1 must be encoded string without null bytes, not unicode

and for python3 it throws

ValueError: embedded null byte

The error actually occurs during os.path.isfile check here. This PR handles invalid path and returns False which should then surface the actual error (if any) in the script itself e.g Parsing error for Presto Engine.

Additional context -

@cabhishek cabhishek requested a review from irontablee January 29, 2019 22:50
@cabhishek cabhishek merged commit 8f1b36e into Netflix:master Jan 30, 2019
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

Successfully merging this pull request may close these issues.

2 participants