classification
Title: bug in interactions between argparse and random
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: peeble111, steven.daprano
Priority: normal Keywords:

Created on 2021-07-20 23:01 by peeble111, last changed 2021-07-20 23:26 by steven.daprano. This issue is now closed.

Files
File name Uploaded Description Edit
testRandom.py peeble111, 2021-07-20 23:01 test program and run
Messages (2)
msg397918 - (view) Author: pierpaolo paolucci (peeble111) Date: 2021-07-20 23:01
Python 3.9.6 (default, Jun 28 2021, 11:30:47) 
[GCC 10.3.0] on linux

I tried to run the first time a prg and successively reproduce eventals error

see the attachment
msg397919 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2021-07-20 23:26
args.seed if args.seed else SEED is not doing what you think it is doing.

SEED is an *int* but args.seed is a *str*:

>>> random.seed(6385845682483836956)
>>> random.randint(10, 500)
92
>>> random.seed('6385845682483836956')
>>> random.randint(10, 500)
347
History
Date User Action Args
2021-07-20 23:26:27steven.dapranosetstatus: open -> closed

nosy: + steven.daprano
messages: + msg397919

resolution: not a bug
stage: resolved
2021-07-20 23:01:09peeble111create