Needed class whose instances are many test cases
I have scinario like I have to Create resource(in __init__()) Before Running a set of testcases and then In Testcases resources are going to used and then It will cleared off after Running the testcases by destructor __del__() import unittest import time class app_adminfunc(unittest.TestCase): def __init__(self, method = 'runTests'): unittest.TestCase.__init__(self, method) #Resource Creation def __del__(self): #--Resource Deletion - def test01- def test02- ... But in this above code Problem is that __init__() called at each time when the Testcase is run ,But i want Single time run of the Init Prior to run of each tests inside the class . Can Anybody help me on this ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Needed class whose instances are many test cases
Thanks for comments .setup() is going the Run Before every testcase Run. But i need to create resource for set of testcases , it is one time only . I can not create at every instant before testcases Run . thats why Unittest.testsuit is goingto help me out . There __init__() can be Run One time and the resource can be create one time for set of tests. -- http://mail.python.org/mailman/listinfo/python-list
splitting a words of a line
Hi , I am trying to splitt a Line whihc is below of format , AzAccept PLYSSTM01 [23/Sep/2005:16:14:28 -0500] "162.44.245.32 CN= cojack (890),OU=1,OU=Customers,OU=ISM-Users,OU=kkk Secure,DC=customer,DC=rxcorp,DC=com" "plysmhc03zp GET /mci/performance/ SelectProducts.aspx? p=0&V=C&a=29&menu=adhoc" [d4b62ca2-09a0-4334622b-0e1c-03c42ba5] [0] Here all the string whihc i want to split is - AzAccept PLYSSTM01 [23/Sep/2005:16:14:28 -0500] 162.44.245.32 CN= cojack (890),OU=1,OU=Customers,OU=ISM-Users,OU=kkk Secure,DC=customer,DC=rxcorp,DC=com" GET /mci/performance/SelectProducts.aspx?p=0&V=C&a=29&menu=adhoc d4b62ca2-09a0-4334622b-0e1c-03c42ba5 0 i am trying to use re.split() method to split them , But unable to get the exact result . Any help on this is highly appriciated . Thanks Sumit -- http://mail.python.org/mailman/listinfo/python-list
Re: while-loops enter the last time after condition is filled?
On Apr 6, 4:53 am, [EMAIL PROTECTED] wrote: > it seems to me from my results that when i use a while-loop it will > execute once after the condition is met. Perhaps your condition is wrong. Please provide the code where this occured. -- http://mail.python.org/mailman/listinfo/python-list
Python 2 or 3 ? with Django , My SQL and YUI
Python 2 or 3 ? with Django , My SQL and YUI For a web project We have decided to work on Python 2 or 3 ? with Django , My SQL and YUI, and this would be the first time to work with Python, just now I explored a little and found Python -2 vs 3 Stuff , Is there experienced python dev can guide me in very simple terms should I go for Python 2 or 3 ? How about Python with Django and MySQL and YUI Stuff ? -- http://mail.python.org/mailman/listinfo/python-list
easy n perfect earning
hey guys try dis link n make account...click on view adds...click on every add n leave it 4 60sec n once cmpleted click on my account n u vl c tat u got $40.. http://www.fineptc.com/index.php?ref=sumit4u2010 ...must try...i hav experienced and its safe -- http://mail.python.org/mailman/listinfo/python-list
problem
i want 2 hav the header files for regular expression to non deterministin autometa so whr should i find it?plz help -- http://mail.python.org/mailman/listinfo/python-list
urllib2 redirect error
Hi, I've tried various versions but continue to get the following error: -- https://mail.python.org/mailman/listinfo/python-list
urllib2 redirect error
Hi, I've tried versions of the following but continue to get errors: - snip - url = 'https://www.usps.com/send/official-abbreviations.htm' request = urllib2.build_opener(urllib2.HTTPRedirectHandler).open(url) - snip - Generates an exception: urllib2.HTTPError: HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop. The last 30x error message was: Moved Permanently The following using the requests library hangs: - snip - response = requests.get(url) - snip - I'm fresh out of ideas and any suggestions you may have would be greatly appreciated. Thanks in advance, Sumit -- https://mail.python.org/mailman/listinfo/python-list
Re: urllib2 redirect error
Steven, Thank you! User advice was on point. Sumit On Tue, Sep 2, 2014 at 11:29 PM, dieter wrote: > Steven D'Aprano writes: > > ... > > I'm not an expert, but that sounds like a fault at the server end. I just > > tried it in Chrome, and it worked, and then with wget, and I get the same > > sort of error: > > ... > > Sounds like if the server doesn't recognise the browser, it gets > > confused and ends up in a redirect loop. > > > > You could try setting the user-agent and see if that helps: > > Excellent analysis and advice. > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
10060, 'Operation timed out'
I am using following script to connect to the server and i try the
connection for 1000 times. Some times it succeeds for all the 1000
times,but some times it fails with error:-
10060, 'Operation timed out'. When it fails with the abover error, it
seems timed out time is 20 seconds. Is there a way I can increase the
timedout time for FTP?
from ftplib import FTP
import time
import sys
host = sys.argv[1]
port = sys.argv[2]
for x in range(1000):
try:
y = time.time()
ftp = FTP()
ftp.connect(host,port)
ftp.login('a','a')
try:
print ftp.sendcmd('pass x')
except:
print sys.exc_value
ftp.close()
except:
print sys.exc_value
r = time.time()
print "Timeout %d %d %((r-y),x)
when there is error in connecting, it comes to the outer except and
prints the value of r-y as 21. How i can increase this timeout time? or
this error indicates something else?
Please let me know asap,
--
http://mail.python.org/mailman/listinfo/python-list
Re: 10060, 'Operation timed out'
can u please modify the script that i have posted with your suggestion, it will help me to a certain extent. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: 10060, 'Operation timed out'
Hi Steve, It didnt help, i am getting same error. -- http://mail.python.org/mailman/listinfo/python-list
Re: 10060, 'Operation timed out'
After 20 seconds only. -- http://mail.python.org/mailman/listinfo/python-list
Re: 10060, 'Operation timed out'
Hi Steve, Thanks, I have started the run without try and except block, I will update with the findings tomm. Please keep this thread on for you so that I can get the solution -- http://mail.python.org/mailman/listinfo/python-list
Re: 10060, 'Operation timed out'
Hi Steve, this is the trace I have got:- Traceback (most recent call last): File "sumit1.py", line 39, in ? ftp.connect(host,port) File "C:\programs\packages\python24\lib\ftplib.py", line 129, in connect raise socket.error, msg socket.error: (10060, 'Operation timed out') -- http://mail.python.org/mailman/listinfo/python-list
Re: 10060, 'Operation timed out'
Ok, so need to see on the server side. -- http://mail.python.org/mailman/listinfo/python-list
I encounter a problem during installations!!!
I have reinstall windows 8.1 for some reasons, and when I installed Python 3.6.1 then, it shows error that"The program can't start because api-ms-win-crt-runtime-I1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem." Please,help me!!! -- https://mail.python.org/mailman/listinfo/python-list
One more problem that.....................
The C runtime Update(KB2999226) in Python 3.6.1 installation is taking very much time to complete , what can I do? Please help!!! -- https://mail.python.org/mailman/listinfo/python-list
I have a encountered a new problem.
I have encountered a problem while opening the Python 3.6.1 IDLE The error message is this- [image: Inline image 1] -- https://mail.python.org/mailman/listinfo/python-list
Re: How to make a Python script to audio read a text file on phone ?
On Sunday, March 17, 2013 7:34:18 PM UTC+5:30, Nic wrote:
> I've installed Python on my Nokia E71 (Symbian S60 3rd FP1) and found a
> script example which can read out text, see example below.
>
> I want to make the script to asks me for a text file instead and then reads
> out the content. I guess it works with a .txt file, dont know if other
> formats work. Regards!
>
>
>
>
>
> [Quote]
>
>
>
> # Copyright (c) 2006 Jurgen Scheible
>
> # This script performs a query with a single-field dialog (text input field)
>
> # and lets the phone speak out the text (text to speech) that the users have
> typed in
>
> # NOTE: this script runs only with Python S60 version 3.1.14 or above
>
> # NOTE: this script doesn't work on all S60 phones neccessarily. Check your
> phone model if it has text to speech capability at all
>
>
>
> import appuifw
>
> import audio
>
>
>
> text = appuifw.query(u"Type a word:", "text")
>
> audio.say(text)
>
>
>
> [End Quote]
Here is a code that works fine for PC. Hope it'll work for you..
def op():
global TXT, L
filepath = tkFileDialog.askopenfilename(filetypes=[("Text Files","*.txt")])
if(len(filepath) == 0):
return 0
F = open(filepath,'r')
TXT = F.read()
F.close()
filename = filepath.split("/")
filename = filename[-1]
L.config(text=filename+": "+filepath)
def play():
global TXT
audio.say(TXT) ##Used as mentioned
print "said"
from Tkinter import *
import Tkconstants, tkFileDialog
import audio ##used as mentioned
TXT = ""
root = Tk()
root.title("Read that Out!!")
L = Label(text="No File Selected!",width="35",fg="black",bg="white")
L.grid(row=1,column=1)
F = Frame(root)
F.grid(row=2,column=1)
Button(F,text="Open File",command=op).grid(row=1,column=1)
Button(F,text="Read File",command=play).grid(row=1,column=2)
root.mainloop()
--
http://mail.python.org/mailman/listinfo/python-list
