GithubHelp home page GithubHelp logo

Comments (4)

jd-coderepos avatar jd-coderepos commented on August 29, 2024 1

Hello,

Sharing my workaround to this problem here. The problem is related to this StackOverflow question: https://stackoverflow.com/questions/3249822/python-2-6-4-marshal-load-doesnt-accept-open-file-objects-made-with-subprocess

In the file common.py, I changed the 'unmarshal_iter' function as below:

def unmarshal_iter(path):
  tmpfolder = tempfile.mkdtemp()
  try:
      tmpfile = os.path.join(tmpfolder, "temp")
      with open(tmpfile, "wb") as binfile:
          binfile.write(gzip.open(path, 'rb').read())

      with open(tmpfile, "rb") as binfile:
          while True:
              try:
                  yield marshal.load(binfile)
              except EOFError:
                  break
  finally:
      if tmpfolder and os.path.isdir(tmpfolder):
          shutil.rmtree(tmpfolder)

Also, I'm using python version 2.7.3 to run the program.

Best.

from langid.py.

zq2017 avatar zq2017 commented on August 29, 2024

Hello, I met the same problem as you. Have you solved this problem? Can you give me some solutions? Thank you so much!

from langid.py.

zq2017 avatar zq2017 commented on August 29, 2024

@saffsd Dear Marco, can you give me some solutions? Thank you so much!

from langid.py.

antoniogois avatar antoniogois commented on August 29, 2024

@jenlindadsouza thanks for your tip! Don't forget to also add "import shutil" to the beginning of common.py

And one more thing, in case anyone else has an error in "NBtrain.py", line 256: What I did was change line 257
except NameError:
by
except:

I think some exception that was supposed to be ignored has a different name now, so with my change all exceptions are ignored here. I'm not sure about this fix, but it seems to be working. (at first this seemed like a windows path issue [using / instead of \] but I had this problem both on windows and linux)

EDIT: forget about this exception thing, all predictions are going crazy... There's probably a real problem behind the exception being thrown, I can't find it right now

from langid.py.

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.