Re: can't find win32api from embedded pyrun call

2013-09-06 Thread David M. Cotter
the problem was: ActivePython does not install debug libraries, so you must link with release libraries in your project. but if you run the debug version, you're linking against debug libraries which conflict with the ones linked to by python. "fixed" by running the release version. basical

Re: can't find win32api from embedded pyrun call

2013-09-03 Thread David M. Cotter
note that when the script is called, i DO see this in the output window: > 'kJams 2 Debug.exe': Loaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd' > 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll' > 'kJams 2 Debug.exe': Unloaded > 'C:\Python27\Lib\site-packages\win32\win

Re: can't find win32api from embedded pyrun call

2013-09-03 Thread David M. Cotter
I find i'm having this problem, but the solution you found isn't quite specific enough for me to be able to follow it. I'm embedding Python27 in my app. I have users install ActivePython27 in order to take advantage of python in my app, so the python installation can't be touched as it's on a

Re: can't get utf8 / unicode strings from embedded python

2013-08-28 Thread David M. Cotter
Thank you for your thoughtful and thorough response. I now understand much better what you (and apparently the others) were warning me against and I will certainly consider that moving forward. I very much appreciate your help as I learn about python and embedding and all these crazy encoding

Re: can't get utf8 / unicode strings from embedded python

2013-08-27 Thread David M. Cotter
I am very sorry that I have offended you to such a degree you feel it necessary to publicly eviscerate me. Perhaps I could have worded it like this: "So far I have not seen any troubles including unicode characters in my strings, they *seem* to be fine for my use-case. What kind of trouble ha

Re: can't get utf8 / unicode strings from embedded python

2013-08-27 Thread David M. Cotter
i am already doing (3), and all is working perfectly. bytestring literals are fine, i'm not sure what this trouble is that you speak of. note that i'm not using PyRun_AnyFile(), i'm loading the script myself, assumed as utf8 (which was my original problem, i had assumed it was macRoman), then

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread David M. Cotter
i got it!! OMG! so sorry for the confusion, but i learned a lot, and i can share the result: the CORRECT code *was* what i had assumed. the Python side has always been correct (no need to put "u" in front of strings, it is known that the bytes are utf8 bytes) it was my "run script" function

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread David M. Cotter
fair enough. I can provide further proof of strangeness. here is my latest script: this is saved on disk as a UTF8 encoded file, and when viewing as UTF8, it shows the correct characters. == # -*- coding: utf-8 -*- import time, kjams, kjams_lib def log_success(msg, successB, s

Re: can't get utf8 / unicode strings from embedded python

2013-08-25 Thread David M. Cotter
i'm sorry this is so confusing, let me try to re-state the problem in as clear a way as i can. I have a C++ program, with very well tested unicode support. All logging is done in utf8. I have conversion routines that work flawlessly, so i can assure you there is nothing wrong with logging and

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread David M. Cotter
> What _are_ you using? i have scripts in a file, that i am invoking into my embedded python within a C++ program. there is no terminal involved. the "print" statement has been redirected (via sys.stdout) to my custom print class, which does not specify "encoding", so i tried the suggestion a

Re: can't get utf8 / unicode strings from embedded python

2013-08-23 Thread David M. Cotter
> I see you are using Python 2 correct > Firstly, in Python 2, the compiler assumes that the source code is encoded in > ASCII gar, i must have been looking at doc for v3, as i thought it was all assumed to be utf8 > # -*- coding: utf-8 -*- okay, did that, still no change > you need to use u"

can't get utf8 / unicode strings from embedded python

2013-08-23 Thread David M. Cotter
note everything works great if i use Ascii, but: in my utf8-encoded script i have this: > print "frøânçïé" in my embedded C++ i have this: PyObject* CPython_Script::print(PyObject *args) { PyObject*resultObjP = NULL; const char *utf8_

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread David M. Welch
Hi all, This is an old thread, but I'm having the same behavior in my terminal when I run some code but kill the process in the terminal (Ctrl-C). The code has two prime suspects (from a simple google search): 1. Creates ssh port forward via the subprocess module (http://unix.stackexchange.com/q

Re: PyArg_ParseTuple() when the type could be anything?

2013-08-05 Thread David M. Cotter
i was able to get what i wanted by simply iterating over the tupile instead of using ParseTupile, then just query the type, then convert the type to C and move on to the next. totally great, now i can pass N different argument types to a single function, and have the C side deal gracefully with

PyArg_ParseTuple() when the type could be anything?

2013-08-02 Thread David M. Cotter
I'd like to be able to use PyArg_ParseTuple() in a generic way. for example, i'd like to have all commands start with 1 integer parameter, and this "commandID" will inform me of what parameters come next (via LUT). knowing that i can then call ParseTuple again with the proper parameters. like t

Re: how to package embedded python?

2013-07-31 Thread David M. Cotter
okay, well that might turn out to be useful, except i don't quite know how to use it, and there are no "from scratch" instructions. i managed to download "py2exe-0.6.9.zip" and unzip it, but how does one "install" this package? (yes, still a newb at that) then, once installed, how do i say "in

Re: how to package embedded python?

2013-07-30 Thread David M. Cotter
yes, i've looked there, and all over google. i'm quite expert at embedding at this point. however nowhere i have looked has had instructions for "this this is how you package up your .exe with all the necessary python modules necessary to actually run on a user's system that does not have pyth

Re: embedding: how to create an "idle" handler to allow user to kill scripts?

2013-07-30 Thread David M. Cotter
Okay, i'm really surprised nobody knows how to do this. and frankly i'm amazed at the utter lack of documentation. but i've figured it out, and it's all working beautifully. if you want the code, go here: http://karaoke.kjams.com/wiki/Python -- http://mail.python.org/mailman/listinfo/python-l

Re: how to package embedded python?

2013-07-29 Thread David M. Cotter
nooobody knw the trouble a s... -- http://mail.python.org/mailman/listinfo/python-list

embedding: how to create an "idle" handler to allow user to kill scripts?

2013-07-28 Thread David M. Cotter
in my C++ app, on the main thread i init python, init threads, then call PyEval_SaveThread(), since i'm not going to do any more python on the main thread. then when the user invokes a script, i launch a preemptive thread (boost::threads), and from there, i have this: static int

Re: embedded python and threading

2013-07-26 Thread David M. Cotter
DOH! as my second thread, i had been using a sample script that i had copy-pasted without much looking at it. guess what? it prints the time. and yes, it did "from time import time", which explains it all. thanks for the hints here, that helped me figure it out! -- http://mail.python.org/mai

Re: embedded python and threading

2013-07-26 Thread David M. Cotter
no, there is no "time.py" anywhere (except perhaps as the actual python library originally imported) did you understand that the function works perfectly, looping as it should, up until the time i run a second script on a separate thread? -- http://mail.python.org/mailman/listinfo/python-list

Re: embedded python and threading

2013-07-26 Thread David M. Cotter
okay, i have simplified it: here is the code == import time def main(): while True: print "i'm alive" time.sleep(0.25) #- if __name__ == "__main__": main() ===

Re: how to package embedded python?

2013-07-26 Thread David M. Cotter
does nobody know how to do this? does nobody know where proper documentation on this is? -- http://mail.python.org/mailman/listinfo/python-list

embedded python and threading

2013-07-25 Thread David M. Cotter
in my app i initialize python on the main thread, then immediately call PyEval_SaveThread() because i do no further python stuff on the main thread. then, for each script i want to run, i use boost::threads to create a new thread, then on that thread i "ensure" the GIL, do my stuff, then release

how to package embedded python?

2013-07-25 Thread David M. Cotter
what must i include in my app package if i'm embedding python? i tried including *everything* in the "DLLs" directory, but my app still crashes as soon as i attempt to initialize python. this is on a system that does not have python installed, as most of my users won't have it. is it actually

Re: how: embed + extend to control my running app?

2013-07-25 Thread David M. Cotter
Okay the link problem was solved: i had installed a 64bit python and my app is 32bit. i'm using ActivePython installer from here: http://www.activestate.com/activepython/downloads it seems that now the problem is that this does not install the _d versions of the .lib. :( does anyone know how

Re: how: embed + extend to control my running app?

2013-07-24 Thread David M. Cotter
update: okay so the python27.dll is in /windows/system32 so ignore that i've set my include directory correct, so i can compile i've set my "additional libraries" directory to the "libs" directory (where the ".lib" files are. (note: NOT including "Lib" directory, cuz that's full of .py files a

Re: how: embed + extend to control my running app?

2013-07-24 Thread David M. Cotter
> > Now for Windows: same thing, i think i must create a .dll, right? > you should already have a python.dll in your installation i can find "python27.lib" in the "libs" folder, but there is no "python27_d.lib", and there is no "python27.dll" in the DLLs folder? are there instructions for creati

Re: how: embed + extend to control my running app?

2013-07-24 Thread David M. Cotter
> http://karaoke.kjams.com/wiki/Python nevermind, i got it, it's working now (see link for code) -- http://mail.python.org/mailman/listinfo/python-list

Re: how: embed + extend to control my running app?

2013-07-24 Thread David M. Cotter
i don't use stdout in my own code, my code goes to my own log file. i want the output from any python code to go to my existing log file, so log statements from my app and any python code are intermingled in that one file. my updated code is here, which now bridges my python print function to m

Re: how: embed + extend to control my running app?

2013-07-24 Thread David M. Cotter
well, umm, gosh, now i feel quite silly. that was easy. okay that's done. next: i'd like to redirect the output of any "print" statements to my C function: > voidLog(const unsigned char *utf8_cstrP); on the mac, python output sys.stdout goes into the debug console if you're in the

Re: how: embed + extend to control my running app?

2013-07-23 Thread David M. Cotter
i'm targeting Mac and Windows. Let's skip the thing about "it should work when my app isn't running", just assume it's going to be embedded, no pipes or sockets necessary. For Mac, I understand i need to "create" (?) a python.dylib, but i find no directions for that at the expected location:

how: embed + extend to control my running app?

2013-07-19 Thread David M. Cotter
i'd like my app to be "available" to python while it's running. for example, say my app is "FooBar.app". when my FooBar.app is running, now there is a python interface available to python, and the user can write python scripts to make use of it. with their scripts, they can control my running a

Re: Understanding other people's code

2013-07-16 Thread David M Chess
> Literally any idea will help, pen and paper, printing off all the code and doing some sort of highlighting session - anything! > I keep reading bits of code and thinking "well where the hell has that been defined and what does it mean" to find it was inherited from 3 modules up the chain. >

Re: Functional vs. Object oriented API

2013-04-12 Thread David M Chess
> Roy Smith > As part of our initial interview screen, we give applicants some small > coding problems to do. One of the things we see a lot is what you could > call "Java code smell". This is our clue that the person is really a > Java hacker at heart who just dabbles in Python but isn't

Re: Cannot run a single MySQLdb execute....

2013-03-28 Thread David M Chess
Νίκος Γκρ33κ : >> What paramstyle are you using? > >Yes it is Chris, but i'am not sure what exactly are you asking me. >Please if you cna pout it even simper for me, thank you. For instance: >>> import MySQLdb >>> MySQLdb.paramstyle 'format' FWIW and HTH, DC -- http://mail.python.org/mailman

Re: A lock that prioritizes acquire()s?

2012-10-24 Thread David M Chess
Lovely, thanks for the ideas! I remember considering having release() pick the next thread to notify, where all the waiters were sitting on separate Conditions or whatever; not sure why I didn't pursue it to the end. Probably distracted by something shiny; or insufficient brainpower. :) D

A lock that prioritizes acquire()s?

2012-10-24 Thread David M Chess
Okay, next silly question. :) We have a very simple multi-threaded system where a request comes in, starts running in a thread, and then (zero, one, or two times per request) gets to a serialization point, where the code does: with lock: do_critical_section_stuff_that_might_take_awhile()

Re: Getting a TimedRotatingFileHandler not to put two dates in the same file?

2012-10-24 Thread David M Chess
> w...@mac.com > Something like: > Does a log file exist? -> No -> First run; create log file & continue > | > Yes > | > Read backwards looking for date change, copy lines after change > to new file, delete from old file. Yep, I'm concluding that also. It just wasn

Re: Getting a TimedRotatingFileHandler not to put two dates in the same file?

2012-10-24 Thread David M Chess
> d...@davea.name > > On 10/23/2012 11:23 AM, David M Chess wrote: > > We have a TimedRotatingFileHandler with when='midnight' > > You give us no clue what's in this class, or how it comes up with the > filenames used. Sorry if I was

Re: problem with ThreadingTCPServer Handler

2012-10-23 Thread David M Chess
> jorge > I'm programming a server that most send a message to each client > connected to it and nothing else. this is obviously a base of what i > want to do. the thing is, I made a class wich contains the Handler class > for the ThreadingTCPServer and starts the server but i don't know how

Getting a TimedRotatingFileHandler not to put two dates in the same file?

2012-10-23 Thread David M Chess
We have a TimedRotatingFileHandler with when='midnight'. This works great, splitting the log information across files by date, as long as the process is actually up at midnight. But now the users have noticed that if the process isn't up at midnight, they can end up with lines from two (or I g

Re: Py3.3 unicode literal and input()

2012-06-18 Thread David M Chess
> If you (the programmer) want a function that asks the user to enter a > literal at the input prompt, you'll have to write a post-processing for > it, which looks for prefixes, for quotes, for backslashes, etc., and > encodes the result. There very well may be such a decoder in the Python > libra

bus errors when the network interface is reset?

2012-05-01 Thread David M Chess
or advice greatly appreciated. DC David M. Chess IBM Watson Research Center -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows 7 : any problems installing or running Python ?

2010-01-02 Thread David M Covey Sr.
you have any suggestions that might help me out here? I would really appreciate your input. Thank you, David M Covey Sr. ad...@daffitt.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiler malware rebutted

2009-11-13 Thread David M. Besonen
On 11/13/2009 3:26 PM, Aahz wrote: > Ken Thompson's classic paper on bootstrapped malware > finally gets a rebuttal: > > http://lwn.net/Articles/360040/ thanks for pointing this out. -- david -- http://mail.python.org/mailman/listinfo/python-list

Re: (OT) Recommend FTP Client

2009-11-12 Thread David M. Besonen
On 11/12/2009 11:26 AM, Dave Angel wrote: > Try http://fireftp.mozdev.org/ in the past i found this to be buggy. i'd recommend something different. what is your OS? -- david -- http://mail.python.org/mailman/listinfo/python-list

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-06 Thread David M . Cooke
Martin v. Löwis v.loewis.de> writes: > > This is a good test for Python implementation bottlenecks. Run > > that tokenizer on HTML, and see where the time goes. > > I looked at it with cProfile, and the top function that comes up > for a larger document (52k) is > ...validator.HTMLConformanceCh

Re: itertools.intersect?

2009-06-10 Thread David M. Wilson
On Jun 10, 11:24 pm, David Wilson wrote: > Hi, > > During a fun coding session yesterday, I came across a problem that I > thought was already solved by itertools, but on investigation it seems > it isn't. > > The problem is simple: given one or more ordered sequences, return > only the objects th

Re: itertools.intersect?

2009-06-10 Thread David M. Wilson
On Jun 11, 12:59 am, Jack Diederich wrote: > On Wed, Jun 10, 2009 at 6:24 PM, David Wilson wrote: > > During a fun coding session yesterday, I came across a problem that I > > thought was already solved by itertools, but on investigation it seems > > it isn't. > > > The problem is simple: given on

Re: itertools.intersect?

2009-06-10 Thread David M. Wilson
On Jun 11, 3:05 am, Chris Rebert wrote: > On Wed, Jun 10, 2009 at 5:53 PM, Mensanator wrote: > > On Jun 10, 5:24 pm, David Wilson wrote: > >> Hi, > > >> During a fun coding session yesterday, I came across a problem that I > >> thought was already solved by itertools, but on investigation it seem

Re: Concurrency Email List

2009-05-17 Thread David M. Besonen
On 5/16/2009 5:26 PM, Aahz wrote: > On Sat, May 16, 2009, Pete wrote: > >> python-concurre...@googlegroups.com is a new email list >> for discussion of concurrency issues in python. > > Is there some reason you chose not to create a list on > python.org? I'm not joining the list because Google >

Testing out Newsproxy.

2008-07-20 Thread David M Lemcoe Jr.
Going to see if Newsproxy actually blocks google groups. -=___=- David M Lemcoe Jr. Roswell, Georgia http://www.davidlemcoe.com/ [EMAIL PROTECTED] QRZ: KI4YJL AIM: lemcoe9 YIM: lemcoe9 GTalk: [EMAIL PROTECTED] MSN: [EMAIL PROTECTED] Xfire: shawtylo1 ICQ: 359114839

Re: Question

2008-07-19 Thread David M Lemcoe Jr.
Hello [EMAIL PROTECTED], No language is better than another because Python is not intended for the same uses and/or people. Your question has no place here. David -=___=- David M Lemcoe Jr. Roswell, Georgia http://www.davidlemcoe.com/ [EMAIL PROTECTED] QRZ: KI4YJL

Re: Any Game Developers here?

2008-07-18 Thread David M Lemcoe Jr.
Hello Michael, Any people that use Python as the predominant language for their game development here? ~Michael Well, I make little CLI games that are extremely basic and have no actual graphics, but i'm sure a few people actually use them in video games. David -- http://mail.python.org

Re: setting a breakpoint in the module

2006-08-23 Thread David M. Cooke
pdb.set_trace() at the point you want the debugger to stop. Useful if you want to break after some failing condition, for instance. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-18 Thread David M. Cooke
[EMAIL PROTECTED] (David M. Cooke) writes: > > Bruno's already mentioned that iterators and generators aren't > sequences. Numpy arrays act like the other sequence types: > >>>> a = numpy.array([]) >>>> a > array([], dtype=int64) >>>> le

Re: Coding style

2006-07-18 Thread David M. Cooke
iterators and generators aren't sequences. Numpy arrays act like the other sequence types: >>> a = numpy.array([]) >>> a array([], dtype=int64) >>> len(a) 0 >>> bool(a) False (0-dimensional numpy arrays are pathological anyways) -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: NumPy 0.9.8 released

2006-05-17 Thread David M. Cooke
ipy/numpy/ > > > * numpy should install now with easy_install from setuptools Note that you'll need to use the latest setuptools (0.6b1). The hacks I added to get easy_install and numpy.distutils to get along are hard enough without trying to be backward compatible :-( -- |>|\

Re: "pow" (power) function

2006-03-17 Thread David M. Cooke
e you'd probably want to use numpy. We've optimized x**n so that it does handle n=0.5 and integers specially; it makes more sense to do this for an array of numbers where you can do the special manipulation of the exponent, and then apply that to all the numbers in the array at once. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-06 Thread David M. Cooke
Python 2.4 :-) Lost comments and stuff, but the code came out great. -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Scientific Computing with NumPy

2006-02-10 Thread David M. Cooke
s installed) it's really to compile: python setup.py build && python setup.py install. Do you need Tiger (10.4) or Panther (10.3) compatibility? -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmas

Re: good library for pdf

2006-01-26 Thread David M. Cooke
li There's also pyPDF, at http://pybrary.net/pyPdf/. I haven't tried it, but it looks interesting. -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

problem adding list values

2005-12-22 Thread David M. Synck
Hi all, I am fairly new to Python and trying to figure out a syntax error concerning lists and iteration through the same. What I am trying to do is sum a list of float values and store the sum in a variable for use later. The relevant code looks like this - def getCredits(): """ This func

Re: idea of building python module using pyrex

2005-12-09 Thread David M. Cooke
r module scipy.random. It's actually used to wrap some C code, but it does the job well. -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading binary data

2005-11-23 Thread David M
Thanks but the C Struct describing the data doesn't match up with the list on the module-struct page. this is the acct.h file #ifndef _SYS_ACCT_H #define _SYS_ACCT_H 1 #include #define __need_time_t #include #include __BEGIN_DECLS #define ACCT_COMM 16 /* comp_t is a 16-bit "floating

Reading binary data

2005-11-23 Thread David M
OK so here is my task. I want to get at the data stored in /var/account/pacct, which stores process accounting data, so that I can make it into a more human understandable format then what the program sa can do. The thing is, its in a binary format and an example program that reads some data from

Re: Underscores in Python numbers

2005-11-19 Thread David M. Cooke
a6 = -0.00019 84090 a8 = 0.0 27526 a10= -0.0 00239 x2 = x**2 return 1. + x2*(a2 + x2*(a4 + x2*(a6 + x2*(a8 + x2*a10 (or least that's what I like to write). Now, if I were going to higher precision, I'd have more digits of course. -- |>|\/|< /-

Re: authentication for xmlrpc via cgi

2005-09-22 Thread David M. Cooke
TY_HOLE_PASS_AUTHORIZATION.html >From what I can see, this is still true in Apache 2. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to determine -- when parsing -- if a word contains a builtin name or other imported system module name?

2005-08-04 Thread David M. Cooke
ally an "iskeyword" function there :) For modules, sys.modules is a dictionary of the modules that have been imported. -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying behaviour of the != operator

2005-06-10 Thread David M. Cooke
Robert Kern <[EMAIL PROTECTED]> writes: > greg wrote: >> David M. Cooke wrote: >> >>>>To solve that, I would suggest a fourth category of "arbitrary >>>>ordering", but that's probably Py3k material. >>> >>>We've

Re: without shell

2005-06-10 Thread David M. Cooke
orget the one module to rule them all, subprocess: file_list = subprocess.Popen(['ls'], stdout=subprocess.PIPE).communicate()[0] which by default won't use the shell (unless you pass shell=True to it). -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying behaviour of the != operator

2005-06-09 Thread David M. Cooke
y size: [1+2j, 3+4j].sort(key=abs) and since .sort() is stable, for those numbers where the key is the same, the order will stay the same. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: computer algebra packages

2005-06-08 Thread David M. Cooke
's doable. It should also be doable with Maple, using the OpenMaple API. I've looked at it, and it should be possible. I haven't had the time to actually do anything, though :-) -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: editor for shelve files

2005-05-01 Thread David M. Cooke
to handle than the general case. -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrapping c functions

2005-05-01 Thread David M. Cooke
o could be included in the desc field. return PyCObject_FromVoidPtr(dib, NULL) (the NULL can be replaced with a routine that will free the image.) -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a package with convolution and related methods?

2005-04-21 Thread David M. Cooke
/scipy.org) has wraps for FFTW (Fast Fourier Transform in the West). -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: python/svn issues....

2005-04-12 Thread David M. Cooke
versioned form, db_create_4002). Running 'nm -D -g' on the libsvn_fs_base library shows it uses the same db_create_4002 function. -- |>|\/|< /--\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |[EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: python/svn issues....

2005-04-12 Thread David M. Cooke
/usr/lib/libtasn1.so.2 (0x002a96d1b000) libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x002a96e2b000) libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x002a96f77000) libz.so.1 => /usr/lib/libz.so.1 (0x002a9707b000) If it doesn't look like that, then

Re: Threads and variable assignment

2005-04-12 Thread David M. Cooke
use threads, use a Queue.Queue object where timestamps w/ state changes are pushed on in thread 1, and popped off and analysed before logging in thread 2. (Or something; this just popped in my head.) -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: curious problem with large numbers

2005-04-07 Thread David M. Cooke
you could use >>> import numarray.ieeespecial >>> numarray.ieeespecial.plus_inf inf (there's minus_inf, nan, plus_zero, and minus_zero also) -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: richcmpfunc semantics

2005-04-07 Thread David M. Cooke
objects can fail. If you *know* A and B objects can't be compared for equality, it'd be ok to raise a TypeError, but that should be after a type test. > Also, do you need to increment the reference count > of Py_NotImeplemented before returning it? Yes; it's a singleton like Py_None. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Gnuplot.py and, _by far_, the weirdest thing I've ever seen on my computer

2005-04-04 Thread David M. Cooke
some customization options that might be helpful. In particular, I'd try import Gnuplot Gnuplot.GnuplotOpts.prefer_fifo_data = 0 ... then the data will be save to a temporary file instead of piped through a fifo. Alternatively, try Gnuplot.GnuplotOpts.prefer_inline_data = 1 ... then no file will be used. [I don't use Gnuplot myself; this is just what I came up with after a few minutes of looking at it] -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: numeric module

2005-04-01 Thread David M. Cooke
anything numerical in Python, you'll want them :-) -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: numeric module

2005-04-01 Thread David M. Cooke
(): val = testme() wi = int(val >> 4) bi = int(val & 0xF) print wi print bi print tbl[wi,bi] and that'll work. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools to iter transition

2005-03-30 Thread David M. Cooke
true anymore, of course (it was in 2.2.3). In 2.3.5, UserDict, tarfile and some the Mac-specific module use classmethod, and the datetime extension module use the C version (the METH_CLASS flag). And staticmethod (and METH_STATIC) aren't used at all in 2.3 or 2.4 :-) [if you ignore __new__] --

Re: breaking up is hard to do

2005-03-25 Thread David M. Cooke
so makes it easier to know what is a global :-) -- |>|\/|< /------\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python to extend a python app

2005-03-24 Thread David M. Cooke
ctly this approach, with some extra frills: looking in subdirectories, for instance. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing arguments to python from URL

2005-03-22 Thread David M. Cooke
make things easier on yourself; the documentation has a good overview: http://www.python.org/doc/2.4/lib/module-cgi.html In this case, your script would look something like this: import cgi form = cgi.FieldStorage() if form.getvalue('sort') == 'ascending': ... sort in asce

Re: how to handle repetitive regexp match checks

2005-03-17 Thread David M. Cooke
r: def __init__(self, text): self.m = None self.text = text def match(self, pat): self.m = pat.match(self.text) return self.m def __getitem__(self, name): return self.m.group(name) Then, use it like for line in fo: m = Matcher(line) if m.matc

Re: SAX parsing problem

2005-03-15 Thread David M. Cooke
t;, "&", and "%20value"? The xml.sax.handler.ContentHandler.characters method (which I presume you're using for SAX, as you don't mention!) is not guaranteed to get all contiguous character data in one call. Also check if .skippedEntity() methods are firing. -- |>

Re: binutils "strings" like functionality?

2005-03-03 Thread David M. Cooke
m. Are you sure it's monkey/chicken/dog/cat, and not monkey\chicken\dog\cat? The later one will print monkey\\chicken... because of the repr() call. Also, you probably want it as [\x20-\x7e] (the DEL character \x7f isn't printable). You're also missing tabs (\t). The

Re: How to write python plug-ins for your own python program?

2005-03-03 Thread David M. Cooke
the name of the python file, minus the ".py" extension. You'd better hope someone doesn't name their plugin 'os; os.system("rm -rf /"); import sys' Use __import__ instead. -- |>|\/|< /--

Re: [ANN] Python 2.4 Quick Reference available

2005-02-19 Thread David M. Cooke
is more suited to type testing (for example, writing "isinstance(f, file)"). """ ... which more accurately reflects what I believe the consensus is about the usage of open vs. file. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread David M. Cooke
27;s linked, then it's not being installed right. You don't have a previous Numeric installation that's being picked up instead of the one you're trying to install, do you? At the interpreter prompt, check that >>> import Numeric >>> Numeric.__file_

