Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Cameron Simpson
Hi Bob, I notice your problem is solved, but I've got a few remarks about your script and also how you might have investigated your problem. First: the os.foo calls are usually very thin wrappers for the corresponding OS call. So if you get an errno type error for os.symlink, it is worth

Re: [Tutor] subprocess.call list vs. str argument

2014-02-26 Thread Albert-Jan Roskam
Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?

Re: [Tutor] Responding Tweet: A Twitter Bot

2014-02-26 Thread Zaki Akhmad
On Fri, Feb 21, 2014 at 4:05 PM, Walter Prins wpr...@gmail.com wrote: With the caveat that I'm not familiar with the Twitter streaming API's and that I literally only spend 3 minutes googling this, it seems to me to be the case that the Twitter streaming API's is intended to be a push style

[Tutor] next element in list

2014-02-26 Thread rahmad akbar
hey guys i have this file i wish to parse, the file looks something like bellow. there are only four entry here (AaaI, AacLI, AaeI, AagI). the complete file contains thousands of entries =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= REBASE, The Restriction Enzyme

Re: [Tutor] next element in list

2014-02-26 Thread Dave Angel
rahmad akbar matbioi...@gmail.com Wrote in message: then i realized i couldn't do something like .next() to the var in_file which is a list. so i added a flag start = False in which will be turned to True upon 'Rich Roberts' found. is the any simpler way to move to the next element in the

Re: [Tutor] calling global in funtions.

2014-02-26 Thread Dave Angel
Santosh Kumar rhce@gmail.com Wrote in message: Requirement : i want to call a variable assigned outside a function scope anytime within the function. I read global is a way. Your sample code doesn't do any calling. But if your design requires you to assign to a global from inside

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread David
On 26 February 2014 16:31, Cameron Simpson c...@zip.com.au wrote: You need to know that ENOENT is errno 2 No such file or directory, but it helps. In case it helps anyone, there is information in the python documentation of the errno module that associates system error numbers with their

Re: [Tutor] next element in list

2014-02-26 Thread Peter Otten
rahmad akbar wrote: hey guys i have this file i wish to parse, the file looks something like bellow. there are only four entry here (AaaI, AacLI, AaeI, AagI). the complete file contains thousands of entries =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Re: [Tutor] next element in list

2014-02-26 Thread rahmad akbar
David, Peter roger that and thanks so much!! On Wed, Feb 26, 2014 at 1:29 PM, Peter Otten __pete...@web.de wrote: rahmad akbar wrote: hey guys i have this file i wish to parse, the file looks something like bellow. there are only four entry here (AaaI, AacLI, AaeI, AagI). the

Re: [Tutor] subprocess.call list vs. str argument

2014-02-26 Thread eryksun
On Wed, Feb 26, 2014 at 3:50 AM, Albert-Jan Roskam fo...@yahoo.com wrote: On Tue, Feb 25, 2014 at 4:54 PM, Dave Angel da...@davea.name wrote: CreateProcess has its own design bobbles as well. For example, if you forget to put quotes around the program name, it will happily try to add .exe to

Re: [Tutor] viewkeys,viewvalues,viewitems : Use Cases

2014-02-26 Thread Alan Gauld
On 26/02/14 07:04, Santosh Kumar wrote: I defined a dictionary a below. In [14]: a = {'a':1,'b':2,'c':3} ... Funtion associated with dictionaries. In [11]: print a.viewkeys() dict_keys(['a', 'c', 'b']) In [12]: print a.viewvalues() dict_values([1, 3, 2]) In [13]: print a.viewitems()

Re: [Tutor] calling global in funtions.

2014-02-26 Thread Alan Gauld
On 26/02/14 07:12, Santosh Kumar wrote: All, Requirement : i want to call a variable assigned outside a function scope anytime within the function. call in Python means something very specific, namey that you put parens after the name and that hopefully results in some code being executed.

Re: [Tutor] calling global in funtions.

2014-02-26 Thread Steven D'Aprano
On Wed, Feb 26, 2014 at 12:42:00PM +0530, Santosh Kumar wrote: All, Requirement : i want to call a variable assigned outside a function scope anytime within the function. I read global is a way. You can *read* the value of a global from inside a function without needing to declare it at any

Re: [Tutor] When to use multiprocessing Managers?

2014-02-26 Thread David Palao
2014-02-25 11:52 GMT+01:00 James Chapman ja...@uplinkzero.com: Hello tutors I'm curious about managers and when to use them. For example, I see they offer a Queue() for sharing a Q between processes, but if I create a Q in the parent process and pass it down to child processes, then they can

Re: [Tutor] subprocess.call list vs. str argument

2014-02-26 Thread Oscar Benjamin
On 26 February 2014 08:50, Albert-Jan Roskam fo...@yahoo.com wrote: Yesterday evening (it was *late* so forgive me if I wrong) I realized that part of my confusion was also caused by the fact that I ran my code in Idle. If I called subprocess.call with a list argument, it returned code 0

