Some help in refining this regex for CSV files

2012-12-05 Thread Oltmans
Hi guys, I've to deal with CSVs that look like following CSV (with one header and 3 legit rows where each legit row has 3 columns) Some info Date: 12/6/2012 Author: Some guy Total records: 100 header1, header2, header3 one, two, three one, "Python is great, so are other languages, isn't ?",

Cannot get past this string related issue

2011-04-26 Thread Oltmans
Greetings, I hope you're doing well. I'm stuck in a strange issue, most likely due to my own ignorance. I'm reading a config file using ConfigParser module and passing database related info to _mssql. Following doesn't work config = ConfigParser.ConfigParser() config.read('configs.txt') server_in

Re: Cannot get past this string related issue

2011-04-26 Thread Oltmans
On Apr 26, 7:39 pm, Thomas Rachel wrote: > Am 26.04.2011 15:48, schrieb Oltmans: > > > > > > > > > > > Following doesn't work > > > config = ConfigParser.ConfigParser() > > config.read('configs.txt') > > server_info

Unable to handle File Open dialog (using Pamie)

2008-03-12 Thread Oltmans
Hi all, I'm new to Python and am automating few tasks using Pamie. Everything worked well until I had to handle the File Open Dialog. I mean I'm trying to automate the file upload process using Pamie. Basically I just want to automate the process of file upload. I want to automatically hit the Br

A SSH error during put operation

2009-01-20 Thread Oltmans
Hey all, I've been using Paramiko for sometime now and I never had any problems. I've already submitted this question to Paramiko mailling list but I thought I should post it in CLP as someone might have used it in past. I'm using Paramiko for SSH. Are there any other good SSH libraries that you'v

Help needed to retrieve text from a text-file using RegEx

2009-02-09 Thread Oltmans
Here is the scenario: It's a command line program. I ask user for a input string. Based on that input string I retrieve text from a text file. My text file looks like following Text-file: - AbcManager=C:\source\code\Modules\Code-AbcManager\ AbcTest=C:\source\code\Modules\Code-AbcTest\

Searching Google?

2009-02-17 Thread Oltmans
ghten me. Thanks, Oltmans -- http://mail.python.org/mailman/listinfo/python-list

Printing digits in one place

2008-11-24 Thread Oltmans
I'm writing a file-transfer program and I'm receiving bytes transferred in a function. Now I would like to print bytes transfered in one place e.g. Bytes Transfered so far X and X will increase and cursor should stay at this position. I don't want to use any 3rd party module for this. Can I someh

How to store passwords?

2009-01-07 Thread Oltmans
I'm writing a program in which I will ask users to enter user name and password once only. It's a console based program that will run on Windows XP. Actually, I'm trying to provide the similar functionality as "Remember me" thing in browsers. For that, I will need to store user name and passwords o

Re: How to store passwords?

2009-01-07 Thread Oltmans
On Jan 8, 1:55 am, "Sebastian Bassi" wrote: > In general you don't store the password, but a "hash" of it. Then when > the user logs-in, you hash it and compare the result with the stored > hash. > About hash, use sha, look > here:http://docs.python.org/library/hashlib.html#module-hashlib But t

Indentifying types?

2009-03-03 Thread Oltmans
Python? I want to check following types 1- integers 2- strings 3- testing types of a particular class 4- decimal/floats Please excuse my ignorance & enlighten me. I will really appreciate any help. Thanks, Oltmans -- http://mail.python.org/mailman/listinfo/python-list

How to extract some text?

2009-03-08 Thread Oltmans
rom the above string. Any ideas/ help is highly appreciated. Thanks, Oltmans -- http://mail.python.org/mailman/listinfo/python-list

Re: How to extract some text?

2009-03-08 Thread Oltmans
On Mar 9, 3:37 am, Chris Rebert wrote: > Learn about the methods of the string class > (str):http://docs.python.org/library/stdtypes.html#id4 > > You'll probably be most interested in .split() OK, thanks I got it. I was trying to use Regex but .split() just worked like a charm. Thank you ;) > >

calling class methods from class methods, help?

2009-03-11 Thread Oltmans
I've a multithreaded program in which I've to call class methods from class methods. Here is how my code look like (excluding imports),. Any help is highly appreciated. #!/usr/bin/env python class Requests(Thread): def __init__(self, times): Thread.__init__(self) self.times=ti

Re: calling class methods from class methods, help?

2009-03-11 Thread Oltmans
On Mar 11, 10:08 pm, Oltmans wrote: >                 self.html=SendRequest() # This line throws an error and error says NameError: global name '_Requests_SendRequest' is not defined. -- http://mail.python.org/mailman/listinfo/python-list

Re: calling class methods from class methods, help?

2009-03-11 Thread Oltmans
On Mar 11, 11:00 pm, Piet van Oostrum wrote: >                     self.html=self.SendRequest() > -- Thank you, everyone, for the help. Appreciate that. > Piet van Oostrum > URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4] > Private email: p...@vanoostrum.org- Hide quoted text - > > - Show q

An error in threading.py?

2009-03-11 Thread Oltmans
Hi, all. I'm trying to use Mechanize in a multithreaded program-- purpose of which is to fill out a form on a website using concurrent threads. Guys, trust me I've spent a lot of time to figure out the problem but I'm completed puzzled. Firstly, I've listed the errors and then the program listing (

Searching and replacing text ?

2008-05-02 Thread Oltmans
Hi, I'm new to Python (and admittedly not a very good programmer) and I've come across a scenario where I've to search and replace text in a file. For the sake of an example, I'm searching for every occurence of the text [[http://www.hotmail.com -> Hotmail]] I've to replace it with [http://www.h

Regex help needed!

2009-12-21 Thread Oltmans
Hello,. everyone. I've a string that looks something like lksjdfls kdjff lsdfs sdjfls sdfsdwelcome >From above string I need the digits within the ID attribute. For example, required output from above string is - 35343433 - 345343 - 8898 I've written this regex that's kind of working

Re: Regex help needed!

2009-12-21 Thread Oltmans
lksjdfls kdjff lsdfs sdjfls sdfsdwelcome hello, my age is 86 years old and I was born in 1945. Do you know that PI is roughly 3.1443534534534534534 > ~uk > > On Dec 21, 4:38 pm, Oltmans wrote: > > > Hello,. everyone. > > > I've a string that looks som

unittest help needed!

2010-01-14 Thread Oltmans
Hi Python gurus, I'm quite new to Python and have a problem. Following code resides in a file named test.py --- import unittest class result(unittest.TestResult): pass class tee(unittest.TestCase): def test_first(self): print 'first test' print '-' def

Re: unittest help needed!

2010-01-14 Thread Oltmans
On Jan 14, 11:46 pm, exar...@twistedmatrix.com wrote: > When you run test.py, it gets to the loadTestsFromName line.  There, it > imports the module named "test" in order to load tests from it.  To > import > that module, it runs test.py again.  By the time it finishes running the > contents of t

Want to call a method only once for unittest.TestCase--but not sure how?

2009-09-28 Thread Oltmans
Hello fellow python hackers, I'm not an expert when it comes to Python and I'm totally stuck in a situation. All of our unit tests are written using built-in 'unittest' module. We've a requirement where we want to run a method only once for our unit tests. Some background: all of our tests are sub

Help resolve a syntax error on 'as' keyword (python 2.5)

2009-11-03 Thread Oltmans
Hi, all. All I'm trying to do is to print the error message using the following code (copying/pasting from IDLE). def div(a,b): print a/b try: div(5,0) except Exception as msg: print msg but IDLE says (while highlighting the 'as' keyword) except Exception as msg: SyntaxError: i

Adding methods from one class to another, dynamically

2010-02-01 Thread Oltmans
Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): pr

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Oltmans
thod): if name.find('test_')!= -1: setattr(tee, name, new.instancemethod(func,None,tee)) suite = unittest.defaultTestLoader.loadTestsFromName('check.tee') suite.run(r) --- Then line suite.run(r) should have run the methods that we just attached, but it's not. I

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Oltmans
On Feb 2, 2:14 am, Steve Holden wrote: > > Should not tee be subclassing test, not unittest.TestCase? > Thank you, Steve. This worked, but I've not clue why? Can you please enlighten me why sub-classing 'test' made it happen? Please. Thanks again. > regards >  Steve > -- > Steve Holden          

Converting HTML to PDF using Python?

2010-03-08 Thread Oltmans
so I will really appreciate all the help. Thanks in advance and kindly pardon my ignorance. Thanks, Oltmans -- http://mail.python.org/mailman/listinfo/python-list

Hosting a Python based TCP server

2010-12-23 Thread Oltmans
Hi all, I'm writing a very small TCP server(written in Python) and now I want to host it on some ISP so that it can be accessed anywhere from the Internet. I've never done that before so I thought I should ask for some advice. Do you guys know any good ISP that can let me do that? Most importantl

Line breaks in list causing a small formatting problem while joining the list

2011-01-21 Thread Oltmans
Hi Python gurus, hope you're doing well. I've a small problem. When I run the following code ___ >>> names = ['oltmans','abramhovic','\n','sal','lee'] >

Can someone please make it more pythonic or better?

2010-04-17 Thread Oltmans
int me to a more Pythonic, more readable and possible more short way to acheive this? I will really appreciate any help. Many thanks in advance. Best regards, Oltmans -- http://mail.python.org/mailman/listinfo/python-list

Kindly show me a better way to do it

2010-05-08 Thread Oltmans
Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]: for a in i: print a but I was wondering if there is a shorter, more elegant way to do it? -- http://mail.python.org/mailman/listinfo/

Re: Kindly show me a better way to do it

2010-05-08 Thread Oltmans
On May 9, 1:53 am, superpollo wrote: > add = lambda a,b: a+b > for i in reduce(add,a): >      print i This is very neat. Thank you. Sounds like magic to me. Can you please explain how does that work? Many thanks again. -- http://mail.python.org/mailman/listinfo/python-list

Some help needed with small multi-threaded program!

2010-05-17 Thread Oltmans
I've a small multi-threaded program that is written by keeping Producer-Consumer pattern in mind. In the Producer part of the program we create new users by doing a POST to a certain web URL whereas in the Consumer part of the program we try to login newly created users. Problem is that program sor

Does pickled objects work fine between different OS?

2010-05-26 Thread Oltmans
If I dump a Python dictionary into a file named "data.pkl" using Pickle module on a Linux operating system, will the data contained in "data.pkl" load fine in a Windows OS? I mean will I be able to load the dictionary data contained in "data.pkl" just fine on Windows XP? I could have tested it but

How to improve this code?

2009-09-14 Thread Oltmans
ea of using a variable named 'result' inside elementsPresent() doesn't sound very good. Any ideas will be highly appreciated. Thanks, Oltmans -- http://mail.python.org/mailman/listinfo/python-list

Re: How to improve this code?

2009-09-15 Thread Oltmans
call like are_elements_present([div1,div2,div10,inp1]) it should return False. So I hope I've explained myself. Now all I'm looking for is to write are_elements_presents() in a more Pythonic way. So please let me know if I can write are_elements_present() in more smart/shorter way. Than