Re: Python script not letting go of files

2022-11-29 Thread Mike Dewhirst
Stefan Thank you. I should have said this has been working fine for years and years until Ubuntu 2022.04 on a new droplet running Apache/2.4.52 I will refactor it one day - especially if the script is implicated. But I think I have to learn how to use lsof first! Cheers Mike On 30/11/2022

Re: Python script not letting go of files

2022-11-29 Thread Weatherby,Gerard
"Weatherby,Gerard" writes: >Do any of you Python folks see any blunders in the above code along the >lines of not letting go of py files or static assets? Er, no, I just replied to the original poster. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python script not letting go of files

2022-11-29 Thread Weatherby,Gerard
Does the script exit when complete? If you’re running on a Linux based system and have root access you can use lsof to see what processes have with files open. (Or use the psutil Python package). From: Python-list on behalf of Mike Dewhirst Date: Tuesday, November 29, 2022 at 2:20 AM To: pyth

Re: Python script seems to stop running when handling very large dataset

2021-10-30 Thread Shaozhong SHI
On Saturday, 30 October 2021, Dieter Maurer wrote: > Shaozhong SHI wrote at 2021-10-29 23:42 +0100: > >Python script works well, but seems to stop running at a certain point > when > >handling very large dataset. > > > >Can anyone shed light on this? > > Some algorithms have non linear runtime. >

Re: Python script seems to stop running when handling very large dataset

2021-10-30 Thread Dieter Maurer
Shaozhong SHI wrote at 2021-10-29 23:42 +0100: >Python script works well, but seems to stop running at a certain point when >handling very large dataset. > >Can anyone shed light on this? Some algorithms have non linear runtime. For example, it is quite easy to write code with quadratic runtime

Re: Python script seems to stop running when handling very large dataset

2021-10-29 Thread Grant Edwards
On 2021-10-29, Shaozhong SHI wrote: > Python script works well, but seems to stop running at a certain point when > handling very large dataset. > > Can anyone shed light on this? No. Nobody can help you with the amount of information you have provided. -- Grant -- https://mail.python.org/m

Re: Python script seems to stop running when handling very large dataset

2021-10-29 Thread Paul Bryan
With so little information provided, not much light will be shed. When it stops running, are there any errors? How is the dataset being processed? How large is the dataset? How large a dataset can be successfully processed? What libraries are being used? What version of Python are you using? On wha

Re: Python script seems to stop running when handling very large dataset

2021-10-29 Thread Dan Stromberg
On Fri, Oct 29, 2021 at 4:04 PM dn via Python-list wrote: > On 30/10/2021 11.42, Shaozhong SHI wrote: > > Python script works well, but seems to stop running at a certain point > when > > handling very large dataset. > > > > Can anyone shed light on this? > > Storage space? > Taking time to load/

Re: Python script seems to stop running when handling very large dataset

2021-10-29 Thread dn via Python-list
On 30/10/2021 11.42, Shaozhong SHI wrote: > Python script works well, but seems to stop running at a certain point when > handling very large dataset. > > Can anyone shed light on this? Storage space? Taking time to load/format/process data-set? -- Regards, =dn -- https://mail.python.org/mailm

Re: Python script accessing own source code

2021-05-13 Thread Chris Angelico
On Thu, May 13, 2021 at 5:27 PM Robin Becker wrote: > > On 12/05/2021 20:17, Mirko via Python-list wrote: > > Am 12.05.2021 um 20:41 schrieb Robin Becker: > >> ... > >>> > >... > >> since GvR has been shown to have time traveling abilities such a > >> script could paradoxically appear

Re: Python script accessing own source code

2021-05-13 Thread Robin Becker
On 12/05/2021 20:17, Mirko via Python-list wrote: Am 12.05.2021 um 20:41 schrieb Robin Becker: ... ... since GvR has been shown to have time traveling abilities such a script could paradoxically appear acausally. -- yrs-not-too-seriously Robin Becker Not sure, if that's what y

Re: Python script accessing own source code

2021-05-12 Thread Mirko via Python-list
Am 12.05.2021 um 20:41 schrieb Robin Becker: > ... >> >> with open(__file__) as myself: >> print(myself.read(), end='') > > very nice, but accessing code that's already seems quite easy. I > think the real problem is to get a python script name that creates > and writes itself. So I would

Re: Python script accessing own source code

2021-05-12 Thread Robin Becker
... with open(__file__) as myself:     print(myself.read(), end='') very nice, but accessing code that's already seems quite easy. I think the real problem is to get a python script name that creates and writes itself. So I would ask if any one has the solution to the self writing script

Re: Python script accessing own source code

2021-05-12 Thread Stestagg
On 2021-05-12 15:48, Michael F. Stemper wrote: > > On 12/05/2021 08.26, Dino wrote: > > > >> Hi, here's my (probably unusual) problem. Can a Python (3.7+) script > >> access its own source code? > > > > Here is a fairly simple python program that reads itself: > > > > =

Re: Python script accessing own source code

2021-05-12 Thread MRAB
On 2021-05-12 15:48, Michael F. Stemper wrote: On 12/05/2021 08.26, Dino wrote: Hi, here's my (probably unusual) problem. Can a Python (3.7+) script access its own source code? Here is a fairly simple python program that reads itself: #!/usr/b

Re: Python script accessing own source code

2021-05-12 Thread Michael F. Stemper
On 12/05/2021 08.26, Dino wrote: Hi, here's my (probably unusual) problem. Can a Python (3.7+) script access its own source code? Here is a fairly simple python program that reads itself: #!/usr/bin/python import sys with open( sys.argv[0], "

Re: python script to give a list of prime no.

2020-04-05 Thread Dan Sommers
On Sun, 05 Apr 2020 19:46:00 +0200 Pieter van Oostrum wrote: > Sathvik Babu Veligatla writes: > > > hi, > > I am new to python, and i am trying to output the prime numbers > > beginning from 3 and i cannot get the required output. It stops > > after giving the output "7" and that's it. > > COD

Re: python script to give a list of prime no.

2020-04-05 Thread Pieter van Oostrum
Sathvik Babu Veligatla writes: > hi, > I am new to python, and i am trying to output the prime numbers beginning > from 3 and i cannot get the required output. > It stops after giving the output "7" and that's it. > > CODE: > a = 3 > l = [] > while True: > for i in range(2,a): > if a

Re: python script to give a list of prime no.

2020-04-05 Thread Sathvik Babu Veligatla
On Sunday, April 5, 2020 at 8:03:19 PM UTC+5:30, inhahe wrote: > On Sun, Apr 5, 2020 at 8:26 AM Sathvik Babu Veligatla < > sathvikveliga...@gmail.com> wrote: > > > hi, > > I am new to python, and i am trying to output the prime numbers beginning > > from 3 and i cannot get the required output. > >

Re: python script to give a list of prime no.

2020-04-05 Thread Sathvik Babu Veligatla
On Sunday, April 5, 2020 at 8:03:19 PM UTC+5:30, inhahe wrote: > On Sun, Apr 5, 2020 at 8:26 AM Sathvik Babu Veligatla < > sathvikveliga...@gmail.com> wrote: > > > hi, > > I am new to python, and i am trying to output the prime numbers beginning > > from 3 and i cannot get the required output. > >

Re: python script to give a list of prime no.

2020-04-05 Thread Peter J. Holzer
On 2020-04-05 05:22:45 -0700, Sathvik Babu Veligatla wrote: > I am new to python, and i am trying to output the prime numbers > beginning from 3 and i cannot get the required output. It stops after > giving the output "7" and that's it. A technique I learned when I started programming (back in the

Re: python script to give a list of prime no.

2020-04-05 Thread Barry Scott
> On 5 Apr 2020, at 14:08, Sathvik Babu Veligatla > wrote: > > On Sunday, April 5, 2020 at 6:09:04 PM UTC+5:30, Chris Angelico wrote: >> On Sun, Apr 5, 2020 at 10:26 PM Sathvik Babu Veligatla >> wrote: >>> >>> hi, >>> I am new to python, and i am trying to output the prime numbers beginning

Re: python script to give a list of prime no.

2020-04-05 Thread Sathvik Babu Veligatla
On Sunday, April 5, 2020 at 6:09:04 PM UTC+5:30, Chris Angelico wrote: > On Sun, Apr 5, 2020 at 10:26 PM Sathvik Babu Veligatla > wrote: > > > > hi, > > I am new to python, and i am trying to output the prime numbers beginning > > from 3 and i cannot get the required output. > > It stops after gi

Re: python script to give a list of prime no.