Re: LinearAlgebra incredibly slow for eigenvalue problems

2005-01-28 Thread David M. Cooke
, and set some directories) Also set use_dotblas to 1. - do the 'python setup.py build', 'python setup.py install' dance. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: MMTK Install Problem

2005-01-26 Thread David M. Cooke
st version is 23.7. It should be real easy to upgrade to that, as that version picks up Apple's vecLib framework for the linear algebra routines. Just do the usual 'python setup.py build', 'sudo python setup.py install'. That should put the header files where the MMTK install

Re: pickling extension class

2005-01-18 Thread David M. Cooke
^ I think that's your error. The extension type is declared to be hyper.PeriodicGrid, where it actually is model.hyper.PeriodicGrid (because hyper is in the model package). Pickle stores g.__class__.__module__ (which is "hyper") and g.__class__.__name__ (="PeriodicGrid") to find the class object for reimporting, and on unpickling, tries to do __import__("hyper"), which fails. The tp_name slot of your extension type should be "model.hyper.PeriodicGrid". -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyrex-0.9.3: definition mismatch with distutils of Python24

2005-01-13 Thread David M. Cooke
rted a few times. You'll want to change it to def swig_sources(self, sources, extension=None): so that if you use an older python it won't complain about missing arguments. -- |>|\/|< /--\ |David M. Cooke |cookedm(at)physics(dot)mcmaster(dot)ca -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >