[question] How to Use --env-kwargs correctly?
See original GitHub issueHow do you use --env-kwargs correctly?
I have this code in a custom environment.
custom_env = gym.make('forex-v0',
df = FOREX_EURUSD_1H_ASK,
window_size = 10,
frame_bound = (10, 300),
unit_side = 'right')
let us say I want to use the df = FOREX_EURUSD_1H_ASK
–env-kwargs df = FOREX_EURUSD_1H_ASK post an error.
Traceback (most recent call last):
File "train.py", line 79, in <module>
args = parser.parse_args()
File "C:\anaconda\envs\zootesting\lib\argparse.py", line 1755, in parse_args
args, argv = self.parse_known_args(args, namespace)
File "C:\anaconda\envs\zootesting\lib\argparse.py", line 1787, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "C:\anaconda\envs\zootesting\lib\argparse.py", line 1993, in _parse_known_args
start_index = consume_optional(start_index)
File "C:\anaconda\envs\zootesting\lib\argparse.py", line 1933, in consume_optional
take_action(action, args, option_string)
File "C:\anaconda\envs\zootesting\lib\argparse.py", line 1861, in take_action
action(self, namespace, argument_values, option_string)
File "E:\ML\reinforcementlearning\zoo\rl-baselines-zoo\utils\utils.py", line 394, in __call__
arg_dict[key] = eval(value)
File "<string>", line 0
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How To Use *args and **kwargs in Python 3 - DigitalOcean
In this tutorial, we will cover the syntax of working with *args and **kwargs as parameters within functions to pass a variable number...
Read more >Proper way to use **kwargs in Python - Stack Overflow
I like to use positional arguments only for required arguments, and kwargs for arguments that may or may not be specified, but it...
Read more >Working of kwargs in Python with Examples - eduCBA
In Python, we use kwargs that are keyword argument is used to when you provide a name to a variable as we pass...
Read more >*args and **kwargs in python explained - Yasoob Khalid
This is just the basics of **kwargs and you can see how useful it is. Now lets talk about how you can use...
Read more >Python args and kwargs: Demystified
To recap, the correct order for your parameters is: Standard arguments; *args arguments; **kwargs arguments. For example, this function definition is correct:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@toksis I believe the problem is yet with the equal sign.
The other command line parameters has only one value. For example: for
--algo
, in a terminal, you could use--algo=acktr
or--algo acktr
, and both it would work. But for--env-kwargs
you need to pass more than one value, so you can’t use the equal sign.If you were using a terminal you would only need to replace the equal sign by space character. But this will not work with Visual Studio Code because when there is a space inside the arg, VS code put quotes around the arg. So I believe the solution is to separate the args.
Replace this line:
by this:
And tell us if it works.
Thank you for your help @araffin and @caburu cabu. Sorry for the delay, but I did this directly after waking up hehe.
To this:
From this:
The way I put the argument in Launch.json is the culprit. It works now!