Re: [Tutor] script guidance

2017-10-23 Thread Peter Otten
renukesh nk wrote: > i want to download zip files from website , my script first lists all the > url links to a text file and then fetches each url and tries to download > zip files. > > > but i am getting error as below: > Running script.. > https://sagamusix.dehttps:// > sagamusix.de/other/Sag

[Tutor] script guidance

2017-10-23 Thread renukesh nk
i want to download zip files from website , my script first lists all the url links to a text file and then fetches each url and tries to download zip files. but i am getting error as below: Running script.. https://sagamusix.dehttps:// sagamusix.de/other/Saga%20Musix%20-%20Colors%20of%20Synth1%2

Re: [Tutor] script guidelines

2017-10-06 Thread Steven D'Aprano
On Fri, Oct 06, 2017 at 03:37:36PM +0530, renukesh nk wrote: > currently m using pycharm , interpreter = python 3.6 > i am getting th error as below, what might be the reason for this. > > UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 159: > character maps to When you ge

Re: [Tutor] script guidelines

2017-10-06 Thread Alan Gauld via Tutor
On 06/10/17 11:07, renukesh nk wrote: > currently m using pycharm , interpreter = python 3.6 > i am getting th error as below, what might be the reason for this. > > UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 159: > character maps to It looks like you have a character

Re: [Tutor] script guidelines

2017-10-06 Thread renukesh nk
currently m using pycharm , interpreter = python 3.6 i am getting th error as below, what might be the reason for this. UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 159: character maps to On Tue, Oct 3, 2017 at 2:18 PM, renukesh nk wrote: > requirement: > i have a di

Re: [Tutor] script guidelines

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 09:48, renukesh nk wrote: > requirement: > i have a directory , that contains multiple sub directories, each sub > directory has multiple text and log files, my script fetches the required > lines from all the sub directories and stores it in one text file. > I'm not too sure what yo

[Tutor] script guidelines

2017-10-03 Thread renukesh nk
requirement: i have a directory , that contains multiple sub directories, each sub directory has multiple text and log files, my script fetches the required lines from all the sub directories and stores it in one text file. but i want it to store separate text file for each sub directory ,after

Re: [Tutor] script follows a file into zip?

2016-02-05 Thread richard kappler
Ah, I see, makes perfect sense now that it's right under my nose. Thanks Peter! regards, Richard On Fri, Feb 5, 2016 at 12:04 PM, Peter Otten <__pete...@web.de> wrote: > richard kappler wrote: > > > I have a script that checks a file and if there are new additions to the > > file, parses and sen

Re: [Tutor] script follows a file into zip?

2016-02-05 Thread Peter Otten
richard kappler wrote: > I have a script that checks a file and if there are new additions to the > file, parses and sends the new additions. This log rolls over and zips at > midnight creating a new log of the same name. The problem is, when the > file rolls over, the new file seems to follow the

[Tutor] script follows a file into zip?

2016-02-05 Thread richard kappler
I have a script that checks a file and if there are new additions to the file, parses and sends the new additions. This log rolls over and zips at midnight creating a new log of the same name. The problem is, when the file rolls over, the new file seems to follow the old file the way the script is

Re: [Tutor] script to lookup and extract the values next to it

2015-07-28 Thread Alan Gauld
On 28/07/15 10:19, s karthick babu wrote: Dear All, I am new to python programming. Hi, welcome. is there a place where people exchange the python scripts? Not that I know of, although I suppose the Activestate catalog of "recipes" is sort of like that. I would like to extract the values

[Tutor] script to lookup and extract the values next to it

2015-07-28 Thread s karthick babu
Dear All, I am new to python programming. is there a place where people exchange the python scripts? I would like to extract the values present next to certain text, Can any one help me ? Thanks in advance, Kadi ___ Tutor maillist - Tutor@python.org

Re: [Tutor] script

2015-03-29 Thread Danny Yoo
On Sat, Mar 28, 2015 at 4:04 PM, George Bollen wrote: > hi, i am new to python and i have not done programming before but i am > learning along the way, > > just want you to help me on how i can write a script that accepts an input > a measurement of a time interval in > seconds and prints a sente

