GithubHelp home page GithubHelp logo

Comments (6)

glemaitre avatar glemaitre commented on May 22, 2024

mmm that's a good one. Could you open the file setup.py and check if you have some unrecognized characters.

Check also which encoding are you using:

http://stackoverflow.com/questions/21236910/using-exec-function-to-run-script-in-the-interpreter-shell

from imbalanced-learn.

ErnstDinkelmann avatar ErnstDinkelmann commented on May 22, 2024

Interesting.
OK, I forced the encoding as follows, just in the open (as suggested in the link):

with open(os.path.join('imblearn', 'version.py'), encoding='utf-8-sig') as fp:
        exec(fp.read(), globals_dict)

and voila, it works.

Weirdly though, in my PyCharm IDE, in the right-bottom corner, it says "UTF-8", which I'm assuming is the encoding for the context, but it seems the Win current encoding was still somehow overriding that.

I also used a "chchp" command in Win cmd, and it displayed "437", which is apparently a "US encoding"

I don't know a lot, but the above might give you insight to change the code to avoid this bug on other Win systems.

Cheers

from imbalanced-learn.

glemaitre avatar glemaitre commented on May 22, 2024

I got the same bug with Appveyor so I will investigate a bit more.
Thanks for the solution.

from imbalanced-learn.

glemaitre avatar glemaitre commented on May 22, 2024

So actually there is a need for

# *- encoding: utf-8 -*-

in version.py to enforce the encoding. open function do not allow encoding argument in Python 2.
This is a Windows thing probably, I don't know to much about these stuff.

from imbalanced-learn.

ErnstDinkelmann avatar ErnstDinkelmann commented on May 22, 2024

I tested that for you and it made no difference, exact same problem.
But found this:

[http://stackoverflow.com/questions/10971033/backporting-python-3-openencoding-utf-8-to-python-2]

So, the following worked and apparently will do on Python 2 as well:

import codecs
with codecs.open(os.path.join('imblearn', 'version.py'), encoding='utf-8-sig') as fp:
        exec(fp.read(), globals_dict)

from imbalanced-learn.

glemaitre avatar glemaitre commented on May 22, 2024

thanks

from imbalanced-learn.

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.