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

PicklingError: Can't pickle : it's not the same object as __main__.mytest1 #83

Open
lzygitk7 opened this issue Mar 8, 2024 · 1 comment

Comments

@lzygitk7
Copy link

lzygitk7 commented Mar 8, 2024

with code:
import time
import timeout_decorator

@timeout_decorator.timeout(3,use_signals=False)
def mytest():
time.sleep(5)
return 5
mytest()
get:
Output exceeds the size limit. Open the full output data in a text editor

PicklingError Traceback (most recent call last)
Cell In[24], line 8
6 time.sleep(5)
7 return 5
----> 8 mytest()

File c:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\timeout_decorator\timeout_decorator.py:92, in timeout..decorate..new_function(*args, **kwargs)
89 @wraps(function)
90 def new_function(*args, **kwargs):
91 timeout_wrapper = _Timeout(function, timeout_exception, exception_message, seconds)
---> 92 return timeout_wrapper(*args, **kwargs)

File c:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\timeout_decorator\timeout_decorator.py:147, in _Timeout.call(self, *args, **kwargs)
143 self.__process = multiprocessing.Process(target=_target,
144 args=args,
145 kwargs=kwargs)
146 self.__process.daemon = True
--> 147 self.__process.start()
148 if self.__limit is not None:
149 self.__timeout = self.__limit + time.time()

File c:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py:121, in BaseProcess.start(self)
118 assert not _current_process._config.get('daemon'),
119 'daemonic processes are not allowed to have children'
...
58 def dump(obj, file, protocol=None):
59 '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60 ForkingPickler(file, protocol).dump(obj)

PicklingError: Can't pickle : it's not the same object as main.mytest

Does anyone have any solution?

@leo83
Copy link

leo83 commented Nov 17, 2024

Have the same problem. Can't resolve yet

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

No branches or pull requests

2 participants