Comments (4)
Hello,
will try to reproduce the issue. What OS are you using?
from pebble.
I use official Python docker image, python:3.12.2-bookworm, linux amd64, which is Debian 12.5
Host is Ubuntu 23.10, usual DO droplet with 2 GB Memory, if that matters.
from pebble.
I'm testing the new version after d32346d and it seems to handle arising exception as it should 👍 and overall program doesn't crash. (I have occasional error coming from google sheets API & gspread lib)
Looks good on my side, thank you!
Full error log just in case:
01.03.24 06:00:10 ERROR module: run __main__ func: <module> line: 57 msg: 'dict' object has no attribute 'text'
┆ File "/app/run.py", line 53, in <module>
┆ 49 if __name__ == '__main__':
┆ 50 while True:
┆ 51 try:
┆ 52 future = main()
┆ --> 53 results = future.result()
┆ 54 except TimeoutError as error:
┆ ..................................................
┆ __name__ = '__main__'
┆ future = <ProcessFuture at 0x7f464b201c70 state=finished raised Attri
┆ buteError>
┆ results = None
┆ future.result = <method 'Future.result' of <ProcessFuture at 0x7f464b201c70
┆ state=finished raised AttributeError> _base.py:428>
┆ error = AttributeError("'dict' object has no attribute 'text'")
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 456, in result
┆ 428 def result(self, timeout=None):
┆ (...)
┆ 452
┆ 453 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
┆ 454 raise CancelledError()
┆ 455 elif self._state == FINISHED:
┆ --> 456 return self.__get_result()
┆ 457 else:
┆ ..................................................
┆ self = None
┆ timeout = None
┆ self._state = # AttributeError
┆ self = None
┆ CANCELLED = 'CANCELLED'
┆ CANCELLED_AND_NOTIFIED = 'CANCELLED_AND_NOTIFIED'
┆ FINISHED = 'FINISHED'
┆ self.__get_result = # AttributeError
┆ self = None
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
┆ 398 def __get_result(self):
┆ 399 if self._exception:
┆ 400 try:
┆ --> 401 raise self._exception
┆ 402 finally:
┆ ..................................................
┆ self = None
┆ self._exception = # AttributeError
┆ self = None
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/site-packages/pebble/concurrent/process.py", line 178, in _get_result
┆ 163 def _get_result(
┆ 164 future: ProcessFuture,
┆ 165 pipe: multiprocessing.Pipe,
┆ 166 timeout: float
┆ 167 ) -> Any:
┆ (...)
┆ 174 return Result(FAILURE, TimeoutError('Task Timeout', timeout))
┆ 175 if future.cancelled():
┆ 176 return Result(FAILURE, CancelledError())
┆ 177
┆ --> 178 return pipe.recv()
┆ 179 except (EOFError, OSError):
┆ ..................................................
┆ future = <ProcessFuture at 0x7f464b201c70 state=finished raised Attri
┆ buteError>
┆ pipe = <multiprocessing.connection.Connection object at 0x7f4649be4
┆ 770>
┆ multiprocessing.Pipe = <method 'BaseContext.Pipe' of <multiprocessing.context.Defau
┆ ltContext object at 0x7f4650658530> context.py:60>
┆ timeout = 500
┆ FAILURE = 1
┆ future.cancelled = <method 'Future.cancelled' of <ProcessFuture at 0x7f464b201c
┆ 70 state=finished raised AttributeError> _base.py:383>
┆ pipe.recv = <method '_ConnectionBase.recv' of <multiprocessing.connectio
┆ n.Connection object at 0x7f4649be4770> connection.py:246>
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 251, in recv
┆ 246 def recv(self):
┆ 247 """Receive a (picklable) object"""
┆ 248 self._check_closed()
┆ 249 self._check_readable()
┆ 250 buf = self._recv_bytes()
┆ --> 251 return _ForkingPickler.loads(buf.getbuffer())
┆ ..................................................
┆ self = <multiprocessing.connection.Connection object at 0x7f4649be4
┆ 770>
┆ self._check_closed = <method '_ConnectionBase._check_closed' of <multiprocessing.
┆ connection.Connection object at 0x7f4649be4770> connection.p
┆ y:135>
┆ self._check_readable = <method '_ConnectionBase._check_readable' of <multiprocessin
┆ g.connection.Connection object at 0x7f4649be4770> connection
┆ .py:139>
┆ buf = <_io.BytesIO object at 0x7f46491c19e0>
┆ self._recv_bytes = <method 'Connection._recv_bytes' of <multiprocessing.connect
┆ ion.Connection object at 0x7f4649be4770> connection.py:429>
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 43, in __init__
┆ 42 def __init__(self, response: Response):
┆ --> 43 super().__init__(self._extract_text(response))
┆ 44 self.response: Response = response
┆ ..................................................
┆ self = APIError({'code': 503, 'message': 'The service is currently
┆ unavailable.', 'status': 'UNAVAILABLE'})
┆ response = {'code': 503,
┆ 'message': 'The service is currently unavailable.',
┆ 'status': 'UNAVAILABLE'}
┆ self._extract_text = <method 'APIError._extract_text' of {'code': 503, 'message':
┆ 'The service is currently unavailable.', 'status': 'UNAVAIL
┆ ABLE'} exceptions.py:46>
┆ self.response = # AttributeError
┆ self = APIError({'code': 503, 'message': 'The service is cur
┆ rently unavailable.', 'status': 'UNAVAILABLE'})
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 49, in _extract_text
┆ 46 def _extract_text(
┆ 47 self, response: Response
┆ 48 ) -> Union[Dict[str, Union[int, str]], str]:
┆ --> 49 return self._text_from_detail(response) or response.text
┆ ..................................................
┆ self = APIError({'code': 503, 'message': 'The service is currently
┆ unavailable.', 'status': 'UNAVAILABLE'})
┆ response = {'code': 503,
┆ 'message': 'The service is currently unavailable.',
┆ 'status': 'UNAVAILABLE'}
┆ self._text_from_detail = <method 'APIError._text_from_detail' of {'code': 503, 'messa
┆ ge': 'The service is currently unavailable.', 'status': 'UNA
┆ VAILABLE'} exceptions.py:51>
┆ response.text = # AttributeError
┆ response = {'code': 503,
┆ 'message': 'The service is currently unavailable.',
┆ 'status': 'UNAVAILABLE'}
┆ ..................................................
┆
┆ ---- (full traceback above) ----
┆ File "/app/run.py", line 53, in <module>
┆ results = future.result()
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 456, in result
┆ return self.__get_result()
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
┆ raise self._exception
┆ File "/usr/local/lib/python3.12/site-packages/pebble/concurrent/process.py", line 178, in _get_result
┆ return pipe.recv()
┆ File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 251, in recv
┆ return _ForkingPickler.loads(buf.getbuffer())
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 43, in __init__
┆ super().__init__(self._extract_text(response))
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 49, in _extract_text
┆ return self._text_from_detail(response) or response.text
┆
┆ AttributeError: 'dict' object has no attribute 'text'
```01.03.24 06:00:10 ERROR module: run __main__ func: <module> line: 57 msg: 'dict' object has no attribute 'text'
┆ File "/app/run.py", line 53, in <module>
┆ 49 if __name__ == '__main__':
┆ 50 while True:
┆ 51 try:
┆ 52 future = main()
┆ --> 53 results = future.result()
┆ 54 except TimeoutError as error:
┆ ..................................................
┆ __name__ = '__main__'
┆ future = <ProcessFuture at 0x7f464b201c70 state=finished raised Attri
┆ buteError>
┆ results = None
┆ future.result = <method 'Future.result' of <ProcessFuture at 0x7f464b201c70
┆ state=finished raised AttributeError> _base.py:428>
┆ error = AttributeError("'dict' object has no attribute 'text'")
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 456, in result
┆ 428 def result(self, timeout=None):
┆ (...)
┆ 452
┆ 453 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
┆ 454 raise CancelledError()
┆ 455 elif self._state == FINISHED:
┆ --> 456 return self.__get_result()
┆ 457 else:
┆ ..................................................
┆ self = None
┆ timeout = None
┆ self._state = # AttributeError
┆ self = None
┆ CANCELLED = 'CANCELLED'
┆ CANCELLED_AND_NOTIFIED = 'CANCELLED_AND_NOTIFIED'
┆ FINISHED = 'FINISHED'
┆ self.__get_result = # AttributeError
┆ self = None
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
┆ 398 def __get_result(self):
┆ 399 if self._exception:
┆ 400 try:
┆ --> 401 raise self._exception
┆ 402 finally:
┆ ..................................................
┆ self = None
┆ self._exception = # AttributeError
┆ self = None
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/site-packages/pebble/concurrent/process.py", line 178, in _get_result
┆ 163 def _get_result(
┆ 164 future: ProcessFuture,
┆ 165 pipe: multiprocessing.Pipe,
┆ 166 timeout: float
┆ 167 ) -> Any:
┆ (...)
┆ 174 return Result(FAILURE, TimeoutError('Task Timeout', timeout))
┆ 175 if future.cancelled():
┆ 176 return Result(FAILURE, CancelledError())
┆ 177
┆ --> 178 return pipe.recv()
┆ 179 except (EOFError, OSError):
┆ ..................................................
┆ future = <ProcessFuture at 0x7f464b201c70 state=finished raised Attri
┆ buteError>
┆ pipe = <multiprocessing.connection.Connection object at 0x7f4649be4
┆ 770>
┆ multiprocessing.Pipe = <method 'BaseContext.Pipe' of <multiprocessing.context.Defau
┆ ltContext object at 0x7f4650658530> context.py:60>
┆ timeout = 500
┆ FAILURE = 1
┆ future.cancelled = <method 'Future.cancelled' of <ProcessFuture at 0x7f464b201c
┆ 70 state=finished raised AttributeError> _base.py:383>
┆ pipe.recv = <method '_ConnectionBase.recv' of <multiprocessing.connectio
┆ n.Connection object at 0x7f4649be4770> connection.py:246>
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 251, in recv
┆ 246 def recv(self):
┆ 247 """Receive a (picklable) object"""
┆ 248 self._check_closed()
┆ 249 self._check_readable()
┆ 250 buf = self._recv_bytes()
┆ --> 251 return _ForkingPickler.loads(buf.getbuffer())
┆ ..................................................
┆ self = <multiprocessing.connection.Connection object at 0x7f4649be4
┆ 770>
┆ self._check_closed = <method '_ConnectionBase._check_closed' of <multiprocessing.
┆ connection.Connection object at 0x7f4649be4770> connection.p
┆ y:135>
┆ self._check_readable = <method '_ConnectionBase._check_readable' of <multiprocessin
┆ g.connection.Connection object at 0x7f4649be4770> connection
┆ .py:139>
┆ buf = <_io.BytesIO object at 0x7f46491c19e0>
┆ self._recv_bytes = <method 'Connection._recv_bytes' of <multiprocessing.connect
┆ ion.Connection object at 0x7f4649be4770> connection.py:429>
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 43, in __init__
┆ 42 def __init__(self, response: Response):
┆ --> 43 super().__init__(self._extract_text(response))
┆ 44 self.response: Response = response
┆ ..................................................
┆ self = APIError({'code': 503, 'message': 'The service is currently
┆ unavailable.', 'status': 'UNAVAILABLE'})
┆ response = {'code': 503,
┆ 'message': 'The service is currently unavailable.',
┆ 'status': 'UNAVAILABLE'}
┆ self._extract_text = <method 'APIError._extract_text' of {'code': 503, 'message':
┆ 'The service is currently unavailable.', 'status': 'UNAVAIL
┆ ABLE'} exceptions.py:46>
┆ self.response = # AttributeError
┆ self = APIError({'code': 503, 'message': 'The service is cur
┆ rently unavailable.', 'status': 'UNAVAILABLE'})
┆ ..................................................
┆
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 49, in _extract_text
┆ 46 def _extract_text(
┆ 47 self, response: Response
┆ 48 ) -> Union[Dict[str, Union[int, str]], str]:
┆ --> 49 return self._text_from_detail(response) or response.text
┆ ..................................................
┆ self = APIError({'code': 503, 'message': 'The service is currently
┆ unavailable.', 'status': 'UNAVAILABLE'})
┆ response = {'code': 503,
┆ 'message': 'The service is currently unavailable.',
┆ 'status': 'UNAVAILABLE'}
┆ self._text_from_detail = <method 'APIError._text_from_detail' of {'code': 503, 'messa
┆ ge': 'The service is currently unavailable.', 'status': 'UNA
┆ VAILABLE'} exceptions.py:51>
┆ response.text = # AttributeError
┆ response = {'code': 503,
┆ 'message': 'The service is currently unavailable.',
┆ 'status': 'UNAVAILABLE'}
┆ ..................................................
┆
┆ ---- (full traceback above) ----
┆ File "/app/run.py", line 53, in <module>
┆ results = future.result()
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 456, in result
┆ return self.__get_result()
┆ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
┆ raise self._exception
┆ File "/usr/local/lib/python3.12/site-packages/pebble/concurrent/process.py", line 178, in _get_result
┆ return pipe.recv()
┆ File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 251, in recv
┆ return _ForkingPickler.loads(buf.getbuffer())
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 43, in __init__
┆ super().__init__(self._extract_text(response))
┆ File "/usr/local/lib/python3.12/site-packages/gspread/exceptions.py", line 49, in _extract_text
┆ return self._text_from_detail(response) or response.text
┆
┆ AttributeError: 'dict' object has no attribute 'text'
from pebble.
Issue fixed in release 5.0.7
, please re-open this issue if the problem persists.
from pebble.
Related Issues (20)
- The timeout argument of ProcessPool().submit() is inconsistent with ThreadPool().submit() HOT 3
- Bug: new `submit` function makes it impossible to call a function that has a `timeout` argument HOT 6
- Logging process name inside concurrent.process HOT 2
- How to handle errors when using pool.schedule HOT 1
- shutdown of main program HOT 2
- @concurrent.process returned future blocks/hangs on running(), cancelled(), done() calls HOT 2
- Get information about broken process HOT 4
- Documentation for Pebble indicates threads created with a ThreadPool are cancellable HOT 1
- Channel mutex timeout HOT 6
- How can I use a multiprocessing.manager alongside with pebble to avoid re-importing the function everytime? HOT 1
- Type hint error of wrapped function HOT 7
- ISSUE with with ProcessPool when scheduled function return exception (not raise it) HOT 1
- BUG with ProcessPool when scheduled function raise BaseException HOT 1
- issue with handling frozen exceptions in worker thread or process HOT 1
- Cannot create pebble.ProcessPool() multiple times within a single run, all task got stuck and time out HOT 3
- using multiprocess context (for dill support) no longer working HOT 2
- Workers using 100% CPU not getting killed after timeout HOT 11
- Behavior of Process.map with chunksize > 1 and a timeout HOT 5
- map function is extremely slow, seems to be executing sequentially HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pebble.