[Tutor] script

2015-03-29 Thread George Bollen
hi, i am new to python and i have not done programming before but i am learning along the way, just want you to help me on how i can write a script that accepts an input a measurement of a time interval in seconds and prints a sentence giving the equivalent of the given number of seconds in hours,

Re: [Tutor] script in Raspberry pi python

2013-07-29 Thread Francois Dion
Dont edit unix files on windows, else you might end up with that problem. It is looking for python^M and not python. Edit with vi and delete the control-M character. Also, If you need to edit a file with a GUI but have the raspberry pi headless check out: http://raspberry-python.blogspot.com/2

Re: [Tutor] script in Raspberry pi python

2013-07-28 Thread Kirk Bailey
which python /usr/bin/python root@KirksPiBox1:/home/pi: ./RR.py bash: ./RR.py: /usr/bin/python^M: bad interpreter: No such file or directory root@KirksPiBox1:home/pi:_ On 7/25/2013 1:47 PM, Walter Prins wrote: Hi, On 25 July 2013 18:02, Kirk Bailey > wrote:

Re: [Tutor] script in Raspberry pi python

2013-07-25 Thread Dave Angel
On 07/25/2013 01:02 PM, Kirk Bailey wrote: On 7/23/2013 9:42 PM, Amit Saha wrote: On Wed, Jul 24, 2013 at 11:13 AM, Kirk Bailey wrote: Python works fine in pi. script works fine IF I invoke it high church: python ./RR.py but this fails: ./RR.py the shebang is #!/usr/bon/python bon -> bin r

Re: [Tutor] Script to generate statements

2013-03-17 Thread Charles Leviton
Many thanks to Peter, Steven, Dave and Alan as well. Especially Peter's hints about using the "with construct". I discovered the missing strip() the hard way! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://m

Re: [Tutor] Script to generate statements

2013-03-17 Thread Charles Leviton
Hi thanks for the response On Fri, Mar 15, 2013 at 5:43 PM, Hugo Arts wrote: > On Fri, Mar 15, 2013 at 9:03 PM, Hugo Arts wrote: > >> >> I have a few comments >> >> * Does the script work? If yes, I'd say it's probably fine. Pretty short >> so easy to understand whatever you do, and I see no ob

Re: [Tutor] Script to generate statements

2013-03-16 Thread Peter Otten
Charles Leviton wrote: > I was recently given this task. it's a very IBM mainframe specific task > so > I'm not sure how to find equivalent terms in another environment. I will > just use the mainframe terminology and hopefully y'all can figure out what > I mean. > > Given a list of DBRM member

Re: [Tutor] Script to generate statements

2013-03-15 Thread Steven D'Aprano
On 16/03/13 06:42, Charles Leviton wrote: This is the script I came up with...Would you critique it and let me know how I could have done it better? #create a series of bind statements fo = open('i:/text/jclout.txt', 'w') fi = open('i:/text/bindjclfirstpart.txt','rU') fibindjclvar = open('i:/t

Re: [Tutor] Script to generate statements

2013-03-15 Thread Dave Angel
On 03/15/2013 08:53 PM, Alan Gauld wrote: On 15/03/13 19:42, Charles Leviton wrote: Given a list of DBRM members create a JCL which has a series of bind statements for each DBRM. Ah, the joys of JCL. I haven't read a JCL script in about 15 years! :-) Been over 40 years for me, so I may not

Re: [Tutor] Script to generate statements

2013-03-15 Thread Alan Gauld
On 15/03/13 19:42, Charles Leviton wrote: Given a list of DBRM members create a JCL which has a series of bind statements for each DBRM. Ah, the joys of JCL. I haven't read a JCL script in about 15 years! :-) This is the tack I took. I have 3 input files a_ contains the fixed part of the JC

Re: [Tutor] Script to generate statements

2013-03-15 Thread Hugo Arts
On Fri, Mar 15, 2013 at 7:42 PM, Charles Leviton wrote: > I was recently given this task. it's a very IBM mainframe specific task > so I'm not sure how to find equivalent terms in another environment. I > will just use the mainframe terminology and hopefully y'all can figure out > what I mean. >

