HeyI'mAmethyst Posted April 30, 2015 Share Posted April 30, 2015 Hello, If anybody has a good knowledge of Python, could anyone help me? What I have made is a song lyric program that prints out the song lyrics to a particular song. What's wrong is that it appears fine in the shell, but in the windows console it closes after 1 second. I have an image: Apologies that it is transparent - it closes so fast I only just managed to get it just before it closed. Here's the file: https://app.box.com/s/ok0qh0p5ho3ej5n5ltq849cjpgf2e25t Any help is greatly appreciated Many thanks P.S at school atm so won't reply until later on in the day Link to comment Share on other sites More sharing options...
Darth Wazawai Posted April 30, 2015 Share Posted April 30, 2015 I think python is less forgiving (like Perl) in version differences... While I don't normally touch deadly snakes, if you look at the last few lines it shows a error directed to your python directory. Also noticed there might be a error at the beginning of the file (possibly the result by the mentioned above) If you get Microsoft's desktop recorder (it's free, forget what it's called) and if you can record at 120 fps (not sure if there is a setting) it'll give you a clear image Signature removed by a wondering ghost Link to comment Share on other sites More sharing options...
HeyI'mAmethyst Posted April 30, 2015 Author Share Posted April 30, 2015 Heh, The technician would be shouting at me if i install anything on school computers. I'll see about recording it when I get home. Link to comment Share on other sites More sharing options...
Nekuroi Posted April 30, 2015 Share Posted April 30, 2015 try out without special characters (´, !, etc) Link to comment Share on other sites More sharing options...
HeyI'mAmethyst Posted May 5, 2015 Author Share Posted May 5, 2015 Yay! Fixed it! :D : D It was due to some punctuation not being recognised by Python, so it refused to print it. It's all fine now! Moderators may lock and archive this now. Link to comment Share on other sites More sharing options...
Darth Wazawai Posted May 5, 2015 Share Posted May 5, 2015 Miniscule error, huge problems... Sounds like raven dlc on trailers lol Signature removed by a wondering ghost Link to comment Share on other sites More sharing options...
zyprexia Posted May 5, 2015 Share Posted May 5, 2015 When I first starting working on a python script I forget to disable to auto indentation of my editor. What idiot though that spacing is a good way specify the begin and end of a scope.. I have to admit that I never run python scripts on a Windows computer. There I use the powershell.. 510 Horses and one lucky bird at work Simulators: Prepar3d V4, X-Plane 11, DCS 1.5 + 2.x, ETS2, ATS, Farming Simulator 17, Omsi 1 + 2 System: Intel i7-6700K @ 4700Mhz, 32GB DDR4 Corsair Vengeance LPX, GTX970, HP LP2475w monitor (1920x1200) Devices: Logitech G27, SKRS Shifter, CH Products Throttle Quadrant, Trustmaster Hotas Joystick, TrackIR Storage: 2 x SM961 - 250GB (raid 0), Samsung 850 pro 1TB disk, Samsung 850 EVO 2TB disk. Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2015 Share Posted May 5, 2015 The issue was that you had a utf-8 encoded quotation mark in your lyric, so removing it is one way, or look at this stackoverflow question detailing the issue and how to work out why it didn't work.The tip was in the screenshot where it errors with: UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 49 A tip when something closes too quickly, shift right click the folder and select "open command window here", then run the script that way. quick edit: Also some general tips for readability instead of using a long string with multiple newlines, use multiple print statements on lines by themselves, that way if there's an error on line 9 in your text, you can go to line 9(or if you have the shebang and a formatting line in the start, 3+9) and fix the error, additionally it would have helped you with tracing down the exact character that was causing issues. Many people uses a coding standard where a line should not exceed more than eg. 90 characters, otherwise you'd need a wide monitor or rely on your editor to linewrap sensibly(which most don't). Yes, it increases the size of your script, but when you get to bigger projects it will save you a lot of headaces trying to find that one bloody place where you forgot to indent correctly, or your editor screwed up. For good editors, look at eg. Atom which is a pretty good, just-enough-frills editor. Also another tip: learn to use git and use it, even for small projects, it'll help you when you introduce a bug in your scripts. Link to comment Share on other sites More sharing options...
Nekuroi Posted May 5, 2015 Share Posted May 5, 2015 Well in theory you would use an external file with a certain format to load the lyrics , not hardcode it in the script. Link to comment Share on other sites More sharing options...
Darth Wazawai Posted May 7, 2015 Share Posted May 7, 2015 Well in theory you would use an external file with a certain format to load the lyrics , not hardcode it in the script. This would work best for multiple songs. However you run into line counting (loop), and each file is a possibility of disaster with the possibility of invalid characters Signature removed by a wondering ghost Link to comment Share on other sites More sharing options...
Guest Posted June 17, 2015 Share Posted June 17, 2015 Inactive topic- archived (If you wish for this topic to be reactivated, send me a pm!) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.