DriveML Huawei Autonomous Vehicles Challenge Forum

Go back to competition Back to thread list Post in this thread

> fileno error

Hi,

when running this code in python:

from hiway.sumo_scenario import SumoScenario
import gym
env = gym.make('gym_hiway:hiway-competition-v0', config={'sumo_scenario': SumoScenario("/Users/ed/Desktop/Huawei/dataset_public/3lane")})

The following error arises:

runfile('/Users/ed/spyder/temp.py', wdir='/Users/ed/spyder')
Traceback (most recent call last):

File "<ipython-input-2-57164305caf1>", line 1, in <module>
runfile('/Users/ed/spyder/temp.py', wdir='/Users/ed/spyder')

File "/opt/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "/opt/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "/Users/ed/spyder/temp.py", line 10, in <module>
env = gym.make('gym_hiway:hiway-competition-v0', config={'sumo_scenario': SumoScenario("/Users/ed/Desktop/Huawei/dataset_public/3lane")})

File "/opt/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py", line 156, in make
return registry.make(id, **kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py", line 101, in make
env = spec.make(**kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py", line 73, in make
env = cls(**_kwargs)

File "/opt/anaconda3/lib/python3.7/site-packages/gym_hiway/env/competition_env.py", line 120, in __init__
time_resolution=timestep_sec)

File "/opt/anaconda3/lib/python3.7/site-packages/hiway/sumo_traffic_simulation.py", line 66, in __init__
self._initialize_traci_conn()

File "/opt/anaconda3/lib/python3.7/site-packages/hiway/sumo_traffic_simulation.py", line 93, in _initialize_traci_conn
sumo_proc = subprocess.Popen(sumo_cmd, preexec_fn=os.setsid, stdout=sys.stdout)

File "/opt/anaconda3/lib/python3.7/subprocess.py", line 728, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)

File "/opt/anaconda3/lib/python3.7/subprocess.py", line 1359, in _get_handles
c2pwrite = stdout.fileno()

UnsupportedOperation: fileno

How could I fix this?
Thanks

Posted by: Team91 @ Nov. 6, 2019, 3:08 p.m.

Please run directly from `python` instead of using the Python IDLE (https://stackoverflow.com/a/31081957).

Posted by: HuaweiUK @ Nov. 6, 2019, 6:29 p.m.
Post in this thread