Re: [Tutor] calling global in funtions.

2014-02-26 Thread eryksun
On Wed, Feb 26, 2014 at 8:45 AM, Steven D'Aprano st...@pearwood.info wrote: input:4: SyntaxWarning: name 'a' is assigned to before global declaration This is just a warning. It is STRONGLY RECOMMENDED that you put the global declaration at the top of the function, but it is not compulsary. If

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Cameron, Many thanks for your helpful comments. I do still have some problems with my script, but it's probably better to start a new thread with an appropriate subject. I'm a bit new to Python, so it still seems like magic sometimes (someone

[Tutor] Editing values from a dictionary

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi List, I have two problems, but it's possible that one solution will suffice. I am using a module called mutagen to extract audio metadata from .flac files. The output of mutagen is in the form of a dictionary, so In [1]: import mutagen.flac In

Re: [Tutor] Editing values from a dictionary

2014-02-26 Thread Ben Finney
Bob Williams li...@barrowhillfarm.org.uk writes: In [3]: print metadata[artist] [u'The Incredible String Band'] I now want to pass that string to another program, but I want to strip off the leading [u' and the trailing ']. You may be assuming that ‘metadata[artist]’ is a text string; I

Re: [Tutor] Editing values from a dictionary

2014-02-26 Thread Krishnan Shankar
Hi Bob, In [3]: print metadata[artist] [u'The Incredible String Band'] Here u' and ' is not something you can strip off as it is part of python datatype called UNICODE. Python prints a word or sentence in double or singles quotes when it is a STRING or UNICODE in interpreter. These are python

Re: [Tutor] Editing values from a dictionary

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26/02/14 17:29, Ben Finney wrote: Bob Williams li...@barrowhillfarm.org.uk writes: In [3]: print metadata[artist] [u'The Incredible String Band'] I now want to pass that string to another program, but I want to strip off the leading [u' and

Re: [Tutor] calling global in funtions.

2014-02-26 Thread Santosh Kumar
Thank you all. I understood the global function now. On Wed, Feb 26, 2014 at 7:42 PM, eryksun eryk...@gmail.com wrote: On Wed, Feb 26, 2014 at 8:45 AM, Steven D'Aprano st...@pearwood.info wrote: input:4: SyntaxWarning: name 'a' is assigned to before global declaration This is just a

Re: [Tutor] viewkeys,viewvalues,viewitems : Use Cases

2014-02-26 Thread Santosh Kumar
I want to understand about where to use , viewkeys() viewvalues() viewitems() Thanks, santosh On Wed, Feb 26, 2014 at 6:59 PM, Alan Gauld alan.ga...@btinternet.comwrote: On 26/02/14 07:04, Santosh Kumar wrote: I defined a dictionary a below. In [14]: a = {'a':1,'b':2,'c':3} ...

Re: [Tutor] viewkeys,viewvalues,viewitems : Use Cases

2014-02-26 Thread Dave Angel
Santosh Kumar rhce@gmail.com Wrote in message: want to understand about where to use , viewkeys() viewvalues() viewitems() .. Sometimes you want to loop through a dict, doing something with each of the items. For example you want to generate a report. Suppose you have a

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Dave Angel
Bob Williams li...@barrowhillfarm.org.uk Wrote in message: linkName1 = pathList[j][0:-3] + mp3 Isn't this exactly the same as pathList[j] ? Actually, no. pathList[j] can contain either .mp3 files or .flac files. In fact the main function of the script is to run all the flacs through

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26/02/14 15:41, Bob Williams wrote: On 26/02/14 05:31, Cameron Simpson wrote: linkName1 = pathList[j][0:-3] + mp3 Isn't this exactly the same as pathList[j] ? Actually, no. Actually, you are right. I've trimmed down that block now, thank

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Cameron Simpson
On 26Feb2014 15:41, Bob Williams li...@barrowhillfarm.org.uk wrote: Many thanks for your helpful comments. I do still have some problems with my script, but it's probably better to start a new thread with an appropriate subject. Very true. I'm a bit new to Python, so it still seems like

Re: [Tutor] Editing values from a dictionary

2014-02-26 Thread Steven D'Aprano
On Wed, Feb 26, 2014 at 05:09:49PM +, Bob Williams wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi List, I have two problems, but it's possible that one solution will suffice. I am using a module called mutagen to extract audio metadata from .flac files. The output of mutagen

[Tutor] OT: supporting Python the PSF with a half/quarter-page ad?

2014-02-26 Thread wesley chun
Hey everyone, This is somewhat off-topic for this list, but if you've gotten a lot out of Python and want to contribute, the Python Software Foundation is advocating for the language by creating and distributing a brochurehttp://brochure.getpython.info/that talks all about the goodness of Python.