Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot connect to traci server #4686

Closed
priyabundela opened this issue Oct 10, 2018 · 41 comments
Closed

cannot connect to traci server #4686

priyabundela opened this issue Oct 10, 2018 · 41 comments
Labels

Comments

@priyabundela
Copy link

whatsapp image 2018-10-06 at 12 29 02
i started my .py file from terminal using python command
then this error is coming . the sumo-gui opens but after that nothing happens . i put the limit for 60 seconds.

@namdre
Copy link
Contributor

namdre commented Oct 10, 2018

When starting sumo-gui there should be message output in the lower part of the window stating
Starting sever on port X*
Does the value of X must match the port where your python script is trying to connect? It's 56279 in your screenshot but this number may differ every time you start the script.

@priyabundela
Copy link
Author

starting server on port X* is not appearing in the lower part of the window. the sumo-gui window just starts and nothing else appears.
I

@priyabundela
Copy link
Author

should I start the sumo-gui from command line separately on a port and then run ,py file??

@namdre
Copy link
Contributor

namdre commented Oct 10, 2018

If your python script uses traci start (e.g. traci.start(['sumo-gui', '-c', 'example.sumocfg'])) then sumo is started automatically with the correct port setting.

@priyabundela
Copy link
Author

priyabundela commented Oct 10, 2018 via email

@priyabundela
Copy link
Author

import os , sys

import environment

tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)

sumoBinary = "/home/priya/sumo/bin/sumo-gui"
sumoCmd = [sumoBinary, "-c", "/home/priya/sumo/tests/complex/tutorial/q-learning/my_config_file.sumocfg"]
import traci
traci.start(sumoCmd)
environment.test_workflow()
#traci.close()

this is what I am doing

@namdre
Copy link
Contributor

namdre commented Oct 10, 2018

what are the contents of my_config_file.sumocfg ?

@priyabundela
Copy link
Author

I don't think there are errors in this file as I am able to run separately from sumo-gui

@priyabundela
Copy link
Author

priyabundela commented Oct 10, 2018

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <input>
        <net-file value="my_net.net.xml"/>
        <route-files value="my_route.rou.xml"/>
        <gui-settings-file value="my_settings.settings.xml"/>
    </input>
    <time>
        <begin value="0"/>
        <end value="10000"/>
    </time>
</configuration>

@priyabundela
Copy link
Author

my_config_file.txt

@namdre
Copy link
Contributor

namdre commented Oct 10, 2018

Nevermind, I was thinking there might be a superfluous port option.
Can you attach a screenshot of sumo-gui after it has been started by your script?

@priyabundela
Copy link
Author

screenshot from 2018-10-10 22-54-18

@namdre
Copy link
Contributor

namdre commented Oct 10, 2018

@behrisch Do you have any Idea what could prevent the message output
WRITE_MESSAGE("***Starting server on port " + toString(port) + " ***");
?

@behrisch
Copy link
Contributor

behrisch commented Oct 11, 2018

Is there any very restrictive firewall running? Did you try it with the command line sumo ("sumo" instead of "sumo_gui")?

@priyabundela
Copy link
Author

no there is no restrictive firewall running. ya I tried this also . did not work.
if I am starting sumo on some port with remote port option with the config file . it prints the message . "starting server on port X" .
but i don't know why its unable to connect to traci server.

@namdre
Copy link
Contributor

namdre commented Oct 11, 2018

for debugging, run
sumo-gui -c my_config_file.sumocfg --remote-port 9999
and in your script replace traci.start() with trac.init(9999), then run the script

@s-dasgupta
Copy link

I am having the same error. Everything was working fine before restarting my PC. But after the restart, I am getting the following error.
"
Retrying in 1 seconds
Could not connect to TraCI server at localhost:53361 [WinError 10061] No connection could be made because the target machine actively refused it.
"
What should I do??

@behrisch
Copy link
Contributor

Did you try to specify a port manually just as mentioned above?

@muhammadsohaib60
Copy link

I am having the same error. Everything was working fine before restarting my PC. But after the restart, I am getting the following error.
"
Retrying in 1 seconds
Could not connect to TraCI server at localhost:53361 [WinError 10061] No connection could be made because the target machine actively refused it.
"
What should I do??

Hello Do you have solve this problem

@muhammadsohaib60
Copy link

I'm still working on this problem how to solve.

@behrisch
Copy link
Contributor

There may be a local firewall blocking socket access

@behrisch
Copy link
Contributor

But please rather open a new ticket and attach your scenario if possible

@monasabeti
Copy link

monasabeti commented Dec 4, 2021

@michael Behrisch
hello, i have a same problem. when i write this code, i get the error that i attach bellow.
because i think i didn't write in a good way that connect traci to osm.cfg i just write traci.init(9999)
how do you think i can solve the problem
Capture
m

and i have another question. when i connect to sumo, could you please explain for me how can i use the .xml file data in python?

@muhammadsohaib60
Copy link

muhammadsohaib60 commented Dec 4, 2021 via email

@monasabeti
Copy link

@muhammadsohaib60 do you have any idea for this problem?

@muhammadsohaib60
Copy link

muhammadsohaib60 commented Dec 4, 2021 via email

@behrisch
Copy link
Contributor

behrisch commented Dec 4, 2021

@monasabeti The best way to start up traci is to call traci.start not init. Please try to follow the traci tutorials at https://sumo.dlr.de/docs/Tutorials/index.html#traci_tutorials

@monasabeti
Copy link

thanks alot for your respond

@IJdewangan
Copy link

I was facing same problem i pressed go live option in right bottom corner and after that i used pip install traci in powershell. now i am able to simulate.

@mayaaarahayu1
Copy link

Hi, I'm maya that also working with sumo simulation. Can I discuss this with you? because I'm facing a similar problem.

@IJdewangan
Copy link

yes please

@mayaaarahayu1
Copy link

may I ask your email? or you can send me email to mayaprezi3@gmail.com.
thanks

@SunTianzhHERE
Copy link

hello,I have been facing the same problem after I tried all of your advice. How can I solve it?

@muhammadsohaib60
Copy link

muhammadsohaib60 commented Jul 24, 2023 via email

@SunTianzhHERE
Copy link

how can i do it

@muhammadsohaib60
Copy link

muhammadsohaib60 commented Jul 24, 2023 via email

@txf-
Copy link

txf- commented Dec 4, 2023

I should add to this, though possibly this should be added to a FAQ, that this error will also be caused by an incorrect file name.

for example I had a myconfig.sumocfg.xml file and traci was specifying a myconfig.sumocfg. The result was the error in this very report.

@muhammadsohaib60
Copy link

muhammadsohaib60 commented Dec 4, 2023 via email

@muhammadsohaib60
Copy link

please upload the screenshot

@txf-
Copy link

txf- commented Dec 4, 2023

please upload the screenshot

me?

renaming myconfig resolved the problem.

@muhammadsohaib60
Copy link

muhammadsohaib60 commented Dec 4, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests