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

OSError: [Errno 9] Bad file descriptor #380

Open
3fon3fonov opened this issue Jul 28, 2020 · 5 comments · May be fixed by #494
Open

OSError: [Errno 9] Bad file descriptor #380

3fon3fonov opened this issue Jul 28, 2020 · 5 comments · May be fixed by #494
Labels

Comments

@3fon3fonov
Copy link

3fon3fonov commented Jul 28, 2020

I do not understand what is going one with this error! I am trying to load a dill dump made on
a server to my local machine.

to save the dump:

    file_ses = open("target_out.ses", "wb")
    dill.dump(fit, file_ses)
    file_ses.close()

to load back:

    file = open(str(sys.argv[2]), "rb")
    fit = dill.load(file)
    file.close()   

And the error:

XXXX@terminator:~/VVV/MCMC$ python3 make_stab_cornerplot.py -ses target_out.ses 
Traceback (most recent call last):
  File "make_stab_cornerplot.py", line 56, in <module>
    fit = dill.load(file_pi2)
  File "/usr/local/lib/python3.6/dist-packages/dill/_dill.py", line 270, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "/usr/local/lib/python3.6/dist-packages/dill/_dill.py", line 473, in load
    obj = StockUnpickler.load(self)
OSError: [Errno 9] Bad file descriptor

I do not have the problem on the server machine.

Any ideas on how to debug?

@3fon3fonov
Copy link
Author

3fon3fonov commented Sep 30, 2020

Any ideas on this? This "bug" is killing me.... :/

@mmckerns
Copy link
Member

I don't have enough information to give you a decent response, unfortunately. For example, are the version of python, and dill, and whatever other dependencies you are using identical on both machines?

Also, did you try modifying dill.settings['fmode'] to change how dill handles files?

@3fon3fonov
Copy link
Author

3fon3fonov commented May 31, 2022

Sorry for the late reply!

This problem just re-emerged and I just saw your suggestion.

Are you suggesting to do:

$ import dill
$ dill.settings['fmode']

I will try and will post ASAP.

@mmckerns
Copy link
Member

You will need all dependencies installed on both machines, including python and dill. It would also help to know which versions you are using. If they are all identical, then you might want to try changing the value of dill.settings['fmode']

@mmckerns
Copy link
Member

mmckerns commented Jun 1, 2022

potentially similar issue: #493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants