question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

_dill TypeError when loading graph_CS.pk

See original GitHub issue

Hi,

I downloaded the data you referenced and tried to run your code on it, but unfortunately ran into some issues.

(1) I am working on a machine with cuda 10.0, which means that I can’t install the specified versions of the python packages. So I switched to the newest versions. (Just mentioning this here, in case this might be the reason for my problems.)

(2) Building the docker conatiner failed due to memory issues. (on this note: there’s a typo in the docker command in the README.md file in the Docker folder. It should be Dockerfile instead of DockerFile:

$ docker build -t "pyhgt:latest" -f ./Docker/Dockerfile .

(3) When I try to run train_paper_field.py I get an error message when the graph_CS.pk file is loaded as an RenameUnpickler(). I couldn’t figure out where the error comes from. This is the specific error message I get:

Traceback (most recent call last):
  File "train_paper_field.py", line 72, in <module>
    graph = renamed_load(open(os.path.join(args.data_dir, 'graph%s.pk' % args.domain), 'rb'))
  File "/home/tamara/Documents/coding/pyHGT/OAG/pyHGT/data.py", line 269, in renamed_load
    return RenameUnpickler(file_obj).load()
  File "/home/tamara/.virtualenvs/playground/lib/python3.8/site-packages/dill/_dill.py", line 473, in load
    obj = StockUnpickler.load(self)
TypeError: an integer is required (got type bytes)

Do you have an idea what the issue might be in point (3)?

Many thanks!

Tamara

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
wukaiyeahcommented, Jul 4, 2022

Yeah, I have fixed this problem and the solution may be suit for everyone! I found the versions of Python, dill, and other packages did effect the successfully loading (Graph_CS.pk), and I could not install the same version as ‘requirements.txt’. It’s a huge contradiction. So I performed the preprocess step (‘preprocess_OAG.py’) and rebuilt the Graph_CS.pk with the latest versions of dill. Finally, it worked.

0reactions
ShadyAlkhouricommented, Feb 3, 2021

Using Python 3.7.9 fixed the problem for me, with dill 0.3.0 as in the requirements file

Read more comments on GitHub >

github_iconTop Results From Across the Web

_dill TypeError when loading graph_CS.pk · Issue #19 · UCLA ...
I checked the dill loading code, and it works well from my side. I search this error message and found people arguing that...
Read more >
Python TypeError on Load Object using Dill - Stack Overflow
In this case, the answer lay within the module itself. The LocalAudioFile class provides (and each of it's instances can therefor utilize) ...
Read more >
Pickle in Python Tutorial: Object Serialization - DataCamp
If you forget the b , a TypeError: must be str, not bytes will be returned. ... The process of loading a pickled...
Read more >
Release Notes — Airflow Documentation
NoSuchModuleError( "Can't load plugin: %s:%s" % (self.group, name) ) E sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:postgres.
Read more >
Browse Python Technical Problem Clusters - Code Grepper
... 'backend.wsgi.application' could not be loaded; error importing module. ... python class typeerror module() takes at most 2 arguments (3 given) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found