[Tutor] Next steps...

2014-07-08 Thread Ni Hung
ok, I am now able to write scripts in python. I can read/modify scripts written by others (true to some level). I understand the basics of libraries (how are they different from modules or are the same thing with two names?) like urllib2, json, sys, os etc. and have used them in some scripts.

Re: [Tutor] SyntaxError Message

2014-07-08 Thread Danny Yoo
I have no programming experience and am trying to teaching myself python. Am trying to replicate the code below but I get the error message below highlighted in yellow: We need a little more information. Where does this code come from? What text book or instructional material are you using?

Re: [Tutor] SyntaxError Message

2014-07-08 Thread Danny Yoo
Following up. I can guess that you're looking at: http://www.sthurlow.com/python/lesson05/ But I would like not to guess unless I have no choice. In the future, if you're asking for help, provide context. The reason why it's very useful to say where you're learning from is because we can

Re: [Tutor] Next steps...

2014-07-08 Thread Danny Yoo
On Mon, Jul 7, 2014 at 8:51 PM, Ni Hung niih...@gmail.com wrote: ok, I am now able to write scripts in python. I can read/modify scripts written by others (true to some level). I understand the basics of libraries (how are they different from modules or are the same thing with two names?)

Re: [Tutor] SyntaxError Message

2014-07-08 Thread Dave Angel
Pamela Wightley pamela.wight...@morgij.com.au Wrote in message: This is a text mailing list. So leaving an html message blocks some of us from seeing what you intended. Color and other formatting vanishes for many. Please tell your email program to post in text mode. The problem with

Re: [Tutor] SyntaxError Message

2014-07-08 Thread Alan Gauld
On 08/07/14 02:41, Pamela Wightley wrote: Hi All, I have no programming experience and am trying to teaching myself python. Am trying to replicate the code below but I get the error message below highlighted in yellow: Unfortunately I can't see anything in yellow, probably due to enmail

Re: [Tutor] Next steps...

2014-07-08 Thread Alan Gauld
On 08/07/14 04:51, Ni Hung wrote: libraries (how are they different from modules or are the same thing with two names?) In Python libraries and modules are nearly the same. Libraries are a concept in Python which are realized using modules (or packages). In other languages libraries are

[Tutor] Tkinter resizable menu??

2014-07-08 Thread Albert-Jan Roskam
Hi, I created a small menu with Tkinter. It has two listboxes: a source and a destination box. The user can select files from the source box and 'move' them to the destination box. It now does what I want, except for one thing: when I resize it, the listboxes will not (*will* not, grrr)

Re: [Tutor] Tkinter resizable menu??

2014-07-08 Thread Albert-Jan Roskam
  I added background colors to the various frames to see what's happening. I pasted the code here because it is a bit much (sorry): http://pastebin.com/waeACc4B. Any idea what I am doing wrong in the function createListbox (line 80)? I am using sticky=NESW in the grid() calls.  PS: The

Re: [Tutor] Tkinter resizable menu??

2014-07-08 Thread Peter Otten
Albert-Jan Roskam wrote: I created a small menu with Tkinter. It has two listboxes: a source and a destination box. The user can select files from the source box and 'move' them to the destination box. It now does what I want, except for one thing: when I resize it, the listboxes will not

[Tutor] subprocess.call not formatting date

2014-07-08 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm using Python 2.7.6 on an openSUSE linux system. I'm trying to convert a shell (bash) script to a python script, and everything's worked OK except this. The following line in the shell script btrfs subvolume snapshot /home/bob/A3/documents

Re: [Tutor] subprocess.call not formatting date

2014-07-08 Thread Peter Otten
Bob Williams wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm using Python 2.7.6 on an openSUSE linux system. I'm trying to convert a shell (bash) script to a python script, and everything's worked OK except this. The following line in the shell script btrfs subvolume snapshot

Re: [Tutor] subprocess.call not formatting date

2014-07-08 Thread Emile van Sebille
On 7/8/2014 9:44 AM, Bob Williams wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm using Python 2.7.6 on an openSUSE linux system. I'm trying to convert a shell (bash) script to a python script, and everything's worked OK except this. The following line in the shell script btrfs

Re: [Tutor] subprocess.call not formatting date

2014-07-08 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/07/14 18:12, Peter Otten wrote: I suggest that you calculate the folder name in Python instead: # untested name = datetime.datetime.now().strftime(%y-%m-%d_%H-%M) destpath = os.path.join(/home/bob/A3/docsnaps, name) subprocess.call(

Re: [Tutor] Tkinter resizable menu??

2014-07-08 Thread Alan Gauld
On 08/07/14 16:46, Albert-Jan Roskam wrote: I pasted the code here because it is a bit much (sorry): Too much for me, I gave up without spotting the problem. One thing that did strike me though was that you spend quite a lot of code setting up scrollbars etc on your list boxes. The Tix

[Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-08 Thread Jim Byrnes
I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate I found some examples of using os.system() to get gnome-terminal to open but I can't figure out how then cd to the proper directory in the new terminal.

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-08 Thread Danny Yoo
You might look at: http://askubuntu.com/questions/351582/open-terminal-window-and-execute-python-script-on-startup http://superuser.com/questions/198015/open-gnome-terminal-programmatically-and-execute-commands-after-bashrc-was-execu both which appears relevant to your question. If I

Re: [Tutor] Next steps... :p:

2014-07-08 Thread Paradox
On 07/08/2014 11:51 AM, Ni Hung wrote: What should I do next to advance my knowledge of python? Should I study/use libraries/modules? Which ones? Any other suggestions? Thanks and Regards Nii Oops, replied to sender and not to the list ... Sounds like you are ready to start solving real

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-08 Thread Alan Gauld
On 08/07/14 21:45, Jim Byrnes wrote: I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate Thats almost certainly the wrong approach. Instead of trying to automate what the user does in the terminal replace

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-08 Thread Cameron Simpson
On 08Jul2014 15:45, Jim Byrnes jf_byr...@comcast.net wrote: I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate I found some examples of using os.system() to get gnome-terminal to open but I can't figure

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-08 Thread Steven D'Aprano
On Tue, Jul 08, 2014 at 03:45:42PM -0500, Jim Byrnes wrote: I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate Why not just run /bin/activate directly from Python? os.chdir(the/proper/directory)

[Tutor] Unpacking lists

2014-07-08 Thread Robert Nanney
Hello All, I have the following code. The idea is to have one list that contains all of the items from the different iterable types and maintain the order of the items. Python 2.7.6 |Anaconda 2.0.0 (x86_64)| (default, May 27 2014, 14:58:54) #!/usr/bin/python #list_test2.py list1 = [1, 8, 15]

Re: [Tutor] How can I open and use gnome-terminal from a Python script?

2014-07-08 Thread Cameron Simpson
On 09Jul2014 11:42, Steven D'Aprano st...@pearwood.info wrote: On Tue, Jul 08, 2014 at 03:45:42PM -0500, Jim Byrnes wrote: I would like to automate running virtualenv with a python script by: opening gnome-terminal cd to proper directory run source /bin/activate Why not just run