Re: [Tutor] Help Noob Question
On 03/28/2014 02:17 AM, Alan Gauld wrote: On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com mailto:alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed by `cd PythonProjects`… Because the desktop is hardly ever anywhere near where the cmd prompt lands you. So cd desktop usually results in an error and typing the full path (even with directory completion, Mark) is a royal pain because you have to remember where it is. There is no ~ shortcut in Windows. On my system that means typing something like: C:\Documents and Settings\alang\Desktop Can't you make a symlink pointing to Desktop? (in C:\ or anywhere else) or some such nonsense, complete with spaces in the path that add to the pain. Now I probably could use something like cd %HOMEPATH% to get to what Windows laughingly considers my 'home' directory and then find it from there but even so its not always obvious depending on the windows version and the install options used. And of course if the file happens to be on the all users Desktop looking in my local Desktop doesn't help. I find it much easier to know where my Python code lives from wherever I happen to find myself in the labrynthian file system that is Windows. Well, all filesystems are labyrinthians, AFAIK (at least, for people like me who cannot learn by heart). I never know where things are are, in my box (Linux), apart from my own home. d ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 28/03/2014 01:17, Alan Gauld wrote: On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com mailto:alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed by `cd PythonProjects`… Because the desktop is hardly ever anywhere near where the cmd prompt lands you. So cd desktop usually results in an error and typing the full path (even with directory completion, Mark) is a royal pain because you have to remember where it is. There is no ~ shortcut in Windows. The point is you type it once and then rerun the command from the run prompt. How can anything be easier? On my system that means typing something like: C:\Documents and Settings\alang\Desktop or some such nonsense, complete with spaces in the path that add to the pain. Now I probably could use something like cd %HOMEPATH% to get to what Windows laughingly considers my 'home' directory and then find it from there but even so its not always obvious depending on the windows version and the install options used. And of course if the file happens to be on the all users Desktop looking in my local Desktop doesn't help. I find it much easier to know where my Python code lives from wherever I happen to find myself in the labrynthian file system that is Windows. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 28/03/14 09:28, spir wrote: On 03/28/2014 02:17 AM, Alan Gauld wrote: you have to remember where it is. There is no ~ shortcut in Windows. On my system that means typing something like: C:\Documents and Settings\alang\Desktop Can't you make a symlink pointing to Desktop? (in C:\ or anywhere else) You could, and that would help a little. But the problem on Windows is that what appears on the Desktop *display* is an amalgam of (up to 3?) different folders in the file system. So just because you see an icon on the 'desktop' doesn't mean you actually know which folder it is in. Secondly this correlation between desktop folder and desktop display means that's a bad place to store python files since every file you create will add to the clutter of icons on your display. In my python projects file I have over 100 small test files. That would be a lot of icons messing up my screen. So because of a combination of: a) path complexity, b) the disconnect between display and physical location and c) the correlation between files and displayed icons I recommend not using the desktop to store python files. Of course everyone is free to ignore this recommendation, it's just my experience/opinion. :-) Well, all filesystems are labyrinthians Yes but Windows is much more so because of the disconnect between how it displays things in visual tools and how it stores things on the disk (and the fact that it has multiple disks often with partially duplicated file structures!) Very few things wind up in one place only. For a user, this is ameliorated by the use of Libraries to group folders with similar content, but they only serve to make life even harder for the programmer! [Even worse is the iPad with its insistance on storing files with the app that last worked on them. A moving target indeed, even assuming you can find the files in the first place. Stupid decision.] -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On Fri, Mar 28, 2014 at 2:17 AM, Alan Gauld alan.ga...@btinternet.com wrote: On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed by `cd PythonProjects`… Because the desktop is hardly ever anywhere near where the cmd prompt lands you. I just tested on my Windows 7 box. It got me to C:\Users\Kwpolska. `cd Desktop` is enough. I also tested on a third-party’s XP box. C:\Documents and Settings\[username]. `cd Desktop`, too (though it’s locale-dependent). Does not look far from the desktop, does it? Well, the only places where this might not work are Administrator prompts in Vista-and-newer (which there is NO REAL REASON to use for Python) — or possibly some ultra-crazy corporate environments (but you should not be learning Python there — and if you are working there, you know how to work with the command line/Windows/source control already). Or, of course, systems where you changed something and it is not your profile directory — but it’s your doing. So, it’s pretty much the home directory everywhere you should be concerned with. you have to remember where it is. There is no ~ shortcut in Windows. On my system that means typing something like: C:\Documents and Settings\alang\Desktop or just cd %USERPROFILE%. Different drives would make you jump to %HOMEDRIVE% and then to %HOMEPATH%. Can't you make a symlink pointing to Desktop? (in C:\ or anywhere else) You could, and that would help a little. But the problem on Windows is that what appears on the Desktop *display* is an amalgam of (up to 3?) different folders in the file system. So just because you see an icon on the 'desktop' doesn't mean you actually know which folder it is in. But, for user-created files, it always goes to %USERPROFILE%/Desktop. Secondly this correlation between desktop folder and desktop display means that's a bad place to store python files since every file you create will add to the clutter of icons on your display. In my python projects file I have over 100 small test files. That would be a lot of icons messing up my screen. Create a folder on the desktop, or even in the home directory. A much nicer place than the drive root — and a much modern way to store it (drive root sounds DOS-y) -- Chris “Kwpolska” Warrick http://kwpolska.tk PGP: 5EAAEA16 stop html mail | always bottom-post | only UTF-8 makes sense ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
Hi Leo, On 27 March 2014 08:43, Leo Nardo waterfallr...@gmail.com wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure out how to open it in the interpreter. Invalid syntax is the error message when i type in python string1.py into the interpreter! maybe a dumb question but i would appreciate the help for sure. thanks :) I know a lot's been said already, but nothwithstanding, here's my answer to your question(s): You need to type python string1.py into a Windows command prompt, not directly into a running Python interpreter. For that command to work as shown, at least 2 things need to be true: 1) The Python interpreter (python.exe) must be on the system PATH (so the operating system will be able to locate it) 2) The file string1.py must be in the Current Directory (folder) of the Windows command prompt. This is the path location displayed in the prompt to the left of the cursor. A simple way to open a command prompt with the current directory set to a known location, is to open a Windows file explorer window, then browse to the folder you'd like a command prompt in, then overtype the address in the explorer window with cmd and press Enter. This little feature makes it trivial to open command prompts in any chosen folder as needed. (Note: This feature is only available in Windows 7 and higher.) Walter ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
* Chris “Kwpolska” Warrick kwpol...@gmail.com [2014-03-28 16:27]: Create a folder on the desktop, or even in the home directory. A much nicer place than the drive root — and a much modern way to store it (drive root sounds DOS-y) I'll have to disagree with this statement. Dropping all your files in you Desktop directory puts all the files ON the Desktop, which quickly becomes a mess. Regardless of whether it's a new directory at the base, or a new directory under your User directory, you should at least have a dedicated directory to put the files. I'm not discussing the merits of one place over the other, just that simple organization is a good thing. Put it wherever you want, but at least keep it organized. Dropping everything in Desktop is not organized. -- David Rock da...@graniteweb.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 28/03/14 15:27, Chris “Kwpolska” Warrick wrote: On Fri, Mar 28, 2014 at 2:17 AM, Alan Gauld alan.ga...@btinternet.com wrote: Because the desktop is hardly ever anywhere near where the cmd prompt lands you. I just tested on my Windows 7 box. It got me to C:\Users\Kwpolska. `cd Desktop` is enough. I also tested on a third-party’s XP box. C:\Documents and Settings\[username]. `cd Desktop`, too (though it’s locale-dependent). Does not look far from the desktop, does it? True when you first open the DOS box, but not after you've been using it for a while. I usually find I've moved around several folders and even several disks. Python) — or possibly some ultra-crazy corporate environments (but you should not be learning Python there — and if you are working there, you know how to work with the command line/Windows/source control already). Both are true for me, and a large part of why I wouldn't put stuff on the desktop. For example my desktop was made up of my personal desktop, the PC all-user desktop and the corporate shared desktop (only when connected to the corporate network). Knowing which files/icons belonged to which location was a nightmare. or just cd %USERPROFILE%. Different drives would make you jump to %HOMEDRIVE% and then to %HOMEPATH%. Which is true for files I create but not for other users of the PC or for shared desktops. And its still a lot to type compared to Unix (~) or using a drive root. Can't you make a symlink pointing to Desktop? (in C:\ or anywhere else) You could, and that would help a little. But the problem on Windows is that what appears on the Desktop *display* is an amalgam of (up to 3?) different folders in the file system. So just because you see an icon on the 'desktop' doesn't mean you actually know which folder it is in. But, for user-created files, it always goes to %USERPROFILE%/Desktop. But which user? It may not be me that created the file. And I may have deliberately copied/saved it to one of the shared desktops a long time ago and forgotten. Create a folder on the desktop, or even in the home directory. I agree a folder is more sensible and avoids the icon overkill but the OP specifically had his *file* on the desktop. nicer place than the drive root — and a much modern way to store it (drive root sounds DOS-y) I accept that but its still the shortest absolute path to type on Windows! And if you are a programmer typing is what you wind up doing a lot of! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
Hello, What do you mean by open it in the interpreter? Do you want to open it and read from it its content? or do you want to execute its python code within the interpreter? Best 2014-03-27 7:43 GMT+01:00 Leo Nardo waterfallr...@gmail.com: Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure out how to open it in the interpreter. Invalid syntax is the error message when i type in python string1.py into the interpreter! maybe a dumb question but i would appreciate the help for sure. thanks :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 27/03/2014 08:55, David Palao wrote: Hello, What do you mean by open it in the interpreter? Do you want to open it and read from it its content? or do you want to execute its python code within the interpreter? Best 2014-03-27 7:43 GMT+01:00 Leo Nardo waterfallr...@gmail.com: Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure out how to open it in the interpreter. Invalid syntax is the error message when i type in python string1.py into the interpreter! maybe a dumb question but i would appreciate the help for sure. thanks :) Please don't top post on this list. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
Leo Nardo waterfallr...@gmail.com writes: Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. It's not clear what you want. What does it mean to you for a Python program to be “open in the interpreter”? You have opened the file in a text editor, which is fine; the editor presents the file contents for you to edit and save. There isn't really an equivalent with the Python interactive interpreter. It takes its input from you typing at the console. Do you mean “import the module”? That executes the module and makes it available in a distinct namespace. But it doesn't seem to be quite what you're asking. Do you mean “run the module as a program”? That is done *non*-interactively, so you don't do it at the interactive Python interpreter. Instead, you do it by issuing a command at your operating system's command prompt. I already have it open in notepad, but for the life of me cannot figure out how to open it in the interpreter. Welcome to the forum :-) Hopefully you can make clearer what it is you want to do. -- \“Intellectual property is to the 21st century what the slave | `\ trade was to the 16th.” —David Mertz | _o__) | Ben Finney ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
Leo Nardo waterfallr...@gmail.com Wrote in message Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure out how to open it in the interpreter. Invalid syntax is the error message when i type in python string1.py into the interpreter! maybe a dumb question but i would appreciate the help for sure. thanks :) . (Please post in text mode, not html. Sometimes html is a pain on a text mailing list like this one. ) I'm assuming you're asking how to *run* your string1.py script. First you need a shell prompt. For Windows, that's cmd.exe, which you usually get by opening a DOS box. Then at the cmd prompt, you type python string1.py That will start the interpreter, import the script, run the script, and exit the interpreter. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. Instead create a folder at the top level of a disk - if you have a D drive then D:\PythonProjects or some such name. Move your file into that folder Then you can start a CMD shell window by hitting Windows-R and typing cmd into the dialog that opens. That should open a CMD shell(aka DOS box) with a prompt like: C:\WINDOWS or similar At that prompt type python D:\PythonProjects\string1.py And your file should run, display any output (or errors) and stop. error message when i type in python string1.py into the interpreter! You never type 'python' into the Python interpreter. You run python propgrams by typing 'python progmname.py' into your Operating system shell(CMD.exe on windows) You can also run them by double clicking the file in Windows explorer but that often results in a DOS box opening, the code running and the DOS box closing again too fast for you to see anything. So opening the DOS box in advance as described above is usually better. Get used to using the OS command line, programmers tend to use it a lot. (In fact you might want to create a shortcut on your desktop/start screen to open it...) :-) HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed by `cd PythonProjects`… -- Chris “Kwpolska” Warrick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 27/03/2014 19:56, Alan Gauld wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. I disagree with this. From the run prompt I use cmd /F:ON /T:02 /K cd your\code\path /F:ON Enable file and directory name completion characters /T:fg Sets the foreground/background colors /K Carries out the command specified by string -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Noob Question
On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com mailto:alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed by `cd PythonProjects`… Because the desktop is hardly ever anywhere near where the cmd prompt lands you. So cd desktop usually results in an error and typing the full path (even with directory completion, Mark) is a royal pain because you have to remember where it is. There is no ~ shortcut in Windows. On my system that means typing something like: C:\Documents and Settings\alang\Desktop or some such nonsense, complete with spaces in the path that add to the pain. Now I probably could use something like cd %HOMEPATH% to get to what Windows laughingly considers my 'home' directory and then find it from there but even so its not always obvious depending on the windows version and the install options used. And of course if the file happens to be on the all users Desktop looking in my local Desktop doesn't help. I find it much easier to know where my Python code lives from wherever I happen to find myself in the labrynthian file system that is Windows. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor