Re: [Tutor] EXE Problem
Do Win+R type: cmd hit enter. in the opened cmd write cd C:/where/you/have/the/exe (you can move it to C: for simplicity) and run it from there it will not close this time, and you can see the debugging info. Enjoy. On 06/19/2013 08:50 AM, Jack Little wrote: I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On Wed, Jun 19, 2013 at 6:58 PM, Alan Gauld alan.ga...@btinternet.com wrote: On 19/06/13 17:41, Jim Mooney wrote: you should use forward slashes. I have no idea why Bill Gates thought backslashes were kewl Because MS DOS was copying CP/M which didn't have directory paths (it was used with 180K floppy disks that stored everything at the top level) but did have command options that were indicated by a forward slash DIR /S was a sorted directory listing etc. So MS DOS inherited / as an options marker which precluded it's later use as a path separator... CP/M didn't have a hierarchical file system, but it did have up to 16 USER areas. As to / switches, maybe at some point someone confused CP/M with DEC's TOPS-10, which used switches quite a lot (it even had SWITCH.INI for defaults). TOPS-10 would have been familiar to many 1970s programmers. Its DIR command had over 70 switches, such as /SORT (default) and /NOSORT. In contrast, DIR on CP/M used options in square brackets, such as the following example: DIR [DRIVE=B,USER=ALL,EXCLUDE,NOSORT] *.DAT This would list all files on B: in all USER areas exluding DAT files, without sorting. The USER areas in CP/M are reminiscent of TOPS-10 user-file directories. A UFD was designated by a [project, programmer] number (PPN), and could have up to 5 levels of sub-file directories (SFD). For example, DSKB:FOO.TXT[14,5,BAR,BAZ], where 14,5 is a PPN. In VMS style it's DSKB:[USER.BAR.BAZ]FOO.TXT. In comparison, slash vs. backslash seems trivial. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On 22/06/13 16:58, eryksun wrote: In contrast, DIR on CP/M used options in square brackets, such as the following example: DIR [DRIVE=B,USER=ALL,EXCLUDE,NOSORT] *.DAT You are right, CP/M did use square brackets for flags, I'd forgotten those. But it did have some / switches too. (or at least CP/M 3 (aka CP/M plus), which was the only version I used, did.) So, my example of DIR /S was wrong. But I got the concept from my old CP/M programming manual which says... A mbasic5 /m:hc000 Which tells mbasic to protect memory location hc000... But mbasic isn't really part of CP/M it was a BASIC interpreter written by Microsoft! So maybe DOS got its / flags because they were already using them for their BASIC... The USER areas in CP/M Weren't USER areas a late introduction to CP/M? (Version 3 again I think...) But I agree very similar to the DEC setup. But then most of the early OS developers were working on DEC kit back then, DEC had most of the research hardware market sown up in the '70s. CP/M came from Dartmouth Navy Labs, Unix from Bell labs, Microsoft from Harvard(very indirectly). Anyways, apologies for my earlier misinformation - the old grey cells are a little older than they used to be! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] EXE Problem
I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On 06/19/2013 02:50 AM, Jack Little wrote: I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes. It compiles when you run it, so it's not clear what extra step you're describing here. Quite a bit of missing information here, so let's do some guessing. You're running some version of Windows? You're running Python 3.3 ? You're launching what you think is a useful program, directly from Explorer, using double-click, or with right-click-OpenWith ?? Python programs don't have an EXE extension, so perhaps you're not actually double clicking on the right thing. Or perhaps you've neglected to change Windows brain-dead default of NOT showing file extensions in Explorer. When a non-GUI program starts from Explorer, Windows helpfully creates a command window, then helpfully destroys it before you can read the results if any. If you know your program is correct, and you just want to see the output, you'll need to put some form of pause at the end of your program. This could be a sleep(3) if you're a speed reader, or it could be just an input() statement. But if the program is flawed, such as a syntax error, you might never reach the pause. So you might as well get used to the following: Run your program at a cmd prompt, inside a DOS Box, or Command Window, or one of several other names used in various Windows versions. It's actually a shell, but Windows doesn't use that term. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On 18 June 2013 23:50, Jack Little jacklittl...@yahoo.com wrote: I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes. I suspicion someone as new to Python, since I am, who is using Windows and getting the annoying Windows Flash ;') So in Detail: Go to the Windows entry box on lower left type cmd for the DOS box hit Enter type python followed by the full path to your program. For instance, I would type: python c:/python33/jimprogs/sympystuff.py and hit Enter to see the printout of a program that illustrates a quadratic equation. Note that after you type python, the input file is to the python interpreter, which Doesn't need those nasty Windows backslashes, so you should use forward slashes. I have no idea why Bill Gates thought backslashes were kewl - maybe he has a really long right little finger. Or he was trying to pretend DOS was a better variant of Unix (hahahahahahahahahaha) Then you should see the result, or your syntax errors. Which you already did if you put pause at the bottom of your program. But this eliminates the need to keep doing that. After you see that, exit() from python back to the DOS box, then simply type python, and you get the interactive python interpreter, where you can fool around with basic python. You also get to see your syntax errors realtime, rather than the annoying DOS Flash. If you're not familiar with DOS, check out basic DOS commands on Google - you may need them. Us old fogeys, and hardcore programmers, know DOS, but I don't assume others do in a GUI-world But putting input() right after your program is easiest. As for sleep, as Dave mentioned, in case you didn't get to module imports, create a simple program like this: import time time.sleep(3) Or if you want to see more than a blank screen and wonder if sleep is working: import time print('time to go to sleep') time.sleep(5) print('darn alarm clock') One can later use IDLE or Wing 101 for more complex programs (google them), but it really is good to know how to use DOS first. And if you're not using Windows, all this typing will be useful to someone else. But Bayesian inference tells me you most likely are ;') Jim Sci-fi novel in one line: Congratulations miss, you have twins - but one is dark matter. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On 19/06/13 17:41, Jim Mooney wrote: you should use forward slashes. I have no idea why Bill Gates thought backslashes were kewl Because MS DOS was copying CP/M which didn't have directory paths (it was used with 180K floppy disks that stored everything at the top level) but did have command options that were indicated by a forward slash DIR /S was a sorted directory listing etc. So MS DOS inherited / as an options marker which precluded it's later use as a path separator... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On 06/19/2013 06:58 PM, Alan Gauld wrote: On 19/06/13 17:41, Jim Mooney wrote: you should use forward slashes. I have no idea why Bill Gates thought backslashes were kewl Because MS DOS was copying CP/M which didn't have directory paths (it was used with 180K floppy disks that stored everything at the top level) but did have command options that were indicated by a forward slash DIR /S was a sorted directory listing etc. So MS DOS inherited / as an options marker which precluded it's later use as a path separator... MSDOS 2, which introduced subdirectories, also had a function to change the switch character. You could change it to - for example, and use / for a subdirectory delimiter. But most programs (including many of Microsoft's own) ignored the feature, The operating system itself always supported both / and \, but not some utilities like maybe DIR. Also in those days, the head of the MSDOS architecture considered himself in competition with the head of XENIX (Unix) architecture. So he resisted things that might have helped compatibility. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] EXE Problem
On 06/19/2013 06:58 PM, Alan Gauld wrote: On 19/06/13 17:41, Jim Mooney wrote: you should use forward slashes. I have no idea why Bill Gates thought backslashes were kewl Because MS DOS was copying CP/M which didn't have directory paths (it was used with 180K floppy disks that stored everything at the top level) but did have command options that were indicated by a forward slash DIR /S was a sorted directory listing etc. This is straining my memory of Windows, but I think /S meant subdirectory so a listing will include subdirectories of the specified starting point. The /od switch would sort by date, (I think), and the /P switch would paginate the output (like the earliest primitive forms of 'more'). -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor