Re: Trying to understand html.parser.HTMLParser

2011-05-16 Thread Karim
On 05/16/2011 03:06 AM, David Robinow wrote: On Sun, May 15, 2011 at 4:45 PM, Andrew Berg wrote: I'm trying to understand why HMTLParser.feed() isn't returning the whole page. My test script is this: import urllib.request import html.parser class MyHTMLParser(html.parser.HTMLParser): def h

Re: obviscating python code for distribution

2011-05-16 Thread geremy condra
On Sun, May 15, 2011 at 10:41 PM, Littlefield, Tyler wrote: > Hello: > Thanks all for your information and ideas. I like the idea of open source; I > have a fairly large (or large, by my standards anyway) project that I am > working on that is open source. > > Here's kind of what I want to prevent

Re: Import on case insensitive filesystem

2011-05-16 Thread Gabriel Genellina
En Fri, 13 May 2011 15:43:23 -0300, Mitchell Hashimoto escribió: I'm developing an app which runs Python on a filesystem which is not case sensitive (Mac OS X), but is mounted as an NFS drive on a remote machine. This causes errors because of the import being case sensitive but accessing an

Convert AWK regex to Python

2011-05-16 Thread J
Good morning all, Wondering if you could please help me with the following query:- I have just started learning Python last weekend after a colleague of mine showed me how to dramatically cut the time a Bash script takes to execute by re-writing it in Python. I was amazed at how fast it ran. I

Re: Convert AWK regex to Python

2011-05-16 Thread Chris Angelico
On Mon, May 16, 2011 at 6:19 PM, J wrote: > cat logs/pdu_log_fe.log | awk -F\- '{print $1,$NF}' | awk -F\. '{print > $1,$NF}' | awk '{print $1,$4,$5}' | sort | uniq | while read service command > status; do echo "Service: $service, Command: $command, Status: $status, > Occurrences: `grep $servi

Re: Convert AWK regex to Python

2011-05-16 Thread J
Good morning Angelico, Do I understand correctly? Do you mean incorporating a Python dict inside the AWK command? How can I do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert AWK regex to Python

2011-05-16 Thread Chris Angelico
On Mon, May 16, 2011 at 6:43 PM, J wrote: > Good morning Angelico, > Do I understand correctly? Do you mean incorporating a Python dict inside the > AWK command? How can I do this? No, inside Python. What I mean is that you can achieve the same uniqueness requirement by simply storing the interm

Re: obviscating python code for distribution

2011-05-16 Thread Steven D'Aprano
On Sun, 15 May 2011 23:41:23 -0600, Littlefield, Tyler wrote: > Here's kind of what I want to prevent. I want to write a multi-player > online game; everyone will essentually end up connecting to my server to > play the game. I don't really like the idea of security through > obscurity, but I want

Re: obviscating python code for distribution

2011-05-16 Thread Chris Angelico
On Mon, May 16, 2011 at 6:49 PM, Steven D'Aprano wrote: > If your answer is "No cheating is acceptable", then you have to do all > the computation on the server, nothing on the client, and to hell with > performance. All your client does is the user interface part. > > If the answer is, "Its a MUD

Re: turn monitor off and on

2011-05-16 Thread Gabriel Genellina
En Sat, 14 May 2011 03:08:44 -0300, Astan Chee escribió: I'm trying to turn off my monitor, pause and then turn it on again. I'm doing this in python 2.6 and windows xp. Here is my script so far (that doesn't work): def turnOnMonitor(): SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32

Re: obviscating python code for distribution

2011-05-16 Thread Jean-Michel Pichavant
Littlefield, Tyler wrote: Hello: Thanks all for your information and ideas. I like the idea of open source; I have a fairly large (or large, by my standards anyway) project that I am working on that is open source. Here's kind of what I want to prevent. I want to write a multi-player online

Re: Convert AWK regex to Python

2011-05-16 Thread Peter Otten
J wrote: > Good morning all, > Wondering if you could please help me with the following query:- > I have just started learning Python last weekend after a colleague of mine > showed me how to dramatically cut the time a Bash script takes to execute > by re-writing it in Python. I was amazed at ho

Re: Converting a set into list

2011-05-16 Thread Duncan Booth
Chris Torek wrote: > >>> x = [3, 1, 4, 1, 5, 9, 2, 6] > >>> x > [3, 1, 4, 1, 5, 9, 2, 6] > >>> list(set(x)) > [1, 2, 3, 4, 5, 6, 9] > >>> > > Of course, this trick only works if all the list elements are > hashable. > > This might not be the best example since the result

Re: Convert AWK regex to Python

2011-05-16 Thread J
Hello Peter, Angelico, Ok lets see, My aim is to filter out several fields from a log file and write them to a new log file. The current log file, as I mentioned previously, has thousands of lines like this:- 2011-05-16 09:46:22,361 [Thread-4847133] PDU D All the lines in the log file are sim

Re: Convert AWK regex to Python

2011-05-16 Thread Steven D'Aprano
On Mon, 16 May 2011 03:57:49 -0700, J wrote: > Most of the fields are separated by > spaces except for couple of them which I am processing with AWK > (removing " to do is evaluate each line in the log file and break them down into > fields which I can call individually and write them to a new log

Re: Convert AWK regex to Python

2011-05-16 Thread Peter Otten
J wrote: > Hello Peter, Angelico, > > Ok lets see, My aim is to filter out several fields from a log file and > write them to a new log file. The current log file, as I mentioned > previously, has thousands of lines like this:- 2011-05-16 09:46:22,361 > [Thread-4847133] PDU D CC_SMS_SERVICE_514

Re: obviscating python code for distribution

2011-05-16 Thread Nobody
On Sun, 15 May 2011 23:41:23 -0600, Littlefield, Tyler wrote: > Here's kind of what I want to prevent. I want to write a multi-player > online game; everyone will essentually end up connecting to my server to > play the game. I don't really like the idea of security through > obscurity, but I w

Re: problem with GKT module?

2011-05-16 Thread alister ware
On Sun, 15 May 2011 20:42:46 -0500, harrismh777 wrote: > Alister Ware wrote: >> I have a simple call back defined for a radio button widget when I use >>> widget.name in linux I get a value of None, windows returns the >>> widget name as I would expect. >>> >>> > First, not familiar with your is

Re: Parsing a graph image

2011-05-16 Thread Bastian Ballmann
Hi, the project sounds like the exact tool that i need but regarding the user manual one has to mark the points on the graph manually. Therefore it's more work to get the data out than doing it without a tool. Or may I miss something here? Greets Basti Am Fri, 13 May 2011 14:38:45 -0500 schrieb

Re: obviscating python code for distribution

2011-05-16 Thread Grant Edwards
On 2011-05-16, Ben Finney wrote: > "Littlefield, Tyler" writes: > >> I'm putting lots of work into this. I would rather not have some >> script kiddy dig through it, yank out chunks and do whatever he wants. >> I just want to distribute the program as-is, not distribute it and >> leave it open to

Re: Convert AWK regex to Python

2011-05-16 Thread J
Thanks for the sugestions Peter, I will give them a try Peter Otten wrote: > J wrote: > > > Hello Peter, Angelico, > > > > Ok lets see, My aim is to filter out several fields from a log file and > > write them to a new log file. The current log file, as I mentioned > > previously, has thousands o

Re: Convert AWK regex to Python

2011-05-16 Thread Giacomo Boffi
J writes: > cat logs/pdu_log_fe.log | awk -F\- '{print $1,$NF}' | awk -F\. '{print > $1,$NF}' | awk '{print $1,$4,$5}' | sort | uniq | while read service command > status; do echo "Service: $service, Command: $command, Status: $status, > Occurrences: `grep $service logs/pdu_log_fe.log | grep $

Re: Converting a set into list

2011-05-16 Thread TheSaint
Thomas Rachel wrote: > Which loops do you mean here? list(set) has been proved to largely win against list = [] for item in set: list.append(item) or [list.append(item) for item in set] -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-16 Thread Littlefield, Tyler
>Funny you should mention this "now" I don't go around parading the info, until I have to. >Yes I agree Flash is not very accessible (never has been). >Web Standards web apps and such however are quite >accessible! If I was making a browser-based game, yes. As I'm not though... Anyway, thanks to

Re: obviscating python code for distribution

2011-05-16 Thread Ian Kelly
On Mon, May 16, 2011 at 12:17 AM, Littlefield, Tyler wrote: >>Write your "game" for the "web". >>Write is as a SaaS (Software as a Service) - even if it's free and open >> source. > I understood you loud and clear. And that makes a lot of assumptions on my > game and the design. I don't really car

Re: Parsing a graph image

2011-05-16 Thread Robert Kern
On 5/16/11 8:38 AM, Bastian Ballmann wrote: Hi, the project sounds like the exact tool that i need but regarding the user manual one has to mark the points on the graph manually. Therefore it's more work to get the data out than doing it without a tool. Or may I miss something here? You are pr

Re: Convert AWK regex to Python

2011-05-16 Thread Matt Berends
This doesn't directly bear upon the posted example, but I found the following tutorial extremely helpful for learning how to parse log files with idiomatic python. Maybe you'll might find it useful, too. http://www.dabeaz.com/generators/ http://www.dabeaz.com/generators/Generators.pdf -- http://

KAJAL old pictures

2011-05-16 Thread Elisha trisha4uuu.blogspot.com
she is good and most poplar actress she is looking very cute and milky white and big eyes and good looking she always smiley face she act wit top and young hero's Ramcharan teja, JR.Ntr, Ram,Prabas,Kalyanram,Allu Arjun, and also top tamil hero's her more pictures wallpapers photos for you watch and

Re: obviscating python code for distribution

2011-05-16 Thread Tim Chase
On 05/15/2011 10:29 PM, Ben Finney wrote: What is it you think you would gain by obfuscating the code, and why is that worthwhile? What evidence do you have that code obfuscation would achieve that? Based on past experience at several employers', the preeminent reason for obfuscating is to mak

Re: Convert AWK regex to Python

2011-05-16 Thread MRAB
On 16/05/2011 09:19, J wrote: [snip] #!/usr/bin/python # Import RegEx module import re as regex # Log file to work on filetoread = open('/tmp/ pdu_log.log', "r") # File to write output to filetowrite = file('/tmp/ pdu_log_clean.log', "w") # Perform filtering in the log file linetoread = filetor

regular expression i'm going crazy

2011-05-16 Thread Tracubik
pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? i want my re_s to find linka and la, he just find link and l and forget about the ending a. can anyone help me? trying the regular expressio

Re: regular expression i'm going crazy

2011-05-16 Thread Robert Kern
On 5/16/11 11:25 AM, Tracubik wrote: pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? i want my re_s to find linka and la, he just find link and l and forget about the ending a. can anyone

Re: regular expression i'm going crazy

2011-05-16 Thread Alexander Kapps
On 16.05.2011 18:25, Tracubik wrote: pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? As the docs say: "If one or more groups are present in the pattern, return a list of groups;" http

Re: regular expression i'm going crazy

2011-05-16 Thread andy baxter
On 16/05/11 17:25, Tracubik wrote: pls help me fixing this: import re s = "linka la baba" re_s = re.compile(r'(link|l)a' , re.IGNORECASE) print re_s.findall(s) output: ['link', 'l'] why? i want my re_s to find linka and la, he just find link and l and forget about the ending a. The round br

Image processing to auto adjust colors in python ?

2011-05-16 Thread goldtech
Hi, I'm processing thumbnails with python but one thing I need to do is to auto-adjust an image for the "best" colors. I am using ffmpeg to get thumbs three seconds into a video, sometimes the image is too dark. Normally I'd go into something like the windows program Irfan View and do "Auto Adjus

Re: Image processing to auto adjust colors in python ?

2011-05-16 Thread Nobody
On Mon, 16 May 2011 10:11:43 -0700, goldtech wrote: > I'm processing thumbnails with python but one thing I need to do is to > auto-adjust an image for the "best" colors. I am using ffmpeg to get > thumbs three seconds into a video, sometimes the image is too dark. > Normally I'd go into somethin

Call for Papers (CFP)

2011-05-16 Thread saeed
= Journal of Emerging Trends in Computing and Information Sciences Call for Research Papers (Vol. 2 No. 6) June 2011 http://cisjournal.org/ = Dear Sir/ Madam, Journal of Emerging Trends

Re: obviscating python code for distribution

2011-05-16 Thread harrismh777
Steven D'Aprano wrote: To put it in a nutshell, you can't trust*anything*. See the classic paper by Ken Thompson, "Reflections on Trusting Trust": This is true, but there's another way to put it pro-active--- ... expect the client to be untrustworthy. In other words, write the server code

Re: problem with GKT module?

2011-05-16 Thread harrismh777
alister ware wrote: def callback(self,widget,data=None): print widget #gives reference to radio button ok print widget.name #widget name on windoze, None on linux Well, you're obviously using Python 2.x ... ... have you

Re: Get the IP address of WIFI interface

2011-05-16 Thread Anssi Saari
Neal Becker writes: > Here's some useful snippits for linux: > > def get_default_if(): > f = open('/proc/net/route') > for i in csv.DictReader(f, delimiter="\t"): > if long(i['Destination'], 16) == 0: > return i['Iface'] > return None > > def get_ip_address(ifname)

Re: problem with GKT module?

2011-05-16 Thread Anssi Saari
Alister Ware writes: > On Fri, 13 May 2011 13:13:00 +, alister ware wrote: > >> I am using gtk.builder with a glade generated GUI >> >> I have a simple call back defined for a radio button widget when I use >> widget.name in linux I get a value of None, windows returns the widget >> name as

Re: Memcached in python 3

2011-05-16 Thread Dan Stromberg
Do you need something shared across multiple hosts? Across multiple CPU's of the same host? Or single process? By "Python Dictionary Manager", do you mean the manager stuff in the multiprocessing module? On Sun, May 15, 2011 at 9:52 PM, Navkirat Singh wrote: > Hi Guys, > > How can I used memc

Re: obviscating python code for distribution

2011-05-16 Thread Rhodri James
On Mon, 16 May 2011 03:21:00 +0100, Daniel Kluev wrote: On Mon, May 16, 2011 at 1:04 PM, Littlefield, Tyler wrote: Hello all: Finally, is there a good way to accomplish this? I know that I can make .pyc files, but those can be disassembled very very easily with the disassembler and shi

pythonwebkit-gtk, pythonwebkit-dfb

2011-05-16 Thread Luke Kenneth Casson Leighton
in preparation for a 0.8 release of pyjamas, a bit of work has been done on pythonwebkit (http://www.gnu.org/software/pythonwebkit) that makes it easier to compile and install. pythonwebkit provides full and complete (see caveats below!) bindings to web browser functionality... in python. what yo

Re: Get the IP address of WIFI interface

2011-05-16 Thread Jun Hu
Thanks, this code works perfectly in ubuntu 10.04. one question though, is dbus usually implemented in other distribution of linux? On Mon, May 16, 2011 at 12:57 PM, Anssi Saari wrote: > Neal Becker writes: > > One possible solution in Linux is asking NetworkManager, if it's in > use. It knows

Deleting a file?

2011-05-16 Thread garyr
A file can be deleted by opening it with mode os.O_TEMPORARY and then closing it. How can a file be moved to the Recycle Bin, a la Windows? -- http://mail.python.org/mailman/listinfo/python-list

Re: obviscating python code for distribution

2011-05-16 Thread Ben Finney
"Littlefield, Tyler" writes: > I wanted to make the client in python, and the server possibly, though > I'm not really sure on that. I was not worried about the code for the > server being stolen, as much as I was worried about people tinkering > with the client code for added advantages. Thank

Re: obviscating python code for distribution

2011-05-16 Thread Ben Finney
Grant Edwards writes: > On 2011-05-16, Ben Finney wrote: > > "Littlefield, Tyler" writes: > > > >> I'm putting lots of work into this. I would rather not have some > >> script kiddy dig through it, yank out chunks and do whatever he > >> wants. I just want to distribute the program as-is, not d

Re: obviscating python code for distribution

2011-05-16 Thread Ben Finney
"Littlefield, Tyler" writes: > Anyway, thanks to everyone else who answered this thread. I've not > done much like this besides muds, and all the logic is on the server > there, I think I will build the client in python, open source it for > people to fix/add to if they want and make sure to keep

Re: Converting a set into list

2011-05-16 Thread Ben Finney
TheSaint writes: > Thomas Rachel wrote: > > > Which loops do you mean here? > > list(set) has been proved to largely win against > list = [] > for item in set: > list.append(item) > or [list.append(item) for item in set] Remember that the criterion of speed is a matter of the implementation,

Re: Trying to understand html.parser.HTMLParser

2011-05-16 Thread Andrew Berg
On 2011.05.16 02:26 AM, Karim wrote: > Use regular expression for bad HTLM or beautifulSoup (google it), below > a exemple to extract all html links: > > linksList = re.findall('.*?',htmlSource) > for link in linksList: > print link I was afraid I might have to use regexes (mostly because I c

Re: Converting a set into list

2011-05-16 Thread Chris Torek
>Chris Torek wrote: >> >>> x = [3, 1, 4, 1, 5, 9, 2, 6] >> >>> list(set(x)) >> This might not be the best example since the result is sorted >> "by accident", while other list(set(...)) results are not. In article , Duncan Booth wrote: >A minor change to your example makes it out of or

Re: Deleting a file?

2011-05-16 Thread Ben Finney
"garyr" writes: > A file can be deleted by opening it with mode os.O_TEMPORARY and then > closing it. Much simpler: ‘os.remove(path)’. > How can a file be moved to the Recycle Bin, a la Windows? That's not deleting it (as you probably know), so you might better change the subject field for th

Re: Deleting a file?

2011-05-16 Thread Jerry Hill
On Mon, May 16, 2011 at 5:23 PM, garyr wrote: > A file can be deleted by opening it with mode os.O_TEMPORARY and then > closing it. How can a file be moved to the Recycle Bin, a la Windows? I see a send2trash module (http://hg.hardcoded.net/send2trash and http://www.hardcoded.net/articles/send-fi

Re: obviscating python code for distribution

2011-05-16 Thread alex23
"Littlefield, Tyler" wrote: > Anyway, thanks to everyone else who answered this thread. I've not done > much like this besides muds, and all the logic is on the server there, I > think I will build the client in python, open source it for people to > fix/add to if they want and make sure to keep t

Re: Memcached in python 3

2011-05-16 Thread Navkirat Singh
On Tue, May 17, 2011 at 4:07 AM, Dan Stromberg wrote: > > Do you need something shared across multiple hosts? Across multiple CPU's > of the same host? Or single process? > > By "Python Dictionary Manager", do you mean the manager stuff in the > multiprocessing module? > > On Sun, May 15, 2011

Python 3 vs Python 2.7 dilemma

2011-05-16 Thread Navkirat Singh
Hi Guys, I have been trying to fight this issue for sometime now. I know that a large part of the python 3rd party software base has not been ported to python 3 yet. I am trying to build a web-based enterprise solution for my client. Most of reputed frameworks like Django and Turbo gears are yet i

indirect assignment question

2011-05-16 Thread Andy Baxter
Hi, I have some lines of code which currently look like this: self.window = self.wTree.get_widget("mainWindow") self.outputToggleMenu = self.wTree.get_widget("menuitem_output_on") self.outputToggleButton = self.wTree.get_widget("button_toggle_output") self.logView = sel

Re: indirect assignment question

2011-05-16 Thread Chris Rebert
On Mon, May 16, 2011 at 10:13 PM, Andy Baxter wrote: > Hi, > > I have some lines of code which currently look like this: > >      self.window = self.wTree.get_widget("mainWindow") >      self.outputToggleMenu = self.wTree.get_widget("menuitem_output_on") >      self.outputToggleButton = self.wTree

Re: indirect assignment question

2011-05-16 Thread Ben Finney
Andy Baxter writes: > with something like this: > widgetDic = { >"mainWindow": self.window, >"menuitem_output_on": self.outputToggleMenu, >"button_toggle_output": self.outputToggleButton, >"textview_log": self.logView, >"scrolled

Re: obviscating python code for distribution

2011-05-16 Thread Dotan Cohen
On Mon, May 16, 2011 at 07:40, Chris Angelico wrote: > And I'm sure Steven will agree with me that this is not in any way a > bad thing. I've written hundreds of such programs myself (possibly > thousands), and they have all served their purposes. On a slightly > larger scale, there are even more

Re: obviscating python code for distribution

2011-05-16 Thread Chris Angelico
On Tue, May 17, 2011 at 4:16 PM, Dotan Cohen wrote: > Actually, Chris, those applications are probably no less valuable to > be open source than Linux or Firefox. The reason is that when one goes > to learn a new language it is valuable to look at existing real world > code. However, the code avai