Re: OT: C vs Python terminology

2013-06-16 Thread Dave Angel
On 06/16/2013 11:02 AM, Andreas Perstinger wrote: On 16.06.2013 14:55, Dave Angel wrote: On 06/16/2013 07:22 AM, Andreas Perstinger wrote: But it doesn't. It binds b to the same object to which a is currently bound. Are you aware that Denis was talking about the behaviour of C i

Re: OT: C vs Python terminology

2013-06-16 Thread Dave Angel
On 06/16/2013 07:22 AM, Andreas Perstinger wrote: On 16.06.2013 08:32, Denis McMahon wrote: C: int a, b; b = 6; a = b; In C, this places the numeric value 6 into the memory location identified by the variable "b", so far so good. then copies the value from the location pointed to by "b" in

Re: Fatal Python error: Py_Initialize: can't initialize sys standard streams

2013-06-15 Thread Dave Angel
On 06/15/2013 10:44 PM, lucabrasi wrote: On Saturday, June 15, 2013 5:03:27 PM UTC-7, MRAB wrote: On 15/06/2013 23:10, alex23 wrote: should be banned> Do you have a separate installation of Python? It's possible it may be conflicting. If you rename it's folder to something else

Re: Memory usage steadily going up while pickling objects

2013-06-14 Thread Dave Angel
On 06/14/2013 07:04 PM, Giorgos Tzampanakis wrote: I have a program that saves lots (about 800k) objects into a shelve database (I'm using sqlite3dbm for this since all the default python dbm packages seem to be unreliable and effectively unusable, but this is another discussion). The process ta

Re: Version Control Software

2013-06-14 Thread Dave Angel
On 06/14/2013 10:24 AM, Grant Edwards wrote: On 2013-06-14, Roy Smith wrote: All that being said, it is, as Anssi points out, a horrible, bloated, overpriced, complicated mess which requires teams of specially trained ClearCase admins to run. In other words, it's exactly the sort of thing big

Re: how to use two threads to produce even and odd numbers?

2013-06-14 Thread Dave Angel
On 06/14/2013 07:50 AM, Zoe Wendy wrote: Welcome to the forum. Are you new to Python? Are you new to programming? What version of Python are you using? Is this a class assignment? I am going to compile a small python program in order to use Queue to produce a random with a thread. Tha

Re: Turnign greek-iso filenames => utf-8 iso

2013-06-13 Thread Dave Angel
On 06/13/2013 05:46 PM, Chris Angelico wrote: On Fri, Jun 14, 2013 at 3:48 AM, Νικόλαος Κούρας wrote: You are right, but i still believe Stevn would not act maliciously in the server. He proved himself very helpfull already. You thought that about me, too. (And you were still correct.

Re: Creating a Super Simple WWW Link, Copy, & Paste into Spreadsheet Program

2013-06-13 Thread Dave Angel
On 06/13/2013 03:28 PM, buford.lum...@gmail.com wrote: Hi, I'm new to Python. Would someone be able to write me and/or to show me how to write a simple program that: Hi, welcome to Python, and to the Python-list It's NOT a simple program, except by a very constrained definition of simple.

Re: Debugging memory leaks

2013-06-13 Thread Dave Angel
On 06/13/2013 02:07 PM, writeson wrote: Dieter, Thanks for the response, and you're correct, debugging memory leaks is tough! So far I haven't had much luck other than determining I have a leak. I've used objgraph to see that objects are being created that don't seem to get cleaned up. What I

Re: Performance of list.index - how to speed up a silly algorithm?

2013-06-13 Thread Dave Angel
On 06/13/2013 10:55 AM, Onyxx wrote: I would convert your list to a pandas dataframe. You're leaving a message on a public forum without any context in the message, using a title that was apparently last used in 2010. Are you really trying to reply to a message from over 3 years ago??? --

Re: A few questiosn about encoding

2013-06-12 Thread Dave Angel
On 06/12/2013 05:24 AM, Steven D'Aprano wrote: On Wed, 12 Jun 2013 09:09:05 +, Νικόλαος Κούρας wrote: Isn't 14 bits way to many to store a character ? No. There are 1114111 possible characters in Unicode. (And in Japan, they sometimes use TRON instead of Unicode, which has even more.) I

Re: User Input

2013-06-12 Thread Dave Angel
On 05/30/2013 10:03 AM, Eternaltheft wrote: do you think ti would be better if i call drawBoard? Better is meaningless without context. Are you being charged per keystroke? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Survey of Python-in-browser technologies

2013-06-12 Thread Dave Angel
On 05/24/2013 08:38 PM, Carlos Nepomuceno wrote: Date: Fri, 24 May 2013 17:11:18 -0700 Subject: Re: Survey of Python-in-browser technologies From: drsali...@gmail.com To: carlosnepomuc...@outlook.com CC: python-list@python.org Security is an important topic...

Re: Simple algorithm question - how to reorder a sequence economically

2013-06-12 Thread Dave Angel
On 05/25/2013 09:49 PM, Roy Smith wrote: In article <15a1bb3a-514c-454e-a966-243c84123...@googlegroups.com>, John Ladasky wrote: Because someone's got to say it... "The generation of random numbers is too important to be left to chance." ‹ Robert R. Coveyou Absolutely. I know just enough

Re: Do you consider Python a 4GL? Why (not)?

2013-06-11 Thread Dave Angel
On 06/11/2013 03:48 PM, Laurent Pointal wrote: Dennis Lee Bieber wrote: On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg declaimed the following in gmane.comp.python.general: The C compiler suites used this ability to read the error log from a compile, and move to the line/column in

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Dave Angel
On 06/10/2013 06:54 PM, Chris Angelico wrote: On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards wrote: On 2013-06-10, Terry Jan Reedy wrote: Another principle similar to 'Don't add extraneous code' is 'Don't rebind builtins'. OK, we've all done it by accident (especially when starting out), b

Re: Popen and reading stdout in windows

2013-06-10 Thread Dave Angel
On 06/10/2013 02:37 PM, Joseph L. Casale wrote: I have a use where writing an interim file is not convenient and I was hoping to iterate through maybe 100k lines of output by a process as its generated or roughly anyways. Seems to be a common question on ST, and more easily solved in Linux. Anyo

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Dave Angel
On 06/10/2013 01:42 PM, Rui Maciel wrote: Peter Otten wrote: Have you read the code in the interpreter session I posted? If you do not agree that the demonstrated behaviour is puzzling I'll have to drop my claim... I don't see how it should be puzzling. You've deleted the attribute, so it c

Re: Questions on "import" and "datetime"

2013-06-10 Thread Dave Angel
On 06/10/2013 01:01 PM, Zachary Ware wrote: On Mon, Jun 10, 2013 at 10:37 AM, Yunfei Dai wrote: Hi all, Hi Yunfei, I have some questions on "import": 1."from datetime import datetime" works well. But I am confused why "import datetime.datetime" leads to importerror. "from xlrd import ope

Re: Trying to work with data from a query using Python.

2013-06-07 Thread Dave Angel
On 06/07/2013 01:44 PM, ethereal_r...@hotmail.com wrote: rows = cur.fetchall() for row in rows: print row Now assume that fetchall would print the following: I doubt if fetchall() prints anything. presumably it returns something, extracted from the db. LOEL

Re: trigger at TDM/2 only

2013-06-06 Thread Dave Angel
On 06/06/2013 08:03 PM, cerr wrote: Hi, I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm whic

Re: How to store a variable when a script is executing for next time execution?

2013-06-06 Thread Dave Angel
On 06/06/2013 06:50 AM, Avnesh Shakya wrote: hi, I am running a python script and it will create a file name like filename0.0.0 and If I run it again then new file will create one more like filename0.0.1.. my code is- i = 0 Redundant initialization of i. for i in range(1000):

Re: lstrip problem - beginner question

2013-06-04 Thread Dave Angel
On 06/04/2013 12:01 PM, Mark Lawrence wrote: On 04/06/2013 16:49, mstagliamonte wrote: [strip the double line spaced nonsense] Can you please check your email settings. It's bad enough being plagued with double line spaced mail from google, having it come from yahoo is just adding insult to in

Re: How to get an integer from a sequence of bytes

2013-06-03 Thread Dave Angel
On 06/03/2013 10:31 AM, Grant Edwards wrote: On 2013-06-03, Dennis Lee Bieber wrote: On Sun, 02 Jun 2013 21:25:45 +0200, Mok-Kong Shen declaimed the following in gmane.comp.python.general: b'7' is the byte with the character 7 in a certain code, so that's ok. In other PLs one assigns an int

Re: PyWart: The problem with "print"

2013-06-03 Thread Dave Angel
On 06/03/2013 04:49 AM, Mark Lawrence wrote: On 03/06/2013 04:10, Dan Sommers wrote: On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: ... If you don't believe me, you've never hit a bug that 'magically' disappears when you add a debugging print statement ;-). Ah, yes. The Heisenbug.

Re: Getting Error can't find '__main__' module in 'X'

2013-06-02 Thread Dave Angel
On 06/02/2013 07:04 AM, meakaakka wrote: Hey I am newbie in python.I have installed python 2.7.5 correctly.It is working fine but I am having some issues.I have set windows Enviroment variables. Please be a lot more specific. Do you have any particular environment variables you suspect, and

Re: Create a file in /etc/ as a non-root user

2013-05-31 Thread Dave Angel
On 05/31/2013 05:27 AM, Luca Cerone wrote: fd = open('/etc/file','w') fd.write('jpdas') fd.close() Hi Bibhu, that is not a Python problem, but a permission one. You should configure the permissions so that you have write access to the folder. However unless you know what you are doing it is

Re: User Input

2013-05-30 Thread Dave Angel
On 05/30/2013 09:10 AM, Eternaltheft wrote: yeah i found out why it wasn't defined before because i tried to put it into a function. That's not a sentence, and it doesn't make sense in any permutation I can do on it. this is my drawBoard function: import turtle as Turtle Turtle.title("Ch

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Dave Angel
On 05/30/2013 08:42 AM, bhk...@gmail.com wrote: http://wiki.python.org/moin/GoogleGroupsPython > In the above output, the control goes to "HERE AFTER SPLIT" after the "Merging" statement which is of-course the last statement in the function.On what condition this is happening. Ideally

Re: User Input

2013-05-30 Thread Dave Angel
On 05/30/2013 08:37 AM, Eternaltheft wrote: sorry about that, i got confused xD. yeah it works good now. what i meant to say was can i return a function that i made, if the user inputs nothing? There wouldn't be anything to stop you. However, if you have multiple returns from the same funct

Re: Short-circuit Logic

2013-05-29 Thread Dave Angel
On 05/29/2013 12:50 PM, Ian Kelly wrote: On Wed, May 29, 2013 at 8:33 AM, rusi wrote: 0.0 == 0.0 implies 5.4 == 5.4 is not a true statement is what (I think) Steven is saying. 0 (or if you prefer 0.0) is special and is treated specially. It has nothing to do with 0 being special. A floating

Re: Fatal Python error

2013-05-29 Thread Dave Angel
On 05/29/2013 08:45 AM, Oscar Benjamin wrote: On 29 May 2013 12:48, Joshua Landau wrote: Hello all, again. Instead of revising like I'm meant to be, I've been delving into a bit of Python and I've come up with this code: Here's a simpler example that gives similar results: $ py -3.3 Python 3

Re: Fatal Python error

2013-05-29 Thread Dave Angel
On 05/29/2013 07:48 AM, Joshua Landau wrote: Hello all, again. Instead of revising like I'm meant to be, I've been delving into a bit of Python and I've come up with this code: To start with, please post in text mode. By using html, you've completely messed up any indentation you presumably

Re: Python #ifdef

2013-05-28 Thread Dave Angel
On 05/28/2013 03:46 PM, Carlos Nepomuceno wrote: Are there Python 'preprocessor directives'? Python doesn't define a preprocessor, and CPYthon doesn't implement one. Nothing to stop you from doing so, however. I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a si

Re: Python for IPSA (Power flow analysis)

2013-05-28 Thread Dave Angel
On 05/28/2013 06:00 AM, Debbie wrote: Hi there, I am new to Python, Welcome. Could you tell us a little about yourself, such as whether you've experience in a few other languages, or if Python is your first programming experience? Also, what version of Python (presumably 2.7 or 2.6) and wh

Re: Problems with python and pyQT

2013-05-28 Thread Dave Angel
On 05/28/2013 05:41 AM, silusilus...@gmail.com wrote: Thanks for your reply: very useful!! I have another question: with hex command i display (for example) 0x1 is it possible to display 0x01? hex() is a function, not a command. And it only takes the one parameter, the int to be converted.

Re: How to get an integer from a sequence of bytes

2013-05-27 Thread Dave Angel
On 05/27/2013 08:31 PM, Steven D'Aprano wrote: On Mon, 27 May 2013 11:30:18 -0400, Ned Batchelder wrote: On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: From an int one can use to_bytes to get its individual bytes, but how can one reconstruct the int from the sequence of bytes? The next thing

Re: Reading *.json from URL - json.loads() versus urllib.urlopen.readlines()

2013-05-27 Thread Dave Angel
On 05/27/2013 04:47 PM, Bryan Britten wrote: Hey, everyone! I'm very new to Python and have only been using it for a couple of days, but have some experience in programming (albeit mostly statistical programming in SAS or R) so I'm hoping someone can answer this question in a technical way, b

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Dave Angel
On 05/25/2013 10:03 AM, Roy Smith wrote: In article <74e33270-a79a-4878-a400-8a6cda663...@googlegroups.com>, lokeshkopp...@gmail.com wrote: ya steven i had done the similar logic but thats not satisfying my professor he had given the following constrains 1. No in-built functions should be u

Re: Total Beginner - Extracting Data from a Database Online (Screenshot)

2013-05-24 Thread Dave Angel
On 05/24/2013 07:36 PM, Carlos Nepomuceno wrote: page = urllib2.urlopen("http://example.com/page.html";).read().strip() #to create the tables list tables=[[re.findall('(.*?)',r,re.S) for r in re.findall('(.*?)',t,re.S)] for t in re.findall('(.*?)',page,re.S)] Pretty simple. Good luck!

Re: Total Beginner - Extracting Data from a Database Online (Screenshot)

2013-05-24 Thread Dave Angel
On 05/24/2013 01:32 PM, logan.c.gra...@gmail.com wrote: Hey guys, I'm learning Python Welcome. and I'm experimenting with different projects -- I like learning by doing. I'm wondering if you can help me here: na What this is is a publicly-accessible webpage No, it's just a jpeg file, an

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Dave Angel
On 05/24/2013 12:32 PM, JackM wrote: So Chris, does this version look better? Changed to inFile to with. #!/usr/bin/python import os import time # Input, Output, and TimeStamp logFile = open('/var/www/html/statistics/logs/banList.log','w') stamp = time.asctime(time.localtime()) # Daily Flush

Re: suppress newlines in my script

2013-05-24 Thread Dave Angel
On 05/24/2013 09:59 AM, sloan...@gmail.com wrote: http://wiki.python.org/moin/GoogleGroupsPython > print PE2.format(count) Thanks for the tip about the CSV module. I did not know about that. So why aren't you using it? There's not much point in solving "the newlines pro

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-24 Thread Dave Angel
On 05/24/2013 04:04 AM, lokeshkopp...@gmail.com wrote: i need to write a code which can sort the list in order of 'n' without use builtin functions can anyone help me how to do? You could sort, but you couldn't print out the results, so what's the point? In Python 3.3 at least, print() is a

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Dave Angel
On 05/23/2013 11:26 AM, Carlos Nepomuceno wrote: Date: Thu, 23 May 2013 06:44:05 -0700 Subject: Re: PEP 378: Format Specifier for Thousands Separator From: prueba...@latinmail.com To: python-list@python.org [...] You left out the part where a and f are

Re: Debugging parallel nose tests?

2013-05-23 Thread Dave Angel
On 05/23/2013 09:09 AM, Roy Smith wrote: nosetests --process-timeout=60 --processes=40 test_api.py Do you have a 40-processor system? And do you have enough RAM to run all of those processes? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: help in obtaining binary equivalent of a decimal number in python

2013-05-23 Thread Dave Angel
On 05/23/2013 07:30 AM, lokeshkopp...@gmail.com wrote: i need to get 32 bit binary equivalent of a decimal and need to change the 0's to 1's and 1's to 0's For Example if the input is 2 Output should be: the 32bit equivalent of 2 : 0010 and the 1's compliment is

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Dave Angel
On 05/22/2013 04:46 AM, loial wrote: Is there any additional traceing I can do(either within my python code or on the network) to establish what is causing this error? Try using Wireshark. It can do a remarkable job of filtering, capturing, and analyzing packets. It can also rea

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Dave Angel
On 05/21/2013 06:32 AM, Cameron Simpson wrote: On 21May2013 17:56, Chris Angelico wrote: | On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | > - randrange() is like other python ranges: it does not include the end value. | > So your call picks a number from 0..58, not 0..59. | > S

Re: Please help with Threading

2013-05-20 Thread Dave Angel
On 05/20/2013 03:55 AM, Fábio Santos wrote: My use case was a tight loop processing an image pixel by pixel, or crunching a CSV file. If it only uses local variables (and probably hold a lock before releasing the GIL) it should be safe, no? Are you making function calls, using system libraries

Re: Harmonic distortion of a input signal

2013-05-19 Thread Dave Angel
On 05/19/2013 07:36 PM, killybear...@gmail.com wrote: One more question. Function np.argmax returns max of non-complex numbers ? Because FFT array of my signal is complex. It'd be easier to track the thread if you actually replied to the message you're responding to, and also if you included

Re: Please help with Threading

2013-05-19 Thread Dave Angel
On 05/19/2013 05:46 PM, Dennis Lee Bieber wrote: On Sun, 19 May 2013 10:38:14 +1000, Chris Angelico declaimed the following in gmane.comp.python.general: On Sun, May 19, 2013 at 10:02 AM, Carlos Nepomuceno wrote: I didn't know Python threads aren't preemptive. Seems to be something really o

Re: How to write fast into a file in python?

2013-05-18 Thread Dave Angel
On 05/18/2013 01:00 PM, Carlos Nepomuceno wrote: Python really writes '\n\r' on Windows. Just check the files. That's backwards. '\r\n' on Windows, IF you omit the b in the mode when creating the file. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Please help with Threading

2013-05-18 Thread Dave Angel
On 05/18/2013 04:58 AM, Jurgens de Bruin wrote: This is my first script where I want to use the python threading module. I have a large dataset which is a list of dict this can be as much as 200 dictionaries in the list. The final goal is a histogram for each dict 16 histograms on a page ( 4x

Re: How to write fast into a file in python?

2013-05-17 Thread Dave Angel
On 05/17/2013 12:35 AM, lokeshkopp...@gmail.com wrote: On Friday, May 17, 2013 8:50:26 AM UTC+5:30, lokesh...@gmail.com wrote: I need to write numbers into a file upto 50mb and it should be fast can any one help me how to do that? i had written the following code.. value = 0 with open(file

Re: spilt question

2013-05-16 Thread Dave Angel
On 05/16/2013 11:15 AM, Chris Angelico wrote: On Fri, May 17, 2013 at 1:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have

Re: spilt question

2013-05-16 Thread Dave Angel
On 05/16/2013 11:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help ap

Re: executing python scripts that are symlinked

2013-05-16 Thread Dave Angel
On 05/16/2013 04:29 AM, Charles Smith wrote: On 16 Mai, 10:18, Dave Angel wrote: On 05/16/2013 03:48 AM, Charles Smith wrote: Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that

Re: executing python scripts that are symlinked

2013-05-16 Thread Dave Angel
On 05/16/2013 03:48 AM, Charles Smith wrote: Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that works fine when it sits in directory WC, but if I move it out of WC to H and put a symlin

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 08:53 PM, Andrew Bradley wrote: So now, how can I utilize this new grid list? Thank you for the help so far, I feel like the entire grid is now being worked out. -Andrew That's a Pygame question, and I told you at the beginning, I can't really help with that. I'd like t

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
Please put new comments AFTER the part you're quoting. In other words, don't top-post. Also please trim off the stuff that's no longer relevant, so people don't have to read through it all wondering where your implied comments are. On 05/15/2013 06:48 PM, Andrew Bradley wrote: ok, now I hav

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 02:14 PM, Andrew Bradley wrote: Please reply on the list, not privately, unless it's something like a simple thank-you. Typically, you'd do a reply-all, then delete the people other than the list itself. Or if you're using Thunderbird, you could just reply-list. > Thank you v

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 12:56 PM, Andrew Bradley wrote: Hello everyone. I am having a good time programming with Python 3.3 and Pygame. Pygame seems like the perfect platform for the kind of simple games that I want to make. Pygame indeed looks pretty good to me as well. But I haven't done anything w

Re: Determine actually given command line arguments

2013-05-15 Thread Dave Angel
On 05/15/2013 08:24 AM, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know which of its namespace members were actually hit during parse_args(). I t

Re: Python for philosophers

2013-05-13 Thread Dave Angel
On 05/13/2013 07:32 PM, Citizen Kant wrote: Am I getting closer to the point? Depends on whom you think you're talking to. Clearly, you've replied to yourself, and top-posted besides. That's not a conversation, it's a monologue. -- DaveA -- http://mail.python.org/mailman/listi

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Dave Angel
On 05/13/2013 07:30 PM, Cameron Simpson wrote: On 13May2013 19:22, Dave Angel wrote: | On 05/13/2013 06:53 PM, Mark Lawrence wrote: | >I much prefer the alternative <> for != but some silly people insisted | >that this be removed from Python3. Just how stupid can you get? | | So w

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Dave Angel
On 05/13/2013 06:53 PM, Mark Lawrence wrote: On 13/05/2013 22:17, Alister wrote: On Mon, 13 May 2013 19:28:29 +0100, Fábio Santos wrote: I think it is more readable. When doing more complicated statements I use != instead, but when it's a single test I prefer not … == It's a personal thing. I

Re: in need of some help regarding my rock paper scissors game

2013-05-12 Thread Dave Angel
On 05/12/2013 03:33 PM, Alex Norton wrote: im new to python and im in the middle of making a RPS game for a college unit. i have used PyQt to create the GUI and i have received help regarding adding the code to the buttons. I'm not at all familiar with PyQT, but I have used other GUIs, and I'm

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 05:22 PM, rlelis wrote: On Thursday, May 9, 2013 7:19:38 PM UTC+1, Dave Angel wrote: Yes it's a list of string. I don't get the NameError: name 'file_content' is not defined in my code. That's because you have the 3 lines below which we hadn't see

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 12:14 PM, rlelis wrote: On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: @Dave Angel this is how i mange to read and store the data in file. data = [] # readdata f = open(source_file, 'r') for line in f: header = (line.strip()).lower() # con

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 10:33 AM, rlelis wrote: I apologize once again. Is my first post here and i'm getting used to the group as long as i get the feedback of my errors by you guys. I'm using Python 2.7.3 with no dependencies, i'm simply using the standard library. Here is the "big picture" of the scena

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 05:57 AM, rlelis wrote: On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: Hi guys, I'm working on this long file, where i have to keep reading and storing different excerpts of text (data) in different variables (list). Once done that i want to store in dicts the dat

Re: help on Implementing a list of dicts with no data pattern

2013-05-08 Thread Dave Angel
On 05/08/2013 07:47 PM, rlelis wrote: Hi guys, Please read this http://wiki.python.org/moin/GoogleGroupsPython. I'm working on this long file, where i have to keep reading and storing different excerpts of text (data) in different variables (list). Once done that i want to store in dicts t

Re: Get filename using filefialog.askfilename

2013-05-08 Thread Dave Angel
On 05/08/2013 04:14 PM, cheirasa...@gmail.com wrote: El martes, 7 de mayo de 2013 23:53:32 UTC+2, Terry Jan Reedy escribió: On 5/7/2013 4:27 PM, cheirasa...@gmail.com wrote: Yeah. This is an answer. A lot of thanks. For a moment there, I thought you were being sarcastic, and ungra

Re: Globally available I/O connection (K8055 I/O board)

2013-05-08 Thread Dave Angel
On 05/08/2013 04:50 PM, flex...@gmail.com wrote: I'm having a bit of an issue trying to make a globally available connection to my Velleman K8055 I/O board... I've documented my issue as best I can here: http://stackoverflow.com/questions/16449706/python-access-global-instance-of-connection

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 11:40 PM, Steven D'Aprano wrote: These are all Unicode characters too. Unicode is a subset of ASCII, so anything which is ASCII is also Unicode. Typo. You meant Unicode is a superset of ASCII. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 10:06 PM, Andrew Berg wrote: On 2013.05.07 20:28, Neil Hodgson wrote: http://support.microsoft.com/kb/74496 http://en.wikipedia.org/wiki/Nul_%28band%29 I can indeed confirm that at least 'nul' cannot be used as a filename. However, I add an extension to the file names to identify

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 09:28 PM, Neil Hodgson wrote: Andrew Berg: This is not a Unicode issue since (modern) file systems will happily accept it. The issue is that certain characters (which are ASCII) are not allowed on some file systems: \ / : * ? "< > | @ and the NUL character The first 9 are not

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Dave Angel
On 05/07/2013 09:11 PM, Benjamin Kaplan wrote: On May 7, 2013 5:42 PM, "Neil Hodgson" wrote: jmfauth: 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or "ascii" typographers !) ... This is not demonstrating non-compliance. It is comparing performan

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 08:51 PM, Andrew Berg wrote: On 2013.05.07 19:14, Dave Angel wrote: You also need to decide how to handle Unicode characters, since they're different for different OS. In Windows on NTFS, filenames are in Unicode, while on Unix, filenames are bytes. So on one of those, you

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 03:58 PM, Andrew Berg wrote: Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However, artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forwar

Re: use python to split a video file into a set of parts

2013-05-07 Thread Dave Angel
On 05/07/2013 07:15 AM, iMath wrote: I use the following python code to split a FLV video file into a set of parts ,when finished ,only the first part video can be played ,the other parts are corrupted.I wonder why and Is there some correct ways to split video files There are two parts to an

Re: Trying to understand the memory occupation of big lists

2013-05-03 Thread Dave Angel
On 05/03/2013 07:24 AM, Michele Simionato wrote: I have a memory leak in a program using big arrays. Actually, big lists. Python also has arrays, and they're entirely different. With the goal of debugging it I run into the memory_profiler module. Then I discovered something which is surpri

Re: query from sqlalchemy returns AttributeError: 'NoneType' object

2013-05-02 Thread Dave Angel
On 05/02/2013 06:14 PM, karthik.sha...@gmail.com wrote: from pox.core import core import pox.openflow.libopenflow_01 as of import re import datetime You're mixing tabs and space, so all bets are off. No promise that the compiler will interpret the indentations the same way yo

Re: python process accounting

2013-04-30 Thread Dave Angel
On 04/30/2013 12:38 PM, Dave Angel wrote: Oops, a typo. See below. On 04/30/2013 12:25 PM, Rita wrote: Hi, I was wondering if it possible to write a python wrapper which will account my processes. I would like to account for all the children processes (fork) by looking at their /proc/ info

Re: python process accounting

2013-04-30 Thread Dave Angel
On 04/30/2013 12:25 PM, Rita wrote: Hi, I was wondering if it possible to write a python wrapper which will account my processes. I would like to account for all the children processes (fork) by looking at their /proc/ info. Such as memory, io, open files, stats. So, instead of me running "/bin

Re: shmid = shmget(SHM_KEY, SHM_SIZE, 0o666) - syntax error.

2013-04-30 Thread Dave Angel
On 04/30/2013 11:49 AM, Chris Angelico wrote: On Wed, May 1, 2013 at 1:43 AM, Dave Angel wrote: On 04/30/2013 11:27 AM, tro...@mdlogix.com wrote: Please help me to debug --- shmid = shmget(SHM_KEY, SHM_SIZE, 0o666

Re: shmid = shmget(SHM_KEY, SHM_SIZE, 0o666) - syntax error.

2013-04-30 Thread Dave Angel
On 04/30/2013 11:27 AM, tro...@mdlogix.com wrote: Please help me to debug --- shmid = shmget(SHM_KEY, SHM_SIZE, 0o666) ^ SyntaxError: invalid syntax 0o666 is indeed a syntax error. What is that value supposed to be? If

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-30 Thread Dave Angel
On 04/30/2013 08:22 AM, alternativ...@rocketmail.com wrote: > Dave A. Yeah I'm using MRAB's code, my current code is : #Initalisation global event global hitkey #Functions def key(event): hitkey = event.char instance = multiprocessing.Process(target=player,

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread Dave Angel
On 04/29/2013 09:17 PM, alternativ...@rocketmail.com wrote: I thought 'clause' was reffering to the 'if __name__ == "__main__":' thing in English, but apparently not. Well except the import and the 'globalization' of my variables, every thing is idented. No clue whom you think you're replyin

Re: repeat program

2013-04-29 Thread Dave Angel
On 04/29/2013 08:22 PM, eschneide...@comcast.net wrote: How do I make the following program repeat twice instead of asking whether the player wants to play again? Turn it into a function call, and call that function twice from top-level. Or, more generally, for i in range(2): doit()

Re: Mystery of module bindings!

2013-04-29 Thread Dave Angel
On 04/29/2013 04:03 PM, Dave Angel wrote: Please ignore my previous response, obviously I misread your question entirely. I've never used a startup file, so I misread it as "script file". Yes, you need a separate import from any module that references numpy. Don't wor

Re: Mystery of module bindings!

2013-04-29 Thread Dave Angel
On 04/29/2013 03:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) impor

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Dave Angel
On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. Please mention your Python version & OS. Apparently you're running 2.7 on Linux or similar. I am debugging

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-28 Thread Dave Angel
On 04/28/2013 07:40 PM, alternativ...@rocketmail.com wrote: Well I saw this clause on most of the multiprocessing examples I saw but the reason it was here wasn't explained so I just ignored it (yeah stupid I know). I don't think I bypassed anything, Yes, you skipped the essential if clause.

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-28 Thread Dave Angel
On 04/28/2013 06:23 PM, alternativ...@rocketmail.com wrote: Sorry for my bad english. Here's my code : def key(event): instance = 'Instance' touche = event.char instance = multiprocessing.Process(target=player, args=(hitkey,)) instance.start() d

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-28 Thread Dave Angel
On 04/28/2013 02:33 PM, alternativ...@rocketmail.com wrote: Hi everyone, I'm trying to use multiprocessing to avoid Python's GIL but with Tkinter, instead of running my main function, it spawns new windows. In fact, my fuction is used everytime I press a specified key, but with multiprocessing

Re: "python.exe has stopped working" when os.execl() runs on Windows 7

2013-04-27 Thread Dave Angel
On 04/27/2013 09:05 PM, cormog...@gmail.com wrote: Yes, just those two lines cause the error. 'filename.exe' exists and runs ok in the command prompt. Any other executable cause the problem, also '', for example: os.execl('','') If doesn't work on Windows it should give an error message, righ

Re: "python.exe has stopped working" when os.execl() runs on Windows 7

2013-04-27 Thread Dave Angel
On 04/27/2013 08:22 PM, cormog...@gmail.com wrote: Was trying os.execl() and got a "python.exe has stopped working" on my Windows 7 Ultimate SP1 x64 desktop. I'm using Python 2.7.4 and that happens when the second arg is ''. For example: os.execl('filename.exe','') Wtf? :( http://postimg.or

Re: CPython's cyclic garbage collector (was [Python-ideas] Automatic context managers)

2013-04-26 Thread Dave Angel
On 04/26/2013 06:50 PM, Ian Kelly wrote: On Fri, Apr 26, 2013 at 10:54 AM, Chris Angelico wrote: Once it's been proven that there's an unreferenced cycle, why not simply dispose of one of the objects, and replace all references to it (probably only one - preferably pick an object with the fewes

<    6   7   8   9   10   11   12   13   14   15   >