Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python args variable not working with parser.parse_args [duplicate]

I am working on a simple script that uses parse_args, but the assignment does not work if the variable name is args, as shown in the documentation and multiple examples.

(Pdb) parser.parse_args()
Namespace(partition_frequency='daily', start_date='2016-02-03', table_name='test_table')

(Pdb) x=parser.parse_args()
(Pdb) x
Namespace(partition_frequency='daily', start_date='2016-02-03', table_name='test_table')

(Pdb) args=parser.parse_args()
(Pdb) args
      **>> No output**
(Pdb) arg=parser.parse_args()
(Pdb) arg
Namespace(partition_frequency='daily', start_date='2016-02-03', table_name='test_table')

Any clues?

like image 408
Rajesh Chamarthi Avatar asked May 20 '26 15:05

Rajesh Chamarthi


1 Answers

The problem is that you are running these commands in pdb.

As it turns out, args is a pdb command! So it's not being interpreted as a variable, but rather as a command to pdb.

like image 167
Amber Avatar answered May 23 '26 03:05

Amber