[Tutor] Learning python scripts for practical linux activities.

2015-01-15 Thread dw
Hello,
I'm new the the group and new to programming in Python.
I would like to find a source, book etc of Python learning projects.
Projects that are useful for standard Linux activities like bulk
renaming files, managing repository packages.
Maybe python scripts that incorporate "LAME" for modifying audio files.
Anything of that nature.
As I learn Python, I would like to create Python utilities.
I'm hoping there is some learning material that might lead me in that
direction.
Sincere thanks
d
-- 
 bw...@fastmail.net

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] How to edit value of second column row i-th array in numpy?

2015-01-15 Thread Whees Northbee
If I have array a=[[60,70,1],[43,54,2],[87,67,3],[90,89,4],[12,4,5]] where
[x,y,id] and I want to find if x=87 and y=67, and find which row is it,and
I need to edit the id column with new value..

I can search in first column using:
if (x in a[:,0]):
print('yes')

how I can know index row so I can match if y same value with second column?
And I search in numpy array document there is no function about edit, so
how I can edit the value the third column/id column if I know which row?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Learning python scripts for practical linux activities.

2015-01-15 Thread Alan Gauld

On 15/01/15 14:07, dw wrote:


I would like to find a source, book etc of Python learning projects.
Projects that are useful for standard Linux activities like bulk
renaming files, managing repository packages.
Maybe python scripts that incorporate "LAME" for modifying audio files.
Anything of that nature.


That's kind of the point of my new book "Python Projects"
If you go to Amazon the free preview covers the first chapter
(intro to Python) plus a section of chapter 1 which includes
interacting with the OS.

Other topics included are reading different file formats, Database 
access(dbm,shelve,SQL) UI design(CLI, argparse,cmd and GUI with Tkinter) 
Web dev (with Flask) and testing/debugging.


Its targeted at those who have done a basic intro to python and
want to go further and start their own projects.

Have a look at the preview it might suit you.

Sorry for the shameless plug but it does look like a fit.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
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] Learning python scripts for practical linux activities.

2015-01-15 Thread Emile van Sebille

On 1/15/2015 6:07 AM, dw wrote:

Hello,
I'm new the the group and new to programming in Python.
I would like to find a source, book etc of Python learning projects.
Projects that are useful for standard Linux activities like bulk
renaming files, managing repository packages.
Maybe python scripts that incorporate "LAME" for modifying audio files.
Anything of that nature.
As I learn Python, I would like to create Python utilities.
I'm hoping there is some learning material that might lead me in that
direction.
Sincere thanks
d



Check out http://it-ebooks.info/book/172/

Emile


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to edit value of second column row i-th array in numpy?

2015-01-15 Thread Peter Otten
Whees Northbee wrote:

> If I have array a=[[60,70,1],[43,54,2],[87,67,3],[90,89,4],[12,4,5]] where
> [x,y,id] and I want to find if x=87 and y=67, and find which row is it,and
> I need to edit the id column with new value..
> 
> I can search in first column using:
> if (x in a[:,0]):
> print('yes')
> 
> how I can know index row so I can match if y same value with second
> column? 

I needed some google hand-holding for this, so no warranties:

>>> import numpy as np
>>> a = np.array([[60,70,1],[43,54,2],[87,67,3],[87,89,4],[12,4,5]])
>>> a[:,:2] == [87,67]
array([[False, False],
   [False, False],
   [ True,  True],
   [ True, False],
   [False, False]], dtype=bool)
>>> (a[:,:2] == [87,67]).all(axis=1)
array([False, False,  True, False, False], dtype=bool)
>>> np.where((a[:,:2] == [87,67]).all(axis=1))
(array([2]),)

> And I search in numpy array document there is no function about
> edit, so how I can edit the value the third column/id column if I know
> which row? 

Easy:

>>> a[2,2] = 123456
>>> a
array([[60, 70,  1],
   [43, 54,  2],
   [87, 67, 123456],
   [87, 89,  4],
   [12,  4,  5]])


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Alan's book - was "Learning python scripts for practical linux activities."

2015-01-15 Thread David Heiser


Thanks for the Shameless Plug, Alan.

I went to Amazon, scanned through your book, and learned some things 
about "sets" that will help me in my job.


Bought the Kindle version. Great stuff.


On 1/15/2015 8:53 AM, Alan Gauld wrote:

On 15/01/15 14:07, dw wrote:


I would like to find a source, book etc of Python learning projects.
Projects that are useful for standard Linux activities like bulk
renaming files, managing repository packages.
Maybe python scripts that incorporate "LAME" for modifying audio files.
Anything of that nature.


That's kind of the point of my new book "Python Projects"
If you go to Amazon the free preview covers the first chapter
(intro to Python) plus a section of chapter 1 which includes
interacting with the OS.

Other topics included are reading different file formats, Database 
access(dbm,shelve,SQL) UI design(CLI, argparse,cmd and GUI with 
Tkinter) Web dev (with Flask) and testing/debugging.


Its targeted at those who have done a basic intro to python and
want to go further and start their own projects.

Have a look at the preview it might suit you.

Sorry for the shameless plug but it does look like a fit.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] PyDeadObjectError: MainFrame deleted

2015-01-15 Thread Paul LaBerge
Steven, Danny, and Ben,

Thanks for the help identifying the source of the crash and how to read the 
traceback, exception, paths, and search for errors. Very helpful since I’m 
quite new to Python programming. I'll send details to opendaq, and ask on the 
wxpython forum to see if they know what causes this. 

The GUI is open source from the opendaq folks, available on PYPI, and as 
surmised is tied to their commercial data acquisition hardware. They’re good 
about responding, so expect they’ll fix it. 

> I don't know whether this indicates corruption in the library which 
> will be fixed by reinstalling, a bug in the library, or just a bug in 
> your own code.


I tried reinstalling wxpython but the error persisted. Thanks for places to 
look. 

> (Also, because I happen to know that the wxPython GUI is written in C++ 
> so any C++ errors are from it, not the Python interpreter.)


Have you worked on easy_daq or did you download the GUI ?

Cheers,

Paul


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PyDeadObjectError: MainFrame deleted

2015-01-15 Thread Steven D'Aprano
On Thu, Jan 15, 2015 at 10:42:35AM -0800, Paul LaBerge wrote:

> > (Also, because I happen to know that the wxPython GUI is written in C++ 
> > so any C++ errors are from it, not the Python interpreter.)
> 
> Have you worked on easy_daq or did you download the GUI ?

Neither. I just know that wxPython is a Python wrapper around a C++ 
GUI toolkit, wxWidgets. Never used it though.


-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PyDeadObjectError: MainFrame deleted

2015-01-15 Thread Paul LaBerge
Good to know.
Thanks again for the help.

Paul


> On Jan 15, 2015, at 3:43 PM, Steven D'Aprano  wrote:
> 
> On Thu, Jan 15, 2015 at 10:42:35AM -0800, Paul LaBerge wrote:
> 
>>> (Also, because I happen to know that the wxPython GUI is written in C++ 
>>> so any C++ errors are from it, not the Python interpreter.)
>> 
>> Have you worked on easy_daq or did you download the GUI ?
> 
> Neither. I just know that wxPython is a Python wrapper around a C++ 
> GUI toolkit, wxWidgets. Never used it though.
> 
> 
> -- 
> Steve
> ___
> 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