How to compare timestamps in python
Hi All , I have just playing with python , I am stuck for the following problem : file1 : Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 Bootstrapping registry and package to current versions...done statement ERR-2001: table is corrupt check for cause could not determine the current status. Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:58 2018 file2 : LOG file opened at 02/03/18 01:11:05 DUP-05004: statement1 DUP-05007: statement2 LOG file opened at 02/03/18 01:11:14 DUP-05004: statement1 DUP-05007: statement2 LOG file opened at 02/23/18 01:10:33 DUP-05004: statement1 DUP-05007: statement2 I need to look for the ERR-2001 in file1 if it matches then go to file2 and print the message nearest to the timestamp found in file1 within two minutes of range . 1) What regex I use get the timestamp from file 1 and then file 2 ? 2) How to I acheive so in this case file1 Start: Fri Feb 23 01:10:28 2018 End time : Fri Feb 23 01:10:58 2018 check in file 2 nearest to file1 end time : 02/23/18 01:10:33 Thanks in advance, -- Asad Hasan +91 9582111698 -- Asad Hasan +91 9582111698 -- https://mail.python.org/mailman/listinfo/python-list
Learning Python
Hi All , I have started leaning Python through web . Would like to know if I should follow any book so that basics become clear with examples also want to know like in perl i use to invoke perl -d to get a debugged output is there any option in python. THanks, -- http://mail.python.org/mailman/listinfo/python-list
Compiling a Python File on Mac OS X Tiger
Hello. I am working on Tiger and wanted to find out how to compile a Python (.py) file into a .pyc file and then into a .pyo file. Can the compilation be achieved within the interpreter? Also, I am new to Python and wanted to know the difference between .pyc and .pyo files. Is this comparison similar to C? Any help would be appreciated. Thanks. - Asad -- http://mail.python.org/mailman/listinfo/python-list
Re: On fighting fire with fire...
I agree with Mustafa. After all, we are a bunch of professionals and not vagabonds hired to take pot shots at one another. - Asad On Thu, 28 Jul 2005, mustafa wrote: > Rocco Moretti wrote: > > projecktzero wrote: > > > >>but..but...It's so much more fun to unleash your anger and fire back > >>with all guns blazing fanning the flame war that most discussion groups > >>degenerate into after a couple of responses. =) > >> > >>Actually, I had some self restraint yesterday. I wanted to write a > >>ripping response to an antagonistic flame bait message on another > >>group. I wrote it, decided it wouldn't help much, and deleted it. I > >>guess I got it out of my system by just writing it. > > > > > > That's what I do. I sometimes have something I want to say, so I write > > my rant. Once I get it out of my system, I realize that it isn't adding > > anything to the discussion, and delete it. The part of my brain that > > wants to rant is happy because it got its say in, and the rest of the > > world is happier for not having to read it. > > > > I highly recommend that people try it. It works wonders. > > thats wrong. > you should atleast reprimand the person whose bieng rude. > otherwise that type of behavior spreads. > ppl have to realise that ifyou want ppl to help > asking nicely can and will do wonders > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: On fighting fire with fire...
What, do you not consider yourself a professional? Just because you are in academia does not justify attacking people on a mailing list and then justifying your attack with Harter's quote! Life is more than a quote - look outside your academic cocoon and you will realize what I mean. - Asad On Thu, 28 Jul 2005, Robert Kern wrote: > Asad Habib wrote: > > I agree with Mustafa. After all, we are a bunch of professionals and not > > vagabonds hired to take pot shots at one another. > > Speak for yourself. ;-) > > -- > Robert Kern > [EMAIL PROTECTED] > > "In the fields of hell where the grass grows high > Are the graves of dreams allowed to die." >-- Richard Harter > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: On fighting fire with fire...
Well, even if you are a hobbyist, that does not excuse you from being civil. After all, we are all humans beings that deserve to be treated with respect. Professional, hobbyist, vagabond, ogre, instigator, troll ... THERE IS NO EXCUSE ... please treat others with respect. - Asad On Thu, 28 Jul 2005, Rocco Moretti wrote: > Asad Habib wrote: > > I agree with Mustafa. After all, we are a bunch of professionals and not > > vagabonds hired to take pot shots at one another. > > Except that we're not all professionals. There are a large number of > hobbyists who use Python and this list. > > At any rate, my suggestion was not to forswear gentle corrections toward > better list behavior, (emphasis on gentle) but to address the case where > one would be tempted to "fight fire with fire", and answer a potshot > with another potshot. Professionals (and even decent hobbyists) don't > escalate flame wars, even unintentionally. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Profiler for long-running application
I have a Flask application where I run a specific task asynchronously using Celery. Its basically parsing some HTML and inserting data into a Postgres database(using SQLAlchemy). However, the task seems to be running very slowly, at 1 insert per second. I'd like to find out where the bottleneck is, and I've been looking for a good profiler that'd let me do this, however, I couldn't find anything. Any recommendations would be great. -- https://mail.python.org/mailman/listinfo/python-list
Re: Profiler for long-running application
On Monday, February 9, 2015 at 1:50:58 PM UTC+5:30, Ryan Stuart wrote:
> Hi Asad,
>
> Is there any reason why you can't just use profile/cProfile? In particular,
> you could use the api of that module to save out the profile stats to an
> external file with a unique name and then inspect them later with a tool like
> snakeviz. The code to save profile stats might look like the following:
>
>
> pr = cProfile.Profile()
> pr.runcall(your_celery_task_without_async)
> ps = pstats.Stats(pr)
> ps.dump_stats("my_task.profile")
> Obviously you need to call your celery task function directly, not via Celery
> using delay() or any derivative. Alternatively, you could try something like
> line_profiler by again, calling the task directly.
>
>
> If using this method it turn out your actual task code is running quite fast,
> then I'd suggest that the majority of the time is being lost in transferring
> the task to the Celery node.
>
> Cheers
>
>
> On Mon Feb 09 2015 at 5:20:43 AM Asad Dhamani wrote:
> I have a Flask application where I run a specific task asynchronously using
> Celery. Its basically parsing some HTML and inserting data into a Postgres
> database(using SQLAlchemy). However, the task seems to be running very
> slowly, at 1 insert per second.
>
> I'd like to find out where the bottleneck is, and I've been looking for a
> good profiler that'd let me do this, however, I couldn't find anything. Any
> recommendations would be great.
>
> --
>
> https://mail.python.org/mailman/listinfo/python-list
Hi Ryan,
I was looking for something that didn't make me modify my code. It seems like
I'll just use cProfile with snakeviz.
Thanks for the help
--
https://mail.python.org/mailman/listinfo/python-list
How to add data in xlm file ?
def Test(request):
save_path = '/usr/share/newfies/'
name_of_file = ("Avatar")
completeName = os.path.join(save_path, name_of_file+".xlm")
file1 = open(completeName, "w")
toFile = raw_input("Write what you want into the field")
file1.write(toFile)
file1.close()
This is code for save file in specific directory.Output of this file is empty i
want to get data from database i write database query in it but it did't
work.Example\
def Test(request):
save_path = '/usr/share/newfies/'
name_of_file = ("Avatar")
completeName = os.path.join(save_path, name_of_file+".xlm")
file1 = open(completeName, "w")
toFile = Subscriber.objects.all().count()
file1.write(toFile)
file1.close()
Subscriber is table name in my database.
How can i get data ?
Thanks in advance !
--
https://mail.python.org/mailman/listinfo/python-list
How to split value where is comma ?
Here is my view.py
import os.path
import commands
def call_report(request):
a = commands.getstatusoutput('/usr/local/freeswitch/bin/fs_cli -x "show
calls"')
return HttpResponse(a)
When i run this command it gives output which you can see...
0uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr,dest,presence_id,presence_data,callstate,callee_name,callee_num,callee_direction,call_uuid,hostname,sent_callee_name,sent_callee_num,b_uuid,b_direction,b_created,b_created_epoch,b_name,b_state,b_cid_name,b_cid_num,b_ip_addr,b_dest,b_presence_id,b_presence_data,b_callstate,b_callee_name,b_callee_num,b_callee_direction,b_sent_callee_name,b_sent_callee_num,call_created_epoch
7135c05c-7511-11e6-a09e-89a1f4981d2c,outbound,2016-09-07
11:40:45,1473262845,sofia/external/12036325207,CS_EXECUTE,Outbound
Call,12036325207,,12036325207,,,ACTIVE,9047125683,9047125683,RECV,7135c05c-7511-11e6-a09e-89a1f4981d2c,vb-pmedia,
75a9d3ee-7511-11e6-a115-89a1f4981d2c,outbound,2016-09-07
11:40:53,1473262853,sofia/external/12036325259,CS_EXECUTE,Outbound
Call,12036325259,,12036325259,,,ACTIVE,9047125683,9047125683,RECV,75a9d3ee-7511-11e6-a115-89a1f4981d2c,vb-pmedia,
7841c6c0-7511-11e6-a139-89a1f4981
d2c,outbound,2016-09-07
11:40:57,1473262857,sofia/external/16189973135,CS_EXECUTE,Outbound
Call,16189973135,,16189973135,,,ACTIVE,3473788006,3473788006,RECV,7841c6c0-7511-11e6-a139-89a1f4981d2c,vb-pmedia,
78582a82-7511-11e6-a141-89a1f4981d2c,outbound,2016-09-07
11:40:57,1473262857,sofia/external/16185392123,CS_EXECUTE,Outbound
Call,16185392123,,16185392123,,,ACTIVE,3473788006,3473788006,RECV,78582a82-7511-11e6-a141-89a1f4981d2c,vb-pmedia,
79eda1ec-7511-11e6-a161-89a1f4981d2c,outbound,2016-09-07
11:41:00,1473262860,sofia/external/12037584114,CS_EXECUTE,Outbound
Call,12037584114,,12037584114,,,ACTIVE,3473788006,3473788006,RECV,79eda1ec-7511-11e6-a161-89a1f4981d2c,vb-pmedia,
7a02bb90-7511-11e6-a169-89a1f4981d2c,outbound,2016-09-07
11:41:00,1473262860,sofia/external/13346775290,CS_EXECUTE,Outbound
Call,13346775290,,13346775290,,,ACTIVE,3473788006,3473788006,RECV,7a02bb90-7511-11e6-a169-89a1f4981d2c,vb-pmedia
, 7a1fa002-7511-11e6-a179-89a1f4981d2c,outbound,2016-09-07
11:41:00,1473262860,sofia/external/15154483189,CS_EXECUTE,Outbound
Call,15154483189,,15154483189,,,ACTIVE,3473788006,3473788006,RECV,7a1fa002-7511-11e6-a179-89a1f4981d2c,vb-pmedia,
7a20d864-7511-11e6-a181-89a1f4981d2c,outbound,2016-09-07
11:41:00,1473262860,sofia/external/12036325257,CS_EXECUTE,Outbound
Call,12036325257,,12036325257,,,ACTIVE,9047125683,9047125683,RECV,7a20d864-7511-11e6-a181-89a1f4981d2c,vb-pmedia,
7a354cf4-7511-11e6-a191-89a1f4981d2c,outbound,2016-09-07
11:41:00,1473262860,sofia/external/13348725798,CS_EXECUTE,Outbound
Call,13348725798,,13348725798,,,ACTIVE,9047125683,9047125683,RECV,7a354cf4-7511-11e6-a191-89a1f4981d2c,vb-pmedia,
7e90e128-7511-11e6-a1d4-89a1f4981d2c,outbound,2016-09-07
11:41:07,1473262867,sofia/external/13345880337,CS_EXECUTE,Outbound
Call,13345880337,,13345880337,,,ACTIVE,9047125683,9047125683,RECV,7e90e128-7511-11e6-a1d4-89a1f49
81d2c,vb-pmedia,
7e9c3514-7511-11e6-a1e8-89a1f4981d2c,outbound,2016-09-07
11:41:08,1473262868,sofia/external/12036325256,CS_EXECUTE,Outbound
Call,12036325256,,12036325256,,,ACTIVE,9047125683,9047125683,RECV,7e9c3514-7511-11e6-a1e8-89a1f4981d2c,vb-pmedia,
7f3cdc62-7511-11e6-a1ff-89a1f4981d2c,outbound,2016-09-07
11:41:09,1473262869,sofia/external/13344992844,CS_EXECUTE,Outbound
Call,13344992844,,13344992844,,,ACTIVE,9047125683,9047125683,RECV,7f3cdc62-7511-11e6-a1ff-89a1f4981d2c,vb-pmedia,
82179454-7511-11e6-a228-89a1f4981d2c,outbound,2016-09-07
11:41:13,1473262873,sofia/external/16185392157,CS_EXECUTE,Outbound
But i want to get output like this
0uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr,dest,presence_id,presence_data,callstate,callee_name,callee_num,callee_direction,call_uuid,hostname,sent_callee_name,sent_callee_num,b_uuid,b_direction,b_created,b_created_epoch,b_name,b_state,b_cid_name,b_cid_num,b_ip_addr,b_dest,b_presence_id,b_presence_data,b_callstate,b_callee_name,b_callee_num,b_callee_direction,b_sent_callee_name,b_sent_callee_num,call_created_epoch
7135c05c-7511-11e6-a09e-89a1f4981d2c,outbound,2016-09-07
11:40:45,1473262845,sofia/external/12036325207,CS_EXECUTE,Outbound
Call,12036325207,,12036325207,,,ACTIVE,9047125683,9047125683,RECV,7135c05c-7511-11e6-a09e-89a1f4981d2c,vb-pmedia,
75a9d3ee-7511-11e6-a115-89a1f4981d2c,outbound,2016-09-07 11:40:53,
1473262853,
sofia/external/1203632525,CS_EXECUTE,
Outbound Call,
12036325259,
,12036325259,
,
,ACTIVE,
9047125683,
9047125683,
RECV,
75a9d3ee-7511-11e6-a115-89a1f4981d2c,
vb-pmedia,7841c6c0-7
