Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
718 views
in Technique[技术] by (71.8m points)

python - ValueError: not enough values to unpack (expected 2, got 1) custom environment

I have a environment which has the custom architecture like this:

class environment(gym.Env):
    metadata ={'render.modes': ['human']}
    
    
    ACTION = ['buy', 'do not buy']
    
    def __init__(self, df):        
        pass
    
    
    def reset(self):
        #Reset the state of the environment to an initial state   
        return self._next_observation()
    
    
    def step(self, action):
        pass
    
    def _next_observation(self):
        pass
    
    
    def _get_reward(self):
        pass
        
    def _take_action(self, action):
        pass
        
    def render(self, mode = 'human', close=False):
        pass

When creating a package by creating folder system like this

----- env

---------- env

---------- init.py

---------- setup.py

--------------- env.py

--------------- __init__py

I receive my package with pip install -e . I get my custom environment. However, when trying to retrieve my environment by gym.make('env-v0') I get the following traceback:



  File "C:UsersAWDesktopImitationLearningFruitFruitrain_reinforcement_learning-fruits.py", line 11, in <module>
    env = gym.make('FruitEnv-v0')

  File "C:UserAWAnaconda3libsite-packagesgymenvs
egistration.py", line 145, in make
    return registry.make(id, **kwargs)

  File "C:UsersAWAnaconda3libsite-packagesgymenvs
egistration.py", line 90, in make
    env = spec.make(**kwargs)

  File "C:UsersAWAnaconda3libsite-packagesgymenvs
egistration.py", line 59, in make
    cls = load(self.entry_point)

  File "C:UsersAWAnaconda3libsite-packagesgymenvs
egistration.py", line 17, in load
    mod_name, attr_name = name.split(":")

ValueError: not enough values to unpack (expected 2, got 1)

Can someone tell me what's missing?

question from:https://stackoverflow.com/questions/65935310/valueerror-not-enough-values-to-unpack-expected-2-got-1-custom-environment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...