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

no builtin exception IOError available during module loading. #845

Open
djay opened this issue Jul 30, 2015 · 1 comment
Open

no builtin exception IOError available during module loading. #845

djay opened this issue Jul 30, 2015 · 1 comment

Comments

@djay
Copy link

djay commented Jul 30, 2015

Not sure why but if I have code like this

def resource_exists(name):
    """Return true if the given resource exists"""
    try:
        open_resource(name).close()
        return True
    except IOError:
        return False

blah = resource_exists('blah.cfg')

results in generated code like

            if (($pyjs_try_err_name == (typeof IOError == "undefined"?$m['IOError']:IOError)['__name__'])||$p['_isinstance']($pyjs_try_err,(typeof IOError == "undefined"?$m['IOError']:IOError))) {
                return false;

and if its run during a module load I get an exception like
Uncaught TypeError: Cannot read property '__name__' of undefined
because $m['IOError'] is undefined.

@djay
Copy link
Author

djay commented Jul 30, 2015

Ah I think it's because IOError isn't defined at all in pyjs

@djay djay changed the title no builtin exceptions available during module loading. no builtin exception IOError available during module loading. Jul 30, 2015
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