m0rtezaaghili Posted May 22, 2013 Share Posted May 22, 2013 Hi guys i'm newcomer in Houdini, my simple code not working and don't show error in Houdini console! i changed the Tag Name to "osk" from "osm" but i don\t see error 'Bad file type' in console. import xml.dom.minidomdocument="""<osk version="0.6" generator="CGImap 0.1.0" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <bounds minlat="40.7432000" minlon="-73.9897000" maxlat="40.8052000" maxlon="-73.9304000"/> <node id="1420631950" lat="40.7711745" lon="-73.9792204" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/><node id="1420631974" lat="40.7716867" lon="-73.9779803" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631985" lat="40.7694268" lon="-73.9788969" user="dchiles" uid="153669" visible="true" version="1" changeset="9189979" timestamp="2011-09-02T04:12:03Z"/></osk>"""map = xml.dom.minidom.parseString(document) if (map.documentElement.tagName != "osm"); print('Bad File Type') return[/CODE]Thanks Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted May 22, 2013 Share Posted May 22, 2013 import xml.dom.minidomdocument="""<osk version="0.6" generator="CGImap 0.1.0" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <bounds minlat="40.7432000" minlon="-73.9897000" maxlat="40.8052000" maxlon="-73.9304000"/> <node id="1420631950" lat="40.7711745" lon="-73.9792204" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/><node id="1420631974" lat="40.7716867" lon="-73.9779803" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631985" lat="40.7694268" lon="-73.9788969" user="dchiles" uid="153669" visible="true" version="1" changeset="9189979" timestamp="2011-09-02T04:12:03Z"/></osk>"""map = xml.dom.minidom.parseString(document)if (map.documentElement.tagName != "osm"): print('Bad File Type')[/CODE]You have a ; instead of :[size=4]also return can/should only be used in functions[/size] Quote Link to comment Share on other sites More sharing options...
anim Posted May 22, 2013 Share Posted May 22, 2013 (edited) if your real code is part of the function and indents are correct (like if() statement should be aligned with map) then the only error is that you've put semicolon after if() instead of a colon so it should be ...map = xml.dom.minidom.parseString(document)if (map.documentElement.tagName != "osm"): print('Bad File Type') return[/CODE]EDIT: late reply Edited May 22, 2013 by anim Quote Link to comment Share on other sites More sharing options...
m0rtezaaghili Posted May 22, 2013 Author Share Posted May 22, 2013 import xml.dom.minidomdocument="""<osk version="0.6" generator="CGImap 0.1.0" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <bounds minlat="40.7432000" minlon="-73.9897000" maxlat="40.8052000" maxlon="-73.9304000"/> <node id="1420631950" lat="40.7711745" lon="-73.9792204" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/><node id="1420631974" lat="40.7716867" lon="-73.9779803" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631985" lat="40.7694268" lon="-73.9788969" user="dchiles" uid="153669" visible="true" version="1" changeset="9189979" timestamp="2011-09-02T04:12:03Z"/></osk>"""map = xml.dom.minidom.parseString(document)if (map.documentElement.tagName != "osm"):print('Bad File Type')[/CODE]You have a ; instead of :[size=4]also return can/should only be used in functions[/size] if your real code is part of the function and indents are correct [size=4](like if() statement should be aligned with map)[/size] [size=4]then the only error is that you've put semicolon after if() instead of a colon[/size] [size=4]so it should be[/size] [CODE]...map = xml.dom.minidom.parseString(document)if (map.documentElement.tagName != "osm"):print('Bad File Type')return[/CODE] EDIT: late reply Thank you Both of my friendsbut it not working and i don't know why my Houdini console is not showing in popup Quote Link to comment Share on other sites More sharing options...
anim Posted May 22, 2013 Share Posted May 22, 2013 open Window/Python Source Editor paste this there (hopefully it comes through with correct indents) def go(): import xml.dom.minidom document=""" <osk version="0.6" generator="CGImap 0.1.0" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/"> <bounds minlat="40.7432000" minlon="-73.9897000" maxlat="40.8052000" maxlon="-73.9304000"/> <node id="1420631950" lat="40.7711745" lon="-73.9792204" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631974" lat="40.7716867" lon="-73.9779803" user="Aaron Lidman" uid="53073" visible="true" version="2" changeset="15468871" timestamp="2013-03-23T17:11:31Z"/> <node id="1420631985" lat="40.7694268" lon="-73.9788969" user="dchiles" uid="153669" visible="true" version="1" changeset="9189979" timestamp="2011-09-02T04:12:03Z"/> </osk> """ map = xml.dom.minidom.parseString(document) if (map.documentElement.tagName != "osk"): print('Bad File Type') return[/CODE]press Applythen open Python Shell and type[CODE]hou.session.go()[/CODE]it will execute your function defined in python source editor, it's easier to debug that way than writing everything in shell 1 Quote Link to comment Share on other sites More sharing options...
m0rtezaaghili Posted May 22, 2013 Author Share Posted May 22, 2013 (edited) Thanks Dear Tomas its working, but i have a question, why Houdini console not running for me? edit: houdini console is working perfect!! Edited May 22, 2013 by m0rtezaaghili Quote Link to comment Share on other sites More sharing options...
anim Posted May 22, 2013 Share Posted May 22, 2013 in my experience the Houdini Console don't show up if it has other output available usually while I have Python Shell open all python outputs are shown directly in there or while i was working on Linux they were output to Linux Shell otherwise I didn't have a problem of console not showing up 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.