CityFlow icon indicating copy to clipboard operation
CityFlow copied to clipboard

TypeError: cannot unpack non-iterable Phase object

Open ZheliXiong opened this issue 3 years ago • 7 comments

hi bro.i meet another problem when i transfer the sumo map .xml to the cityflow map .json.it says TypeError: cannot unpack non-iterable Phase object when the convert.py process the function named "node_to_intersection".the same problem with the examples file atlanta_sumo.net.xml. i dont know if i get something wrong?

ZheliXiong avatar Apr 01 '21 13:04 ZheliXiong

Please check the naming of your intersection 'edges' or roads in sumo, if the name of an edge is with an underscore eg edge_1 , the issue appears.

abderraouf2che avatar Apr 03 '21 10:04 abderraouf2che

@wnzhang @zyr17 more documentation is required!

abderraouf2che avatar Apr 03 '21 10:04 abderraouf2che

Hi,i checked my sumo, and theres no edge named  with an underscore. And i try the provided  file "atlanta_sumo.net.xml" .the issue also appears. That wonders me. Could you please give me more guidance? thanks a lot~ ------------------ 原始邮件 ------------------ 发件人: "cityflow-project/CityFlow" @.>; 发送时间: 2021年4月3日(星期六) 晚上6:38 @.>; @.@.>; 主题: Re: [cityflow-project/CityFlow] TypeError: cannot unpack non-iterable Phase object (#122)

Please check the naming of your intersection 'edges' or roads in sumo, if the name of an edge is with an underscore eg edge_1 , the issue appears.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ZheliXiong avatar Apr 05 '21 03:04 ZheliXiong

The edges naming in that file include underscore;


<edge id=":69387078_0" function="internal">
        <lane id=":69387078_0_0" index="0" disallow="tram rail_urban rail rail_electric ship" speed="13.89" length="4.82" shape="515.24,1342.21 516.45,1343.07 516.84,1343.91 516.40,1344.72 515.14,1345.51"/>
    </edge>

if you replace the underscore by another character or remove it, it will work.

abderraouf2che avatar Apr 08 '21 08:04 abderraouf2che

Hi bro. thanks a lot for your guidance. and i try but i still failed by replacing the underscore in name of edges. finally i try to replace these code in converter.py

for phase,duration in tls_dict[nodeid]._programs['0']._phases:

lane_list = []

for i,alpha in enumerate(phase):

if (alpha == 'G' or alpha == 'g') and i in G_to_lane_dict.keys():

by for phase in tls_dict[nodeid]._programs['0']._phases: lane_list = [] duration=phase.duration for alpha in enumerate(phase.state): if (alpha == 'G' or alpha == 'g') and i in G_to_lane_dict.keys(): and it works. i dont know if this problem is related to the version of python.because i use python3. hope it will be useful to you.  ------------------ 原始邮件 ------------------ 发件人: "cityflow-project/CityFlow" @.>; 发送时间: 2021年4月8日(星期四) 下午4:08 @.>; @.@.>; 主题: Re: [cityflow-project/CityFlow] TypeError: cannot unpack non-iterable Phase object (#122)

The edges naming in that file include underscore; '''

'''' if you replace the underscore by another character or remove it, it will work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ZheliXiong avatar Apr 09 '21 05:04 ZheliXiong

Thanks! Your solution helps a lot!

rika1021 avatar Jul 04 '22 06:07 rika1021

Welcome

abderraouf2che avatar Jul 04 '22 08:07 abderraouf2che