2020-04-05 Thread Sathvik Babu Veligatla
On Sunday, April 5, 2020 at 6:04:20 PM UTC+5:30, Orges Leka wrote: > You can try the following: > It is based on trial division and very slow, compared to the state of the > art: > > import math > def is_prime(n): > if int(math.sqrt(n))**2 == n: > return(False) > for i in range(2,i

Re: python script to give a list of prime no.

2020-04-05 Thread Chris Angelico
On Sun, Apr 5, 2020 at 10:35 PM Orges Leka wrote: > > You can try the following: > It is based on trial division and very slow, compared to the state of the > art: > I think it's more helpful to assist the OP in learning coding, rather than provide a completely different function to do a similar

Re: python script to give a list of prime no.

2020-04-05 Thread Chris Angelico
On Sun, Apr 5, 2020 at 10:26 PM Sathvik Babu Veligatla wrote: > > hi, > I am new to python, and i am trying to output the prime numbers beginning > from 3 and i cannot get the required output. > It stops after giving the output "7" and that's it. > > CODE: > a = 3 > l = [] > while True: > for

Re: python script to give a list of prime no.

2020-04-05 Thread Orges Leka
You can try the following: It is based on trial division and very slow, compared to the state of the art: import math def is_prime(n): if int(math.sqrt(n))**2 == n: return(False) for i in range(2,int(math.ceil(math.sqrt(n: if n%i==0: return(False) return

Re: Python script

2017-12-07 Thread breamoreboy
On Thursday, December 7, 2017 at 2:06:46 PM UTC, prvn...@gmail.com wrote: > Hi All, > I am new to python need help to write a script in python > my requirement is :- > write a python script to print sentence from a txt file to another txt file > > Regards, > Praveen Read this https://docs.python.

Re: Python script

2017-12-07 Thread Joel Goldstick
On Thu, Dec 7, 2017 at 9:06 AM, wrote: > Hi All, > I am new to python need help to write a script in python > my requirement is :- > write a python script to print sentence from a txt file to another txt file > > Regards, > Praveen > -- > https://mail.python.org/mailman/listinfo/python-list > So

Re: Python script

2017-12-07 Thread Christian Gollwitzer
Am 07.12.17 um 15:06 schrieb prvn.m...@gmail.com: Hi All, I am new to python need help to write a script in python my requirement is :- write a python script to print sentence from a txt file to another txt file txt = open("another.txt", "w") print("sentence from txt file", file = txt)

Re: python script is slowly after use multiprocessing

2017-07-04 Thread MRAB
On 2017-07-04 18:24, Xristos Xristoou wrote: @MRAB tell me your proposal for this ? I don't have any suggestions because you haven't given any details about the function. @Ben Bacarisse i dont get some error,i have wrong map ? That code will call the function and then try to pass its resu

Re: python script is slowly after use multiprocessing

2017-07-04 Thread Xristos Xristoou
@MRAB tell me your proposal for this ? @Ben Bacarisse i dont get some error,i have wrong map ? -- https://mail.python.org/mailman/listinfo/python-list

Re: python script is slowly after use multiprocessing

2017-07-03 Thread Ben Bacarisse
Xristos Xristoou writes: > i have create an image processing python function. > > my system have 4 cores + 4 threads. > > i want to use multiprocessing to speed up my function,but anytime to > use multiprocessing packages my function is not faster and is 1 minute > slowly. any idea why ?first tim

Re: python script is slowly after use multiprocessing

2017-07-03 Thread MRAB
On 2017-07-03 20:47, Xristos Xristoou wrote: i have create an image processing python function. my system have 4 cores + 4 threads. i want to use multiprocessing to speed up my function,but anytime to use multiprocessing packages my function is not faster and is 1 minute slowly. any idea why

Re: python script Non-ASCII character

2017-03-19 Thread MRAB
On 2017-03-20 02:50, eryk sun wrote: On Sun, Mar 19, 2017 at 11:06 PM, MRAB wrote: If you're using Unicode string literals, your choices are: 1. Raw string literals: var1 = ur"C:\Users\username\Desktop\η γλωσσα μου\mylanguage\myfile" Raw unicode literals are practically useless in Pyth

Re: python script Non-ASCII character

2017-03-19 Thread eryk sun
On Sun, Mar 19, 2017 at 11:06 PM, MRAB wrote: > > If you're using Unicode string literals, your choices are: > > 1. Raw string literals: > > var1 = ur"C:\Users\username\Desktop\η γλωσσα μου\mylanguage\myfile" Raw unicode literals are practically useless in Python 2. They're not actually raw b

Re: python script Non-ASCII character

2017-03-19 Thread Steve D'Aprano
On Mon, 20 Mar 2017 06:48 am, Xristos Xristoou wrote: > Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos > Xristoou έγραψε: > > how to define my script with encoding of ISO-8859-7 or UTF-8?and for the > blanks ? First you need to know whether your editor is saving the file

Re: python script Non-ASCII character

2017-03-19 Thread MRAB
On 2017-03-19 20:10, Xristos Xristoou wrote: Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: @Terry non-ascii in pathnames i need for ex :var1="C:\Users\username\Desktop\my language\mylanguage\myfile" and for the blank ? Your choices are: 1. Raw string li

Re: python script Non-ASCII character

2017-03-19 Thread Xristos Xristoou
Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: @Terry non-ascii in pathnames i need for ex :var1="C:\Users\username\Desktop\my language\mylanguage\myfile" and for the blank ? -- https://mail.python.org/mailman/listinfo/python-list

Re: python script Non-ASCII character

2017-03-19 Thread Xristos Xristoou
Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: yes that i know but i need python 2.7 for my task -- https://mail.python.org/mailman/listinfo/python-list

Re: python script Non-ASCII character

2017-03-19 Thread Terry Reedy
On 3/19/2017 1:38 PM, Xristos Xristoou wrote: hello i have create a python script when read some files using paths and do something with that files. if that paths for files is in english likes this "c:/my_path/english " then python script working but if that paths is in my main language Non-

Re: python script Non-ASCII character

2017-03-19 Thread Chris Angelico
On Mon, Mar 20, 2017 at 6:48 AM, Xristos Xristoou wrote: > Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos Xristoou > έγραψε: > > how to define my script with encoding of ISO-8859-7 or UTF-8?and for the > blanks ? First, try using Python 3. Most of the time, that will be t

Re: python script Non-ASCII character

2017-03-19 Thread Xristos Xristoou
Τη Κυριακή, 19 Μαρτίου 2017 - 7:38:19 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: how to define my script with encoding of ISO-8859-7 or UTF-8?and for the blanks ? -- https://mail.python.org/mailman/listinfo/python-list

Re: python script Non-ASCII character

2017-03-19 Thread Chris Angelico
On Mon, Mar 20, 2017 at 4:38 AM, Xristos Xristoou wrote: > hello i have create a python script when read some files using paths and do > something with that files. > if that paths for files is in english likes this "c:/my_path/english " then > python script working but if that paths is in my ma

Re: Python script for searching variable strings between two constant strings

2016-08-27 Thread ddream . merchantt
Thanks for the lead. I have big log file nearly 2 GB. Lets say I just want to extract the ;name' field only eg. AutoAuthOSUserSubmit.The code is failing with errors. Can you just give a tested code only for the name field. Other fields I will try to work out. --- On Saturday, August 27,

Re: Python script for searching variable strings between two constant strings

2016-08-26 Thread Steve D'Aprano
On Sat, 27 Aug 2016 08:33 am, ddream.mercha...@gmail.com wrote: > My log file has several sections starting with START and ending > with END . Um. Is this relevant? Are you saying that you only wish to search the file between those lines, and ignore anything outside of them?

Re: Python script reading from sys.stdin and debugger

2016-05-20 Thread rocky
On Thursday, May 19, 2016 at 5:10:08 PM UTC-4, Fillmore wrote: > Hello PyMasters! > > Long story short: > > cat myfile.txt | python -m pdb myscript.py > > doens't work (pdb hijacking stdin?). > > Google indicates that someone has fixed this with named pipes, but, call > me stupid, I don't unde

Re: python script for .dat file

2016-04-05 Thread Steven D'Aprano
On Wed, 6 Apr 2016 07:49 am, Muhammad Ali wrote: > Would any one paste here some reference/sample python code for such > extraction of data into text file? column1 = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff'] # strings column2 = [97, 105, 16, 4, 48, 274] # ints column3 = [12.345, 7.821, -4.034, 19.03

Re: python script for .dat file

2016-04-05 Thread Ben Finney
Muhammad Ali writes: > Would any one paste here some reference/sample python code for such > extraction of data into text file? We're not going to write it for you. Please show what code you have written so far; a small, self-contained code example. Explain what you expect that code to do, and

Re: python script for .dat file

2016-04-05 Thread Erik
Hi Muhammad, On 05/04/16 22:49, Muhammad Ali wrote: Would any one paste here some reference/sample python code for such extraction of data into text file? You haven't really explained what you want to achieve. What is the input format, what is the output format, what constraints are there on

Re: python script for .dat file

2016-04-05 Thread Muhammad Ali
On Tuesday, April 5, 2016 at 2:24:02 PM UTC-7, Joel Goldstick wrote: > On Tue, Apr 5, 2016 at 4:47 PM, Mark Lawrence via Python-list > wrote: > > On 05/04/2016 21:35, Michael Selik wrote: > >> > >> What code have you written so far? > >> > > > > Would you please not top post on this list, it drive

Re: python script for .dat file

2016-04-05 Thread Joel Goldstick
On Tue, Apr 5, 2016 at 4:47 PM, Mark Lawrence via Python-list wrote: > On 05/04/2016 21:35, Michael Selik wrote: >> >> What code have you written so far? >> > > Would you please not top post on this list, it drives me nuts!!! > > A short drive? ;) -- Joel Goldstick http://joelgoldstick.com/blog

Re: python script for .dat file

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 21:35, Michael Selik wrote: What code have you written so far? Would you please not top post on this list, it drives me nuts!!! -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/ma

Re: python script for .dat file

2016-04-05 Thread Michael Selik
What code have you written so far? > On Apr 5, 2016, at 5:27 PM, Muhammad Ali wrote: > >> On Tuesday, April 5, 2016 at 9:07:54 AM UTC-7, Oscar Benjamin wrote: >>> On 5 April 2016 at 16:44, Muhammad Ali wrote: On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: On Tue,

Re: python script for .dat file

2016-04-05 Thread Muhammad Ali
On Tuesday, April 5, 2016 at 9:07:54 AM UTC-7, Oscar Benjamin wrote: > On 5 April 2016 at 16:44, Muhammad Ali wrote: > > On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: > >> On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali > >> wrote: > >> > > >> > Could any body tell me a gener

Re: python script for .dat file

2016-04-05 Thread Oscar Benjamin
On 5 April 2016 at 16:44, Muhammad Ali wrote: > On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: >> On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali >> wrote: >> > >> > Could any body tell me a general python script to generate .dat file after >> > the extraction of data from mo

Re: python script for .dat file

2016-04-05 Thread Mark Lawrence via Python-list
On 05/04/2016 16:23, Muhammad Ali wrote: Hello, Could any body tell me a general python script to generate .dat file after the extraction of data from more than 2 files, say file A and file B? Or could any body tell me the python commands to generate .dat file after the extraction of data fr

Re: python script for .dat file

2016-04-05 Thread Muhammad Ali
On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: > On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali > wrote: > > > > Hello, > > > > Could any body tell me a general python script to generate .dat file after > > the extraction of data from more than 2 files, say file A and file B?

Re: python script for .dat file

2016-04-05 Thread Joel Goldstick
On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali wrote: > > Hello, > > Could any body tell me a general python script to generate .dat file after > the extraction of data from more than 2 files, say file A and file B? > > Or could any body tell me the python commands to generate .dat file after the

Re: python script for dwonload free anything?

2015-12-11 Thread hienmizu
thank you laura, but i know this paid 3d model: http://www.nonecg.com/tokyo-shibuya.html. do you know that -- https://mail.python.org/mailman/listinfo/python-list

Re: python script for dwonload free anything?

2015-12-11 Thread Mark Lawrence
On 11/12/2015 14:29, hienm...@gmail.com wrote: i want create script for download free 3d model from nonecg.com like https://github.com/nishad/udemy-dl-windows , this script download free udemy video lesson. Anyone can tell e, how to create script like that? Any (semi)decent IDE and/or editor

Re: python script for dwonload free anything?

2015-12-11 Thread Laura Creighton
In a message of Fri, 11 Dec 2015 06:29:33 -0800, hienm...@gmail.com writes: >i want create script for download free 3d model from nonecg.com like >https://github.com/nishad/udemy-dl-windows , this script download free udemy >video lesson. Anyone can tell e, how to create script like that? >-- >h

RE: Python Script - Windows Task Scheduler - Logging

2015-12-09 Thread Raheel Rao
Update: I was able to figure this one out eventually. I had to put path of where the script is in "Start in" section of my task. Consider this ticket 'closed' :) > Date: Mon, 7 Dec 2015 23:53:10 + > From: rr.codeproj...@outlook.com > To: python-list@python.org > Subject: Python Script - Wi

Re: Python Script - Windows Task Scheduler - Logging

2015-12-08 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 23:53:10 +, Raheel Rao writes: >Hello there,I created a python script that connects to an ftp and downloads >files to a specifed folder and logs each event in a log file. This script >works perfectly fine as i want it to however when i put this in a task >sch

Re: Python script output in file

2015-03-20 Thread Albert-Jan Roskam
- On Thu, Mar 19, 2015 12:16 AM CET Steven D'Aprano wrote: >On Thu, 19 Mar 2015 07:22 am, Albert-Jan Roskam wrote: > >> >> >> On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: >> >>On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Ro

Re: Python script output in file

2015-03-18 Thread Robert Clove
On Wed, Mar 18, 2015 at 7:10 PM, Rustom Mody wrote: > On Thursday, March 19, 2015 at 1:58:29 AM UTC+5:30, Albert-Jan Roskam > wrote: > > > > On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: > > > > >On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove

Re: Python script output in file

2015-03-18 Thread Rustom Mody
On Thursday, March 19, 2015 at 1:58:29 AM UTC+5:30, Albert-Jan Roskam wrote: > > On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: > > >On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: > >> ./my_eth_script.pl eth0 M > a.txt > >> > >> How can

Re: Python script output in file

2015-03-18 Thread Steven D'Aprano
On Thu, 19 Mar 2015 07:22 am, Albert-Jan Roskam wrote: > > > On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: > >>On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: >>> ./my_eth_script.pl eth0 M > a.txt >>> >>> How can i run this command wit

Re: Python script output in file

2015-03-18 Thread Chris Angelico
On Thu, Mar 19, 2015 at 7:22 AM, Albert-Jan Roskam wrote: > On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: > >>On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: >>> ./my_eth_script.pl eth0 M > a.txt >>> >>> How can i run this command with subprocess.popen >> >>Something

Re: Python script output in file

2015-03-18 Thread Albert-Jan Roskam
On Wed, Mar 18, 2015 7:06 PM CET Rustom Mody wrote: >On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: >> ./my_eth_script.pl eth0 M > a.txt >> >> How can i run this command with subprocess.popen > >Something like this I guess? > >>> proc = Pope

Re: Python script output in file

2015-03-18 Thread Rustom Mody
On Wednesday, March 18, 2015 at 11:36:39 PM UTC+5:30, Rustom Mody wrote: > On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: > > ./my_eth_script.pl eth0 M >> a.txt > > > > How can i run this command with subprocess.popen > > Something like this I guess? > > >>> proc = Pope

Re: Python script output in file

2015-03-18 Thread Rustom Mody
On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote: > ./my_eth_script.pl eth0 M >> a.txt > > How can i run this command with subprocess.popen Something like this I guess? >>> proc = Popen("cat", shell=True, stdout=open(inname, "w"), >>> stdin=open(outname,"r")) inname and

Re: Python script output in file

2015-03-18 Thread Robert Clove
./my_eth_script.pl eth0 M >> a.txt How can i run this command with subprocess.popen On Wed, Mar 18, 2015 at 3:49 AM, Rustom Mody wrote: > On Wednesday, March 18, 2015 at 4:06:05 PM UTC+5:30, Robert Clove wrote: > > Hi, > > > > I have a perl script named "my_eth-traffic.pl" which calculates the

Re: Python script output in file

2015-03-18 Thread Rustom Mody
On Wednesday, March 18, 2015 at 4:06:05 PM UTC+5:30, Robert Clove wrote: > Hi, > > I have a perl script named "my_eth-traffic.pl" which calculates the tx and rx > speed of the Ethernet interface in Mb. > > I want to run this script from another script and want the output in other > file. > So i

Re: Python Script to convert firewall rules

2014-12-14 Thread Jason Friedman
> Thank you very much. Appreciated ! But the first requirement was to convert > format1 to format2 as below: > > set interface ethernet2/5 ip 10.17.10.1/24 (format 1) > set interfaces ge-0/0/0 unit 0 family inet address 10.17.10.1/24 (format 2) > (set, interface, ip) = (set, interfaces, family inet

Re: Python Script to convert firewall rules

2014-12-13 Thread Kashif Rana
Hi Jason Thank you very much. Appreciated ! But the first requirement was to convert format1 to format2 as below: set interface ethernet2/5 ip 10.17.10.1/24 (format 1) set interfaces ge-0/0/0 unit 0 family inet address 10.17.10.1/24 (format 2) (set, interface, ip) = (set, interfaces, family inet

Re: Python Script to convert firewall rules

2014-12-13 Thread Jason Friedman
> Thanks for the reply. I am learning python using CBT nuggets for python. But > If you can refer me some good course, that should be practical then it would > be great. > > For my requirement, if you can give me the best approach to start with or > high level steps or give me some sample cod, I

Re: Python Script to convert firewall rules

2014-12-13 Thread Kashif Rana
On Saturday, December 13, 2014 6:31:34 AM UTC+4, Jason Friedman wrote: > Thanks for the reply. Yes I can make the all possible keywords/values for > both formate. But after that what gonna be the logic to convert one format to > other format. Like to convert one line below are the keywords: > >

Re: Python Script to convert firewall rules

2014-12-12 Thread Jason Friedman
> > > Thanks for the reply. Yes I can make the all possible keywords/values for > both formate. But after that what gonna be the logic to convert one format > to other format. Like to convert one line below are the keywords: > > set interface ethernet2/5 ip 10.17.10.1/24 (format 1) > set interfaces

Re: Python Script to convert firewall rules

2014-12-11 Thread Kashif Rana
Hi Jason Thanks for the reply. Yes I can make the all possible keywords/values for both formate. But after that what gonna be the logic to convert one format to other format. Like to convert one line below are the keywords: set interface ethernet2/5 ip 10.17.10.1/24 (format 1) set interfaces ge

Re: Python Script to convert firewall rules

2014-12-11 Thread Jason Friedman
> I am network engineer and not expert in programming. I would like to make > one python script to convert juniper netscreen firewall configuration into > juniper SRX firewall configuration. > Looks pretty tricky, do you have a specification for each format containing all the possible keywords/val

Re: Python script isn't producing text in data file

2014-12-11 Thread Docfxit
On Thursday, December 11, 2014 1:32:02 AM UTC-8, Peter Otten wrote: > Docfxit wrote: > > > I don't know enough about Python to figure out how to isolate where the > > problem is happening. > > Can you get hold of the person who wrote the script? No. I tried. They are not answering their email.

Re: Python script isn't producing text in data file

2014-12-11 Thread Peter Otten
Docfxit wrote: > I don't know enough about Python to figure out how to isolate where the > problem is happening. Can you get hold of the person who wrote the script? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python script isn't producing text in data file

2014-12-11 Thread alister
On Wed, 10 Dec 2014 20:23:56 -0800, Docfxit wrote: > On Wednesday, December 10, 2014 7:55:17 PM UTC-8, Ben Finney wrote: >> Docfxit writes: >> >> > I am happy to paste it into a post. The reason I didn't is because >> > it's very large. The Python script is 1239 lines long. >> >> That's too l

Re: Python script isn't producing text in data file

2014-12-11 Thread alister
On Thu, 11 Dec 2014 05:19:44 +, Grant Edwards wrote: > On 2014-12-11, Docfxit wrote: > >> I am happy to paste it into a post. The reason I didn't is because >> it's very large. The Python script is 1239 lines long. The example >> summary is 105 lines long. The input log is 6810 lines lon

Re: Python script isn't producing text in data file

2014-12-10 Thread Tim Golden
On 11/12/2014 05:18, Steven D'Aprano wrote: (I think it is funny that the script has a Unix "hash-bang" line at the top of the script, but is written such that it will only work on Windows.) I didn't look at the code, but responding only to your comment... Since the introduction of the PEP397

Re: Python script isn't producing text in data file

2014-12-10 Thread Grant Edwards
On 2014-12-11, Ben Finney wrote: > Docfxit writes: > >> Thank you all for the encouragement to make it smaller. > Begin with an empty program, and start constructing the behaviour > from scratch. Ignore anything else you want the program to do; focus > only on *this* behaviour which is confusing

Re: Python script isn't producing text in data file

2014-12-10 Thread Steven D'Aprano
On Wed, 10 Dec 2014 20:23:56 -0800, Docfxit wrote: > I don't know enough about Python to figure out how to isolate where the > problem is happening. Ouch! You have my sympathies. Nevertheless, I'm not going to run your code to see what it does. Even if I trusted it, and I don't, I can see that

Re: Python script isn't producing text in data file

2014-12-10 Thread Grant Edwards
On 2014-12-11, Docfxit wrote: > I am happy to paste it into a post. The reason I didn't is because > it's very large. The Python script is 1239 lines long. The example > summary is 105 lines long. The input log is 6810 lines long. > > Are you sure you want me to post all of that here? Or wou

Re: Python script isn't producing text in data file

2014-12-10 Thread Ben Finney
Docfxit writes: > Thank you all for the encouragement to make it smaller. Even if only for the purpose of demonstrating the behaviour that you'd like to discuss. This doesn't necessarily mean changing the actual program you're working on (though it might lead to that as a benefit). > I don't k

Re: Python script isn't producing text in data file

2014-12-10 Thread Chris Angelico
On Thu, Dec 11, 2014 at 3:23 PM, Docfxit wrote: > Thank you all for the encouragement to make it smaller. > I don't know enough about Python to figure out how to isolate where the > problem is happening. > > Maybe it would be best If I could get some help in getting a debugger working > so I can

Re: Python script isn't producing text in data file

2014-12-10 Thread Docfxit
On Wednesday, December 10, 2014 7:55:17 PM UTC-8, Ben Finney wrote: > Docfxit writes: > > > I am happy to paste it into a post. The reason I didn't is because > > it's very large. The Python script is 1239 lines long. > > That's too long to direct us toward, no matter where you put it. > > Yo

Re: Python script isn't producing text in data file

2014-12-10 Thread Ben Finney
Docfxit writes: > I am happy to paste it into a post. The reason I didn't is because > it's very large. The Python script is 1239 lines long. That's too long to direct us toward, no matter where you put it. Your task, then, is to construct a *much* smaller and simpler example that still demon

Re: Python script isn't producing text in data file

2014-12-10 Thread Docfxit
On Wednesday, December 10, 2014 6:47:17 PM UTC-8, Steven D'Aprano wrote: > On Wed, 10 Dec 2014 15:04:52 -0800, Docfxit wrote: > > > This is the Python Script that I'm having trouble with: > > http://theoffice.la/m/CGPLogSummaryTest.py > > Link is broken: > Steven I'm very sorry. I didn't mean to

Re: Python script isn't producing text in data file

2014-12-10 Thread Chris Angelico
On Thu, Dec 11, 2014 at 2:30 PM, Docfxit wrote: > I am happy to paste it into a post. The reason I didn't is because it's very > large. The Python script is 1239 lines long. > The example summary is 105 lines long. > The input log is 6810 lines long. > > Are you sure you want me to post all of

Re: Python script isn't producing text in data file

2014-12-10 Thread Docfxit
On Wednesday, December 10, 2014 5:45:14 PM UTC-8, Chris Angelico wrote: > On Thu, Dec 11, 2014 at 12:32 PM, wrote: > > On Wednesday, December 10, 2014 3:11:28 PM UTC-8, Chris Angelico wrote: > >> On Thu, Dec 11, 2014 at 10:04 AM, Docfxit wrote: > >> > This is the Python Script that I'm having tr

Re: Python script isn't producing text in data file

2014-12-10 Thread Steven D'Aprano
On Wed, 10 Dec 2014 15:04:52 -0800, Docfxit wrote: > This is the Python Script that I'm having trouble with: > http://theoffice.la/m/CGPLogSummaryTest.py Link is broken: steve@runes:~$ wget http://theoffice.la/m/CGPLogSummaryTest.py --2014-12-11 13:41:26-- http://theoffice.la/m/CGPLogSummaryTes

Re: Python script isn't producing text in data file

2014-12-10 Thread Chris Angelico
On Thu, Dec 11, 2014 at 1:41 PM, Steven D'Aprano wrote: > On Thu, 11 Dec 2014 12:44:51 +1100, Chris Angelico wrote: > >> Agreed. There are ways around some of those problems (eg using wget to >> fetch something, and then looking at it in a text editor - it's hard to >> get pwned through a text edi

Re: Python script isn't producing text in data file

2014-12-10 Thread Steven D'Aprano
On Thu, 11 Dec 2014 12:44:51 +1100, Chris Angelico wrote: > Agreed. There are ways around some of those problems (eg using wget to > fetch something, and then looking at it in a text editor - it's hard to > get pwned through a text editor... though I won't say impossible), but > there are other is

Re: Python script isn't producing text in data file

2014-12-10 Thread Chris Angelico
On Thu, Dec 11, 2014 at 12:32 PM, wrote: > On Wednesday, December 10, 2014 3:11:28 PM UTC-8, Chris Angelico wrote: >> On Thu, Dec 11, 2014 at 10:04 AM, Docfxit wrote: >> > This is the Python Script that I'm having trouble with: >> > http://theoffice.la/m/CGPLogSummaryTest.py >> > >> > If I haven

  1   2   3   4   >