LARG / HFO

Half Field Offense in Robocup 2D Soccer
MIT License
230 stars 93 forks source link

Popen in Trainer.py: [Errno 2] No such file or directory #1

Closed EKMeyerson closed 9 years ago

EKMeyerson commented 9 years ago

Everything is compiled and rcssserver is working. I am now trying ./bin/start.py, but am getting Popen 'No such file or directory errors'. Running ./bin/start.py as is, I get:

Traceback (most recent call last):
  File "./bin/start.py", line 111, in <module>
    main(parseArgs())
  File "./bin/start.py", line 75, in main
    trainer.run(necProcesses)
  File "/v/filer4b/v20q001/ekm/Research/hfo/HFO/bin/Trainer.py", line 626, in run
    self._agentPopen = self.launch_agent()
  File "/v/filer4b/v20q001/ekm/Research/hfo/HFO/bin/Trainer.py", line 107, in launch_agent
    p = subprocess.Popen(agentCmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception

Following online suggestions, I added shell=True to the arguments of line 107 in Trainer.py to make it p = subprocess.Popen(agentCmd, shell=True, **kwargs). This makes this line execute fine, but I then get the error:

Traceback (most recent call last):
  File "./bin/start.py", line 111, in <module>
    main(parseArgs())
  File "./bin/start.py", line 75, in main
    trainer.run(necProcesses)
  File "/v/filer4b/v20q001/ekm/Research/hfo/HFO/bin/Trainer.py", line 626, in run
    self._agentPopen = self.launch_agent()
  File "/v/filer4b/v20q001/ekm/Research/hfo/HFO/bin/Trainer.py", line 109, in launch_agent
    with open('/tmp/start%i' % p.pid,'r') as f:
IOError: [Errno 2] No such file or directory: '/tmp/start17548'

I'm not exactly sure how Popen works. Line 109 is trying to read the file the process launched on line 107 should be writing to. It could be that either the process launched is not creating this /tmp/start<pid> file, or it's not creating it before line 109 tries to read it.

mhauskn commented 9 years ago

It looks like Popen was unhappy with launching the agent. I've pushed an update to make the log paths more flexible, so that it won't always write to /tmp/start. Can you pull and try again?

EKMeyerson commented 9 years ago

Looks like the fix worked great. I didn't even need to recompile. Everything now seems to launch successfully; including visuals. I'll move on to further tests.