- [ x] I am on the latest Pendulum version.
- [ x] I have searched the issues of this repo and believe that this is not a duplicate.
- OS version and name: RHEL8 ( 4.18.0-553.132.1.el8_10.x86_64)
- Pendulum version: 3.2.0
Issue
I've encountered an odd issue after the team recently upgraded pendulum for our utilities. One of our tools does a simple time tracking calculation of the form:
start=pendulum.now()
....
time_diff = pendulum.now() - start_time
The later line generated a type error:
Traceback (most recent call last):
File "/users/vlapipe/workflows/dsoc-prod/bin/mr_books", line 8, in
sys.exit(mr_books())
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pyat/mr_books/commands.py", line 594, in mr_books
mb.run()
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pyat/mr_books/commands.py", line 534, in run
time_diff = pendulum.now() - start_time
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pendulum/datetime.py", line 1215, in sub
return other.diff(self, False)
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pendulum/datetime.py", line 712, in diff
return Interval(self, dt, absolute=abs)
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pendulum/interval.py", line 185, in init
self._delta: PreciseDiff = precise_diff(_start, _end)
TypeError: 'NoneType' object cannot be cast as 'str'
But only when the utility was run on via slurm. Any hand execution of the utility returned without error. This may be related to issue #905 , since the error disappeared once the now() calls were provided an explicit timezone (pendulum.now('UTC')).
It seems as though now() was missing critical timezone information in the limited environment of cluster execution via Slurm, which was provided in by a standard login.
Issue
I've encountered an odd issue after the team recently upgraded pendulum for our utilities. One of our tools does a simple time tracking calculation of the form:
start=pendulum.now()
....
time_diff = pendulum.now() - start_time
The later line generated a type error:
Traceback (most recent call last):
File "/users/vlapipe/workflows/dsoc-prod/bin/mr_books", line 8, in
sys.exit(mr_books())
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pyat/mr_books/commands.py", line 594, in mr_books
mb.run()
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pyat/mr_books/commands.py", line 534, in run
time_diff = pendulum.now() - start_time
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pendulum/datetime.py", line 1215, in sub
return other.diff(self, False)
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pendulum/datetime.py", line 712, in diff
return Interval(self, dt, absolute=abs)
File "/users/vlapipe/workflows/dsoc-prod/lib/python3.10/site-packages/pendulum/interval.py", line 185, in init
self._delta: PreciseDiff = precise_diff(_start, _end)
TypeError: 'NoneType' object cannot be cast as 'str'
But only when the utility was run on via slurm. Any hand execution of the utility returned without error. This may be related to issue #905 , since the error disappeared once the now() calls were provided an explicit timezone (pendulum.now('UTC')).
It seems as though now() was missing critical timezone information in the limited environment of cluster execution via Slurm, which was provided in by a standard login.