[Tutor] Script to generate statements

2013-03-15 Thread Charles Leviton
I was recently given this task. it's a very IBM mainframe specific task so I'm not sure how to find equivalent terms in another environment. I will just use the mainframe terminology and hopefully y'all can figure out what I mean. Given a list of DBRM members create a JCL which has a series of b

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread eryksun
On Fri, Aug 10, 2012 at 6:10 PM, Martin A. Brown wrote: > > : values = {'a':'d', 'b':'e', 'c':'f', 'd':'g', 'e':'h', 'f':'i', 'g':'j', > : 'h':'k', 'i':'l', 'j':'m', 'k':'n', 'l':'o', 'm':'p', 'n':'q', 'o':'r', > : 'p':'s', 'q':'t', 'r':'u', 's':'v', 't':'w', 'u':'x', 'v':'y', 'w':'z', > : 'x'

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Wayne Werner
On Fri, 10 Aug 2012, Dave Angel wrote: On 08/10/2012 03:53 PM, Joel Goldstick wrote: The clue was actually in his code. See his shebang line -- he's using Python 3. So the error is on the data that the user inputs. The other clue, that I noticed, was that his innermost error was on line 1,

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Martin A. Brown
Hello, : #!/usr/bin/env python3 : : import random : values = {'a':'d', 'b':'e', 'c':'f', 'd':'g', 'e':'h', 'f':'i', 'g':'j', : 'h':'k', 'i':'l', 'j':'m', 'k':'n', 'l':'o', 'm':'p', 'n':'q', 'o':'r', : 'p':'s', 'q':'t', 'r':'u', 's':'v', 't':'w', 'u':'x', 'v':'y', 'w':'z', : 'x':'a', 'y':'

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Bod Soutar
>> > OK, I have put it back into Python 2.7, and now I get: > > Traceback (most recent call last): > File "crypto.py", line 27, in > encrypt() > File "crypto.py", line 7, in encrypt > textInputE.list() > AttributeError: 'str' object has no attribute 'list' Would it be a strange conclu

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Dave Angel
On 08/10/2012 04:02 PM, Selby Rowley Cannon wrote: > OK, I have put it back into Python 2.7, and now I get: > Traceback (most recent call last): > File "crypto.py", line 27, in > encrypt() > File "crypto.py", line 7, in encrypt > textInputE.list() > AttributeError: 'str' object has n

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Dave Angel
On 08/10/2012 03:53 PM, Joel Goldstick wrote: > On Fri, Aug 10, 2012 at 3:33 PM, Selby Rowley Cannon > wrote: >>> >> #!/usr/bin/env python3 >> >> import random >> values = {'a':'d', 'b':'e', 'c':'f', 'd':'g', 'e':'h', 'f':'i', 'g':'j', >> 'h':'k', 'i':'l', 'j':'m', 'k':'n', 'l':'o', 'm':'p', 'n':

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Selby Rowley Cannon
On 10/08/12 20:53, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 3:33 PM, Selby Rowley Cannon wrote: On 10/08/12 20:07, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 2:57 PM, Selby Rowley Cannon wrote: On 10/08/12 18:17, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Ca

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Joel Goldstick
On Fri, Aug 10, 2012 at 3:33 PM, Selby Rowley Cannon wrote: > On 10/08/12 20:07, Joel Goldstick wrote: >> >> On Fri, Aug 10, 2012 at 2:57 PM, Selby Rowley Cannon >> wrote: >>> >>> On 10/08/12 18:17, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Cannon wrote:

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Dave Angel
On 08/10/2012 03:33 PM, Selby Rowley Cannon wrote: > On 10/08/12 20:07, Joel Goldstick wrote: >> On Fri, Aug 10, 2012 at 2:57 PM, Selby Rowley Cannon >> wrote: >>> On 10/08/12 18:17, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Cannon wrote: > I have written a

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Selby Rowley Cannon
On 10/08/12 20:07, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 2:57 PM, Selby Rowley Cannon wrote: On 10/08/12 18:17, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Cannon wrote: I have written a small application to encrypt some text. The script looks fine to me, but

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Joel Goldstick
On Fri, Aug 10, 2012 at 2:57 PM, Selby Rowley Cannon wrote: > On 10/08/12 18:17, Joel Goldstick wrote: >> >> On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Cannon >> wrote: >>> >>> I have written a small application to encrypt some text. The script looks >>> fine to me, but it won't run and I can'

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Joel Goldstick
On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Cannon wrote: > I have written a small application to encrypt some text. The script looks > fine to me, but it won't run and I can't figure out why. I have attached it, > if anyone knows why it doesn't work please let me know! > What do you mean 'it wo

[Tutor] Script won't run for no apparent reason

2012-08-10 Thread Selby Rowley Cannon
I have written a small application to encrypt some text. The script looks fine to me, but it won't run and I can't figure out why. I have attached it, if anyone knows why it doesn't work please let me know! #!/usr/bin/env python3 import random values = {'a':'d', 'b':'e', 'c':'f', 'd':'g', 'e':'h

Re: [Tutor] Script to collect values from .csv

2012-07-12 Thread Dave Angel
On 07/12/2012 12:29 PM, Emma Knowles wrote: > Hi all, > > > I have a very large .csv (correlationfile, which is 16 million lines > long) which I want to split into smaller .csvs. The smaller csvs > should be created be searching for a value and printing any line > which contains that value - all th

Re: [Tutor] Script to collect values from .csv

2012-07-12 Thread Prasad, Ramit
> I have a very large .csv (correlationfile, which is 16 million lines long) > which I want to split into smaller .csvs. The smaller csvs should be created > be searching for a value and printing any line which contains that value - all > these values are contained in another .csv (vertexfile). I t

[Tutor] Script to collect values from .csv

2012-07-12 Thread Emma Knowles
Hi all, I have a very large .csv (correlationfile, which is 16 million lines long) which I want to split into smaller .csvs. The smaller csvs should be created be searching for a value and printing any line which contains that value - all these values are contained in another .csv (vertexfile). I

Re: [Tutor] Script

2012-07-04 Thread Alan Gauld
On 28/06/12 06:21, Amit Prasad wrote: I want to write a script to replace hostname from /etc/hosts and /etc/sysconfig/network files. And the new hostname will be a new entry everytime. I mean everytime when i run the script and give a new hostname, it should be replaced with the old one. You d

[Tutor] Script

2012-07-04 Thread Amit Prasad
Hello Sir, I want to write a script to replace hostname from /etc/hosts and /etc/sysconfig/network files. And the new hostname will be a new entry everytime. I mean everytime when i run the script and give a new hostname, it should be replaced with the old one. I am running out of time, please help

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-10 Thread Dave Angel
On 05/10/2012 04:20 AM, Afonso Duarte wrote: > Dear All, > > Thanks Joel and Walter, both solutions worked nicely and produced the desired > final objective! > > Short answer to Alan Gauld, far from me to start answering all your points, > but I guess I should answer to the most pertinent ones:

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-10 Thread Afonso Duarte
ained when it wasn't). Thanks again for the nice solutions and sorry for the side discussion on how to write/answer to mailing lists Cheers Afonso -Original Message- From: Joel Goldstick [mailto:joel.goldst...@gmail.com] Sent: woensdag 9 mei 2012 20:47 To: Afonso Duarte Cc: tutor@

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Alan Gauld
On 09/05/12 20:28, aduarte wrote: Sorry it seems that I got the wrong mailing list to subscribe ... I got the idea that this list was open to newbies ... by the answers I got I see that I was wrong I'm not sure what you mean. The answers you got seem to have provided the answers to your quest

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Walter Prins
Hi Alfonso, I see you've had some responses yet -- I've not read them all, and am just posting the following suggestion you might want to look at: # read lines with "keys" into a list selected_keys=open('A.txt', 'r').readlines() # read all data records into another list records=open('B.txt', 'r')

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Joel Goldstick
On Wed, May 9, 2012 at 3:40 PM, Joel Goldstick wrote: > On Wed, May 9, 2012 at 10:00 AM, Afonso Duarte wrote: >> Dear All, >> >> >> >> I’m new to Python and started to use it to search text strings in big >> (>500Mb) txt files. >> >> I have a list on text file (e.g. A.txt) that I want to use as a

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Joel Goldstick
On Wed, May 9, 2012 at 10:00 AM, Afonso Duarte wrote: > Dear All, > > > > I’m new to Python and started to use it to search text strings in big > (>500Mb) txt files. > > I have a list on text file (e.g. A.txt) that I want to use as a key to > search another file (e.g. B.txt), organized in the foll

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread aduarte
Dear All, Sorry it seems that I got the wrong mailing list to subscribe ... I got the idea that this list was open to newbies ... by the answers I got I see that I was wrong " In that case, what do you use for data of the last key? If you really have to handle the case where there is a

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Mark Lawrence
On 09/05/2012 15:00, Afonso Duarte wrote: object = open(B.txt', 'r') You'll already received some sound advice, so I'd just like to point out that your object will override the built-in object, apologies if somebody has already said this and I've missed it. Afonso __

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Dave Angel
> > > If you really have to handle the case where there is a final key with no > data, then you'll have to detect that case, and make up the data > separately. That could be done with a try block, but this is probably > clearer: > > rawlines = object.readlines() > if len(rawlines) %2 != 0: >

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Dave Angel
On 05/09/2012 11:04 AM, Afonso Duarte wrote: > > > -Original Message- > From: Dave Angel [mailto:d...@davea.name] > >> >> Please post your messages as plain-text. The double-spacing I get is >> very annoying. > > Sorry for that my outlook mess-it-up I'm sure there's a setting to say

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Afonso Duarte
-Original Message- From: Dave Angel [mailto:d...@davea.name] Sent: woensdag 9 mei 2012 15:52 To: Afonso Duarte Cc: tutor@python.org Subject: Re: [Tutor] Script to search in string of values from file A in file B On 05/09/2012 10:00 AM, Afonso Duarte wrote: > Dear All, > I&#x

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Dave Angel
On 05/09/2012 10:00 AM, Afonso Duarte wrote: > Dear All, > > > > I'm new to Python and started to use it to search text strings in big > (>500Mb) txt files. > > I have a list on text file (e.g. A.txt) that I want to use as a key to > search another file (e.g. B.txt), organized in the following w

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread aduarte
On 2012-05-09 15:22, BRAGA, Bruno wrote: On Thursday, May 10, 2012, Afonso Duarte wrote: Dear All,   I’m new to Python and started to use it to search text strings in big (>500Mb) txt files. > I have a list on text file (e.g. A.txt) that I want to use as a key to search another file (e.g.

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread BRAGA, Bruno
On Thursday, May 10, 2012, Afonso Duarte wrote: > Dear All, > > > > I’m new to Python and started to use it to search text strings in big (>500Mb) txt files. > > I have a list on text file (e.g. A.txt) that I want to use as a key to search another file (e.g. B.txt), organized in the following way:

[Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Afonso Duarte
Dear All, I'm new to Python and started to use it to search text strings in big (>500Mb) txt files. I have a list on text file (e.g. A.txt) that I want to use as a key to search another file (e.g. B.txt), organized in the following way: A.txt: Aaa Bbb Ccc Ddd . . . B.txt

Re: [Tutor] Script for Parsing string sequences from a file

2011-04-15 Thread Joel Goldstick
sorry, I hit send too soon on last message On Fri, Apr 15, 2011 at 8:54 AM, Joel Goldstick wrote: > > > On Fri, Apr 15, 2011 at 8:41 AM, Spyros Charonis wrote: > >> Hello, >> >> I'm doing a biomedical degree and am taking a course on bioinformatics. We >> were given a raw version of a public data

Re: [Tutor] Script for Parsing string sequences from a file

2011-04-15 Thread Joel Goldstick
On Fri, Apr 15, 2011 at 8:41 AM, Spyros Charonis wrote: > Hello, > > I'm doing a biomedical degree and am taking a course on bioinformatics. We > were given a raw version of a public database in a file (the file is in > simple ASCII) and need to extract only certain lines containing important > in

[Tutor] Script for Parsing string sequences from a file

2011-04-15 Thread Spyros Charonis
Hello, I'm doing a biomedical degree and am taking a course on bioinformatics. We were given a raw version of a public database in a file (the file is in simple ASCII) and need to extract only certain lines containing important information. I've made a script that does not work and I am having tro

Re: [Tutor] script conversion windows -> linux error

2011-03-26 Thread Peter Otten
Rance Hall wrote: > On Fri, Mar 25, 2011 at 1:54 PM, Walter Prins wrote: >> >> On 25 March 2011 18:26, Rance Hall wrote: >>> config_version = config.get('versions','configver',0) >>> This line fails under 3.2 Linux with the error message: >>> TypeError: get() takes exactly 3 positional argumen

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Rance Hall
On Fri, Mar 25, 2011 at 1:54 PM, Walter Prins wrote: > > > On 25 March 2011 18:26, Rance Hall wrote: >> >> config_version =  config.get('versions','configver',0) >> >> This line fails under 3.2 Linux with the error message: >> >> TypeError:  get() takes exactly 3 positional arguments (4 given) >>

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Joel Goldstick
have you tried help(config.get) in the python interactive shell? -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Walter Prins
Ugh, please excuse my tardiness and ignore the numbered items below my signature which I was intending to delete, I accidentally hit "end" before I cleaned up the post... :red faced: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Walter Prins
On 25 March 2011 18:26, Rance Hall wrote: > config_version = config.get('versions','configver',0) > > This line fails under 3.2 Linux with the error message: > > TypeError: get() takes exactly 3 positional arguments (4 given) > > What could the 4th argument be? I only see three. > > This same

[Tutor] script conversion windows -> linux error

2011-03-25 Thread Rance Hall
I wrote a script on a windows box for python 3.1 after a meeting with the client for this project we agreed to port it to Linux so that I could make use of enscript and ps2pdf to email customers documents right from the script. Client uses a Centos server so I did some reading and installed pytho

Re: [Tutor] Script Feedback

2010-03-31 Thread Steven D'Aprano
On Wed, 31 Mar 2010 10:54:34 am Damon Timm wrote: > > Separate the underlying functionality from the application-level > > code. These functions should NEVER print anything: they do all > > communication through call-backs, or by returning a value, or > > raising an exception. > > I tried to imple

Re: [Tutor] Script Feedback

2010-03-30 Thread Damon Timm
Hello Denis & Steven - Thanks for your replies. I have taken another stab at things to try and bring it a little further up to snuff ... some more comments/thoughts follow ... On Tue, Mar 30, 2010 at 12:57 PM, Steven D'Aprano wrote: > I usually create a function "print_" or "pr", something like

Re: [Tutor] Script Feedback

2010-03-30 Thread spir ☣
On Tue, 30 Mar 2010 10:27:43 -0400 Damon Timm wrote: > As a self-taught Python user I am still looking for insight on the > most pythonic and programmatically-friendly way of accomplishing a > given task. In this case, I have written a script that will perform a > “clean bzip2″ of a directory (or

Re: [Tutor] Script Feedback

2010-03-30 Thread Steven D'Aprano
On Wed, 31 Mar 2010 01:27:43 am Damon Timm wrote: [...] > My initial questions are: > > 1. Is there a better way to implement a --quiet flag? I usually create a function "print_" or "pr", something like this: def print_(obj, verbosity=1): if verbosity > 0: print obj and then have a

[Tutor] Script Feedback

2010-03-30 Thread Damon Timm
As a self-taught Python user I am still looking for insight on the most pythonic and programmatically-friendly way of accomplishing a given task. In this case, I have written a script that will perform a “clean bzip2″ of a directory (or directories). Mac OS X (via AFP and netatalk, in my case) tend

[Tutor] Script Building

2010-03-03 Thread David Hutto
I'm new to Python, so I thought as a first project I'd create a basic script building wizard to help with my understanding of the flow, and for basic practice. The following is a outline of what I would initially like to accomplish. I've begun creating small functions, and very lightly worded

Re: [Tutor] Script to take a screenshot of my website.

2008-12-22 Thread Alan Gauld
"Bryan Fodness" wrote I would like to take a screenshot of my website without opening the browser I dont really know what you mean by this? The appearance of a web site depends on many factors, not least the size of the browser window. But different browsers render pages differently too - and

Re: [Tutor] Script to take a screenshot of my website.

2008-12-22 Thread Martin Walsh
Bryan Fodness wrote: > I would like to take a screenshot of my website without opening the > browser or importing extra packages. Is there a way to do this? Unless you're keen on writing your own html/css/javascript/etc rendering engine, I'm pretty sure you're going to need extra package(s), or a

[Tutor] Script to take a screenshot of my website.

2008-12-22 Thread Bryan Fodness
I would like to take a screenshot of my website without opening the browser or importing extra packages. Is there a way to do this? I would like to create a function like screenshot(' http://www.scatterworks.com";) -- "The game of science can accurately be described as a never-ending insult to h

Re: [Tutor] Script Name/Path Information

2008-07-05 Thread Josh Rosen
How about the following: import os print os.path.abspath(__file__) # the full absolute path to the current module's file print os.path.split(os.path.abspath(__file__)) # if you need the individual components of the path. On Jul 5, 2008, at 11:00 AM, Monika Jisswel wrote: import sys

Re: [Tutor] Script Name/Path Information

2008-07-05 Thread Steve Willoughby
Monika Jisswel wrote: import sys #a module that gives access to the system import os#a module that gives access to the os print sys.argv[0] #prints file name of the script print os.getcwd() #print current working directory print os.getcwd()+sys.argv[0] # but os.getcwd() retu

Re: [Tutor] Script Name/Path Information

2008-07-05 Thread Monika Jisswel
import sys #a module that gives access to the system import os#a module that gives access to the os print sys.argv[0] #prints file name of the script print os.getcwd() #print current working directory print os.getcwd()+sys.argv[0] # 2008/7/5 Nathan Farrar <[EMAIL PROTECTED]>

[Tutor] Script Name/Path Information

2008-07-05 Thread Nathan Farrar
I'm new to python and wondering if there is a way to reference information about the script that is running. For example, if I was running a script named "FileInfo.py" from the directory "/home/username", I'm looking for attributes such that something similar to: print self.name print self.path

Re: [Tutor] script ?

2007-10-29 Thread Alan Gauld
"Dan Freeman" <[EMAIL PROTECTED]> wrote > How can I have this script exucute a .exe file instead of beeping > the system > speaker? The same way you ran netstat - which is an .exe... Of course, nowadays you probably should be using subprocess.Popen instead os os.popen, but thats a minor tik. A

[Tutor] script ?

2007-10-29 Thread Dan Freeman
How can I have this script exucute a .exe file instead of beeping the system speaker? __ import os import time z = 2 while z ==2: connected = False while not connected: o=os.popen("netstat -an") for l in o: try:

Re: [Tutor] script run problem

2005-12-05 Thread Alan Gauld
Hi Kishra, In the words of the old joke(*) why not just 'get out and get back in' and see if that fixes it? In other words I'd try a reinstall of Python, it looks like something has gone missing or got corrupted... Alan G. (*)Three guys are in a car that breaks down. The first says "I'm an Elect

[Tutor] script run problem

2005-12-04 Thread Mishra, Ashwini
Hi everyone, I am not able to run any script in python ver2.4.2. under window xp.I get the following error messagepython.exe has encountered a problem and needs to be closed. Though path for python.exe is correct.Error meeasge generated by MS office is ?xml version="1.0" encodin

Re: [Tutor] script to change device configuration

2005-10-18 Thread Kent Johnson
Chris Hallman wrote: I'm not very experienced with programming, writing > Python, using functions, OOP, etc., therefore I'd like to know if there > is a better way to do this: It looks pretty good to me. A few suggestions below. > import telnetlib, re, os, string > > dirpath = (r"c:\temp\sun")

Re: [Tutor] script question

2005-10-18 Thread Chris Hallman
Here is my latest revision, which works very well. # This Python script was written to forward interface down messages    # to ESM1. If the incoming arguements match the interface file # (c:\utils\interface.ini) then the message is forwarded. # # Author:    tcdh # Date:        09/22/05 #

[Tutor] script to change device configuration

2005-10-18 Thread Chris Hallman
I created a script that parses a directory, strips the ".txt" extension off the file, telnet & log on to the device (the filename is the device name), opens the associated ".txt" file, sends all the commands containted in the file to the device and then executes some commands to save the changes.

Re: [Tutor] script question

2005-09-30 Thread Kent Johnson
Chris Hallman wrote: > > Thanks for all the input!!! I really appreciate it. I need to post a > correction to my script. What I sent was an early version. I made a few > minor modifications: You don't seem to have incorporated any of the suggestions that you have received! I doubt that a 4000

Re: [Tutor] script question

2005-09-29 Thread Jacob S.
Why are you importing string?   1) You don't seem to use it anywhere 2) Use string methods instead   Jacob - Original Message - From: Chris Hallman To: tutor@python.org Sent: Wednesday, September 28, 2005 7:35 AM Subject: Re: [Tutor] s

Re: [Tutor] script question

2005-09-28 Thread Andrew P
Have you benchmarked it yet?  4000 lines isn't very many, even for an older machine.  Starting the Python interpreter usually takes most of the time with simple scripts like this.  Honestly, benchmark :) You might find it easier to do:: interface_list = INI.items(section)for i in interface_list:

Re: [Tutor] script question

2005-09-28 Thread Chris Hallman
Thanks for all the input!!! I really appreciate it. I need to post a correction to my script. What I sent was an early version. I made a few minor modifications: import ConfigParser, string, sys, ossection = sys.argv[1]interface = sys.argv[3]INI=ConfigParser.ConfigParser()INI.read("c:\utils\int

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Kent Johnson wrote: > *TEST FIRST* Don't optimize until you know it is too slow and you > have a test case that you can time to see if your 'optimizations' are > making it faster. Pardon my shouting :-) Kent ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Chris Hallman wrote: > Here is the script: > > import ConfigParser, string, sys > section = sys.argv[1] > port = sys.argv[3] > INI=ConfigParser.ConfigParser() > INI.read("interfaces.ini") > passwordentries=[p for p in INI.options(section)] > passwordlist=[INI.get(section, pw) for pw in passwordent

Re: [Tutor] script question

2005-09-26 Thread R. Alan Monroe
> for i in passwordlist: > if i == port: > os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet " + sys.argv[1] + " " + >sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4]) If you don't have duplicates in your list, a "break" after the os.system line might help, because once you've found

Re: [Tutor] script question

2005-09-26 Thread Christopher Arndt
Chris Hallman schrieb: > for i in passwordlist: > if i == port: > os.system("d:\\tnd\\bin\\cawto.exe -cat NetNet " + sys.argv[1] + > " " + sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4]) 1) The last line can be also expressed as: os.system(r"d:\tnd\bin\cawto.exe -cat NetNet %s" %

Re: [Tutor] script question

2005-09-26 Thread Kent Johnson
Chris Hallman wrote: > The script is executed in this > manner: > > python search_interface.py device interface interface_name "is down - > 00:00:00 01/01/06" > > Here is the script: > > import ConfigParser, string, sys > section = sys.argv[1] > port = sys.argv[3] > INI=ConfigParser.ConfigPars

[Tutor] script question

2005-09-26 Thread Chris Hallman
I needed a script that takes command line arguments, searches an ini file for a match to the arguments and then executes a Windows executable. This is my first script using python so I wanted to make sure I made the most of the language. I took bits and pieces from different tutorials and examples

[Tutor] Script (Python) for Zope

2005-04-03 Thread Mike Jaeger
Hello, I am looking for a Python-script for Zope which counts the objects (files) in the current folder and all its subfolders, but I don't know how to implement this script. Can somebody help me, please? Or ist there a newsgroup/mailing list which can help me to find a solution for this proble