GithubHelp home page GithubHelp logo

Raise specific exceptions? about turicreate HOT 5 CLOSED

apple avatar apple commented on June 23, 2024
Raise specific exceptions?

from turicreate.

Comments (5)

znation avatar znation commented on June 23, 2024 1

@delirious-lettuce Thanks, I see! I suspect this may have worked at some point in Python 2 but perhaps it never did.

I would use RuntimeError to wrap all of these strings. Please feel free to submit a PR with that. Thanks!

from turicreate.

znation avatar znation commented on June 23, 2024

@gustavla Something we should do as part of the fix for #2 ? I haven't tested this but I suspect Python 3 is less happy about using strings as exception values than Python 2.

from turicreate.

delirious-lettuce avatar delirious-lettuce commented on June 23, 2024

@znation ,

I used Python 2 for the first comment but this shows both. This is a TypeError in both versions.

Python 2.7.12 (default, Nov 20 2017, 18:23:56) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> raise "test"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: exceptions must be old-style classes or derived from BaseException, not str


Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> raise "test"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: exceptions must derive from BaseException

from turicreate.

delirious-lettuce avatar delirious-lettuce commented on June 23, 2024

I just wasn't sure what specific exception you guys wanted raised so I didn't send a PR.

from turicreate.

delirious-lettuce avatar delirious-lettuce commented on June 23, 2024

@znation ,

You might be right, 2.7.12 is the lowest Python version I have tested it with but it may have been different earlier (2.6 maybe?).

I am just about to send a tiny PR right now but then I will fix this one ASAP (with RuntimeError).

from turicreate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.