How to bypass Windows 'cooking' the I/O? (One more time, please) II

2008-07-07 Thread norseman
I know I saw the answer recently, as in since February '08, but I can't re-find it. :( I tried the mail archives and such and my own collections but the piece I saw still eludes me. Problem: (sos=same old s...) Microsoft insists the world work it's way even when the Microsoft way was pro

Re: Cross Compiler for Python?

2008-07-07 Thread norseman
I think I should have not used the 'reply' button but rather sent it back through the [EMAIL PROTECTED] So here here goes. === Hendrik van Rooyen wrote: Up to now, I have been innocently using the vanilla python that comes with the Linux distribution (Suse in my case). For the

Re: How to bypass Windows 'cooking' the I/O? (One more time, please) II

2008-07-07 Thread norseman
Dennis Lee Bieber wrote: On Mon, 07 Jul 2008 01:03:10 -0700, norseman <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > Normal file I/O sequence: > > fp = open(target, 'wb') > > fp.seek(-1, 2) > > fp.write(record) >

Re: How to make python scripts .py executable, not bring up editor

2008-07-07 Thread norseman
korean_dave wrote: From command Prompt, i type in a script, "tryme.py". This, instead, brings up PythonWin editor and Interactive Window. Path variable is "C:\Python24". (I need Python 2.4 installed, not 2.5) How do I make it so that the script runs? -- http://mail.python.org/mailman/listin

Re: How to make python scripts .py executable, not bring up editor

2008-07-08 Thread norseman
= David Eynon wrote: When my anyname.py runs, instead of executing the script, it opens up the file within the Pythonwin text editor. === On Mon, Jul 7, 2008 at 9:00 P

Re: Cross Compiler for Python?

2008-07-08 Thread norseman
Hendrik van Rooyen wrote: norseman wrote: == In case all else fails: This is not a cookbook answer, but: 1) gnu's gcc will compile to 16,32 or 64 bit intel architectures OK, the 32 bit version compiles to 16 or 32 &am

Re: Reportlab Image object opens filehandles

2008-07-08 Thread norseman
Daniel de Sousa Barros wrote: Hi Mr Robin, I saw your post: http://mail.python.org/pipermail/python-list/2003-September/224781.html I'm trying to append more than 1000 images into one PDF report, but i get the IOError: Too many... know you a solution for it? Sorry by my english i'm braz

Re: a simple 'for' question

2008-07-08 Thread norseman
Almost correct: There is a typo. Should read: for x in folders: open('my/path/way/'+x+'/myfile.txt','r') Rajanikanth Jammalamadaka wrote: Hi! Try this for x in folders: open('my/path/way'+x+'myfile.txt','r') Cheers, Raj On Tue, Jul 8, 2008 at 5:08 PM, Ben Keshet <[EMAIL PROTECT

Re: start reading from certain line

2008-07-09 Thread norseman
Tim Cook wrote: On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote: I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is encountered that contains 'item 1' T

Re: Determining when a file has finished copying

2008-07-09 Thread norseman
Also available: pgm-W copies/creates-fills whatever B/dummy when done, pgm-W renames B/dummy to B/F pgm-D only scouts for B/F and does it thing when found Steve [EMAIL PROTECTED] Manuel Vazquez Acosta wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This seems a synchronization pro

Re: formatting list -> comma separated

2008-07-10 Thread norseman
Robert wrote: given d: d = ["soep", "reeds", "ook"] I want it to print like soep, reeds, ook I've come up with : print ("%s"+", %s"*(len(d)-1)) % tuple(d) but this fails for d = [] any (pythonic) options for this? Robert -- http://mail.python.org/mailman/listinfo/python-list ===

Re: variable question

2008-07-10 Thread norseman
Support Desk wrote: I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if stateme

Re: sort(cmp=func)

2008-07-10 Thread norseman
Tobiah wrote: I have a list of objects that generate code. Some of them depend on others being listed first, to satisfy dependencies of others. I wrote a cmp function something like this: def dep_cmp(ob1, ob2): if ob1.name in ob2.deps: return -1 else

Re: Terminate a python script from linux shell / bash script

2008-07-10 Thread norseman
Gros Bedo wrote: That's not how it works. If you kill one running python script it will not effect other python scripts. Each script has its own interpreter process running. GB> So, is there a way from the Linux shell or a bash script to terminate GB> just one specific Python script ?

Re: Reportlab Image object opens filehandles

2008-07-10 Thread norseman
Daniel de Sousa Barros wrote: - Original Message - From: "norseman" <[EMAIL PROTECTED]> To: "Daniel de Sousa Barros" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, July 08, 2008 6:49 PM Subject: Re: Reportlab Image object opens filehandles Daniel de Sousa Ba

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread norseman
defn noob wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr): for x in range(2, nbr + 1): if nbr % x == 0: break if x == n

Re: Testing for Internet Connection

2008-07-15 Thread norseman
Grant Edwards wrote: On 2008-07-15, Alexnb <[EMAIL PROTECTED]> wrote: What exactly do you think will work? I am not sure what you think I should do? If I use urlopen("http://www.google.com";) and I am not connected, I am not going to get an exception, the program will fail. Bullshit. You ge

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread norseman
Mensanator wrote: On Jul 15, 12:36 pm, defn noob <[EMAIL PROTECTED]> wrote: On Jul 15, 7:28 pm, Mensanator <[EMAIL PROTECTED]> wrote: On Jul 15, 11:26 am, defn noob <[EMAIL PROTECTED]> wrote: isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it

Re: How to figure out if the platform is 32bit or 64bit?

2008-07-16 Thread norseman
> > I need to know if I'm running on 32bit or 64bit ... so far I haven't > > come up with how to get this info via python. sys.platform returns > > what python was built on ... but not what the current system is. > > > > I thought platform.uname() or just platform.processor() would have > > done

Re: how can i save my command prompt screen?

2008-07-16 Thread norseman
Ty hensons wrote: > how can i save my command prompt screen? == That by itself leaves lots of questions. Taken literally to be the "box" then: In Microsoft use the "Print Screen" followed by mspaint and Edit/paste (Or SHIFT-PrintScreen if whole

Re: Rotating a cube

2008-07-17 Thread norseman
J-Burns wrote: Hello. Need some help here. I have a 4*4 cube. So the equation of the cube becoming: x + 4*y + 16*z Now i want to rotate this cube 90 degrees anticlockwise( a right rotation). How can i do that? The rotation must take place with the a

Re: Importing different versions of a module

2008-07-18 Thread norseman
mercado mercado wrote: I have two versions of a script on my machine. One version is for new development and the other version is a production version. This script imports a module from a different directory, and this module again has two versions (a development version and a production version)

Re: win32api not found?

2008-07-21 Thread norseman
Lamonte Harris wrote: Where can I get the win32api module? I been searching all day on google and nothing, i installed https://sourceforge.net/project/showfiles.php?group_id=78018 which requires win32api and its not found...

Re: sending input to an embedded application

2008-07-21 Thread norseman
Matthew Fitzgibbons wrote: mefyl wrote: Uwe Schmitt wrote: On 12 Jul., 09:08, George Oliver <[EMAIL PROTECTED]> wrote: What I would like to do is take a program and embed it or put it within a Python-run GUI, using the GUI just to capture and send input to the application, and display the ou

Re: Importing different versions of a module

2008-07-21 Thread norseman
mercado mercado wrote: Thanks norseman for the reply. You're right that I didn't like it though. :-) Also note that my original question has to do with importing modules from different locations. If all I had to do was use different paths within the script (e.g. for sending to os

Re: How do I compare files?

2008-07-22 Thread norseman
Timothy Grant wrote: On Tue, Jul 22, 2008 at 4:27 PM, Clay Hobbs <[EMAIL PROTECTED]> wrote: I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? -- Ratf

Broken examples

2008-07-23 Thread norseman
I'm only talking about IPC related. I have googled, yahooed, and so forth for several months now. ALL examples I've come across have failed including those pertinent in the Python doc area. Outline: cd somedir ls -1 *.xls >thislist #ls hyphen one python process.py

Re: Broken examples

2008-07-24 Thread norseman
Lawrence D'Oliveiro wrote: In message <[EMAIL PROTECTED]>, norseman wrote: The OOo examples do not work. I have done OOo scripting in Python. What exactly does not work? -- http://mail.python.org/mailman/listinfo/python-list === file: z.scr -- #!/b

Re: Broken examples

2008-08-11 Thread norseman
Tim; Finally got a chance to test your snippet. Thank you for it! I took the liberty of flushing it out a bit. #!/--- # import os import win32com.client excel = win32com.client.Dispatch( 'Excel.Application' ) excel.Visible=1# shows the spreadsheet (can be

Re: Broken examples

2008-08-12 Thread norseman
Tim Roberts wrote: norseman wrote: Tim; Finally got a chance to test your snippet. Thank you for it! I took the liberty of flushing it out a bit. #!/--- # import os import win32com.client excel = win32com.client.Dispatch( 'Excel.Application' ) excel

Re: os.system question

2008-08-12 Thread norseman
Asun Friere wrote: On Aug 8, 6:07 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: On Aug 6, 8:07 pm, Kevin Walzer <[EMAIL PROTECTED]> wrote: >>> import os >>> foo = os.system('whoami') kevin >>> print foo 0 >>> The standard output of the system command 'whoami' is my login name. Yet the value

Re: Broken examples

2008-08-12 Thread norseman
John Machin wrote: On Aug 12, 10:36 am, norseman <[EMAIL PROTECTED]> wrote: Tim; Finally got a chance to test your snippet. Thank you for it! I took the liberty of flushing it out a bit. ...(snip) Why do you want to save as CSV? Would you be happier

Re: export sites/pages to PDF

2008-08-12 Thread norseman
Nick Craig-Wood wrote: jvdb <[EMAIL PROTECTED]> wrote: My employer is asking for a solution that outputs the content of urls to pdf. It must be the content as seen within the browser. Can someone help me on this? It must be able to export several kind of pages with all kind of content (javas

Re: The Importance of Terminology's Quality

2008-08-14 Thread norseman
John W Kennedy wrote: Robert Maas, http://tinyurl.com/uh3t wrote: John W Kennedy <[EMAIL PROTECTED]> wrote: JWK> Into the 60s, indeed, there were still machines being made JWK> that had no instruction comparable to the mainframe BASx/BALx JWK> family, or to Intel's CALL. You had to do a subprogr

Re: Overwriting property-> can't set attribute

2008-08-22 Thread norseman
Gregor Horvath wrote: Hi, why is this code failing? class B(object): pass B.testattr = property(lambda s:"hallo") b = B() b.testattr = "test" Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) /tmp/python-14202ViU.py in () 14 B.testattr = property(lambda s:"hallo") 15 b = B() --

Re: Having trouble with tail -f standard input

2008-08-22 Thread norseman
Derek Martin wrote: On Thu, Aug 21, 2008 at 02:58:24PM -0700, sab wrote: I have been working on a python script to parse a continuously growing log file on a UNIX server. If you weren't aware, there are already a plethora of tools which do this... You might save yourself the trouble by just u

Re: The Importance of Terminology's Quality

2008-08-25 Thread norseman
Arne Vajhøj wrote: Paul Wallich wrote: Martin Gregorie wrote: On Fri, 22 Aug 2008 22:56:09 +, sln wrote: On Thu, 21 Aug 2008 09:11:48 -0500, [EMAIL PROTECTED] (Rob Warnock) wrote: [EMAIL PROTECTED]> wrote: ...(snip) I thought microcode was relative well defined as being the software

Re: extract text from ods TableCell using odfpy

2008-08-26 Thread norseman
frankentux wrote: Ok. Sorted it out, but only after taking a round trip over xml.minidom. Here's the working code: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.table import TableRow,TableCell from odf.text import P doc = load("/tmp/match_d

Re: swig or ctypes , under the gun and need help

2008-08-26 Thread norseman
Diez B. Roggisch wrote: Sells, Fred schrieb: Diez wrote... I don't know swig, but if all you have is a real C-API, try & use ctypes. It's much easier to create bindings for, keeps you fully in the warm and cozy womb of python programming and doesn't need no compilation to create the actual b

Re: extract text from ods TableCell using odfpy

2008-08-26 Thread norseman
Ciaran Farrell wrote: 2008/8/26 norseman <[EMAIL PROTECTED]>: frankentux wrote: Ok. Sorted it out, but only after taking a round trip over xml.minidom. Here's the working code: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.t

Re: finding out the number of rows in a CSV file [Resolved]

2008-08-27 Thread norseman
Peter Otten wrote: John S wrote: [OP] Jon Clements wrote: On Aug 27, 12:54 pm, SimonPalmer <[EMAIL PROTECTED]> wrote: after reading the file throughthe csv.reader for the length I cannot iterate over the rows. How do I reset the row iterator? A CSV file is just a text file. Don't use csv.re

Re: Multiple values for one key

2008-08-27 Thread norseman
Terry Reedy wrote: Ron Brennan wrote: Hello, How would I create a dictionary that contains multiple values for one key. Make the value a collection object (set or list if you plan to add and delete). I'd also like the key to be able to have duplicate entries. Dict keys must be ha

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread norseman
Benjamin Kaplan wrote: On Thu, Aug 28, 2008 at 12:11 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: Hello, I am new to Python and have one simple question to which I cannot find a satisfactory solution. I want to read text line-by-line from a text file, but want to ignore only the first lin

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread norseman
W. eWatson wrote: I just tried the following code, and got an unexpected result. from pyfdate import * t = Time() ts = Time(2008, 8, 29,15,20,7) tnew = ts.plus(months=6) print "new date: ", tnew Result: new date: 2009-02-28 15:20:07 I believe that should be April 1, 2009. If I use months = 1

Re: How to delete a ast character from a string?

2008-08-29 Thread norseman
[EMAIL PROTECTED] wrote: On Fri, Aug 29, 2008 at 7:40 PM, Chris Rebert <[EMAIL PROTECTED]> wrote: On Fri, Aug 29, 2008 at 11:25 AM, <[EMAIL PROTECTED]> wrote: Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this charact

Re: Need to know if a file as only ASCII charaters

2009-06-16 Thread norseman
Scott David Daniels wrote: Dave Angel wrote: Jorge wrote: Hi there, I'm making a application that reads 3 party generated ASCII files, but some times the files are corrupted totally or partiality and I need to know if it's a ASCII file with *nix line terminators. In linux I can run the fil

Re: Need to know if a file as only ASCII charaters

2009-06-16 Thread norseman
Scott David Daniels wrote: norseman wrote: Scott David Daniels wrote: Dave Angel wrote: Jorge wrote: ... I'm making a application that reads 3 party generated ASCII files, but some times the files are corrupted totally or partiality and I need to know if it's a ASCII file with

Re: Create 3D Surface / Contour (with vpython?)

2009-06-17 Thread norseman
Philip Gröger wrote: Hi! How can I create a 3D surface (or something like the picture on the FAQ page http://www.vpython.org/contents/FAQ.html ) with python [or vpython]. Didnt find anything in the Documentation under "graph" Basically like a contourf diagram in 3D (http://www.techsoft.de/germ

Re: Trouble with running java using Popen

2009-06-23 Thread norseman
Edward Grefenstette wrote: I have a java prog I need to run at some point during the execution of a python module. The path to the folder containing the all the relevant java stuff (which runs fine from the command line) is stored in pkgpath. The relevant code is this: os.chdir(pkgpath) arglis

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread norseman
rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog # define globals here filename= '' # will take care of the problem root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=la

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread norseman
OOPS - I left out the global statement rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog # define globals here filename= '' # will take care of the problem root = Tkinter.Tk() Tkinter.Butto

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
","*")]) print filename root.mainloop() ## Is this what you mean? On Jun 25, 1:28 pm, norseman wrote: OOPS - I left out the global statement rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # impo

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
_file_dialog()).pack() def open_file_dialog(): filename = tkFileDialog.askopenfilename(filetypes= [("allfiles","*")]) print filename root.mainloop() ## Is this what you mean? On Jun 25, 1:28 pm, norseman wrote: OOPS - I left out the global statement rom wrote:

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Thanks again. After your replies, I have understood how to do what I wanted. What I wanted to do is to get a value after clicking a button and use it in another part of the program. As you said, after getting the value, I have to store it in a global variable. However, the program does

Re: [Gimp-user] Color change a whole range based on a break point

2009-06-25 Thread norseman
te. * Run "Colors->Threshold" on the layermask, setting the value appropriately. * Bucket fill your original layer with black. 2) starting round 2 Quoting norseman : > I understand the idea. I am not getting any usable results. > > If I cut out a small piece of a pro

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread norseman
Sebastian Pająk wrote: 2009/6/25 "Martin v. Löwis" : I've tried various UTF file encoding (also with BOM mark), use of u"text" Always use u"text". This should work. Everything else might not work. But I tried this here without success After applying this, the effect remains the same - one b

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-25 Thread norseman
Sebastian Pająk wrote: Can, but should not. I read that the problem is when using the Polish language only. Otherwise things work normally. Is that correct? Yes, correct If so then byte swap may be a problem. Using the u'string' should solve that. I am assuming you have the Polish alphabet w

Re: Tkinter - non-ASCII characters in text widgets problem

2009-06-26 Thread norseman
Scott David Daniels wrote: norseman wrote: ... A note here: In reading the original posting I get symbols that are not familiar to me as alphabet. From the line in your original: Label(root, text='ęóąśłżźćń').pack() I see text=' then an e with a goatee

Re: csv blank fields

2009-06-30 Thread norseman
Mag Gam wrote: I am using the csv package to parse a compressed .csv.gz file. So far its working perfectly fine but it fails when I have a missing value in on of the fields. For example, I have this Abc,def,,jkl Is it possible to fill the missing column with a null? I want, Abc,def,NULL,jkl

Re: tough-to-explain Python

2009-07-07 Thread norseman
Bearophile wrote: kj, as Piet van Oostrum as said, that's the difference between mutable an immutable. It comes from the procedural nature of Python, and probably an explanation of such topic can't be avoided if you want to learn/teach Python. ...(snip) See you later, bearophile

<    1   2