Timeline for While executing script nothing happens?
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 10, 2019 at 13:05 | answer | added | freerafiki | timeline score: 1 | |
| Jul 10, 2019 at 13:04 | vote | accept | Community Bot | ||
| Jul 10, 2019 at 13:04 | answer | added | David Zemens | timeline score: 3 | |
| Jul 10, 2019 at 13:00 | comment | added | user9664805 | So I should use args.file & args.path later in my program? | |
| Jul 10, 2019 at 13:00 | comment | added | freerafiki | I think you are doing two things at the same time. First you are parsing the command line argument into the ArgumentParser (so they will be in args.file and args.path) but then you are reading sys.argv[1] and sys.argv[2] and not using args anymore. You should choose one of the two methods for reading the parameters! | |
| Jul 10, 2019 at 12:59 | comment | added | David Zemens |
If you give a filename that doesn't exist, this condition (if file == file_name:) will always be false, so the inner code will not execute in that case, no error will occur based on invalid filename.
|
|
| Jul 10, 2019 at 12:58 | comment | added | David Zemens |
if I run this with named arguments like that, then I don't get any errors and the program appears to run successfully. You'll have to excuse me, I'm not creating xml files and formatting, I've commented out that code and only retain a few print statements to ensure the main procedure is running without error.
|
|
| Jul 10, 2019 at 12:54 | comment | added | user9664805 |
python XmlFormat.py -p c:\User\Desktop\test\ -f test.xml
|
|
| Jul 10, 2019 at 12:53 | comment | added | David Zemens | with/without. same error. show us how you're running it. my guess is that you're mis-using ArgumentParser (I'm familiar with, but never actually use this library so I could be mistaken here) | |
| Jul 10, 2019 at 12:52 | comment | added | freerafiki | You should get an error! How are you running it? If you run from command line you can use the python debugger to set a breakpoint and debug it from command line. Otherwise in visual studio you can pass arguments by going to Properties--> Debug as explained here. Maybe this can help debugging it.. | |
| Jul 10, 2019 at 12:51 | comment | added | user9664805 | Do you run it with arguments? | |
| Jul 10, 2019 at 12:50 | comment | added | David Zemens |
When I run this from command line: error: the following arguments are required: -p/--path, -f/--file
|
|
| Jul 10, 2019 at 12:45 | history | asked | user9664805 | CC BY-SA 4.0 |