Re: [Tutor] Running and passing variables to/from

2007-05-06 Thread emilia12
hi john, what about f2py - Fortran to Python interface generator Port description for lang/f2py Writing Python C/API wrappers for Fortran routines can be a very tedious task, especially if a Fortran routine takes more than 20 arguments but only few of them are relevant for the problems that they

[Tutor] how to seed up?

2007-05-19 Thread emilia12
hi list when i have many modules in my script (eg. 'import pylab, os, sys'), python loads them very slow ... so is there a way to run same script many times (with small changes in the code), without reloading/parsing all modules each time ? and 2nd question - in case of CGI script - is there a w

[Tutor] "#!/usr/bin/env python" vs "#!/usr/local/bin/python"

2007-06-14 Thread emilia12
hi list, how to choose between "#!/usr/bin/env python" and "#!/usr/local/bin/python" in the beginning of the script ? e. - SCENA - Ĺäčíńňâĺíîňî ÁĹÇĎËŔŇÍÎ ńďčńŕíčĺ çŕ ěîáčëíč ęîěóíčęŕöčč č ňĺőíîëîăčč. http://www.bgscena.com/ _

[Tutor] [tutor] dictionary

2006-06-06 Thread emilia12
Hi, how can i print a dictionary, sorted by the values? - Поличба 666. Само в кината. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] [tutor] debug process

2006-06-12 Thread emilia12
Hello, Is there a way to debug (trace) the python code line by line? emily - Поличба 666. Само в кината. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] [tutor] how to get the fileextention?

2006-07-20 Thread emilia12
Hi, is this the right (shortest) way to get the file extention (under MS WIN)? def getext(fname): ext = fname.split('.').pop() return ext Regards, Emily - B2B портал за продуктите на HP Цени, спецификации, on-line поръчки, доставка. Регистрирайте се на http

Re: [Tutor] [tutor] how to get the fileextention?

2006-07-20 Thread emilia12
Hi Ziyad thank you very much! E. Цитат на писмо от ?? ? ??? <[EMAIL PROTECTED]>: > On Thu, 2006-07-20 at 11:19 +0300, [EMAIL PROTECTED] > wrote: > > Hi, > > > > is this the right (shortest) way to get the file > extention > > (under MS WIN)? > > > > > > def getext(fname): > >

[Tutor] [tutor] ipconfig

2006-08-10 Thread emilia12
hello list is there in python an independent from the system way to obtain the IP i am playng around import sys import os ipconfname={'nt':'ipconfig', 'posix':'ifconfig'} ipstr = os.popen(ipconfname[os.name] ).read() #print ipstr but i found out that answer depends on os.name ... in this case

[Tutor] about threads

2006-08-15 Thread emilia12
Hi all, my question is probably about the threads... I have two IPs and i want to run web.py server for each IP in the same time from one script file. I can run them in two command boxes (and this works) but i want to do this from one ;-) Maybe i can do this with 'threads' but how ? is there some

[Tutor] threads and webpy

2006-08-16 Thread emilia12
> Hi! Hi ! > I don't know what web.py is. > Is it something you wrote? no, this is a simple webserver, (http://webpy.org/) > You'll have to write multi-threaded code if you want it > to run multiple > threads :) > (Unless, of course, Web.py supports threads?) i will ask the authors about this ...

Re: [Tutor] threads and webpy

2006-08-17 Thread emilia12
> I just looked at web.py. > It's not a webserver. It's a toolkit you use to write > your own webserver. > Why are you under the impression that it's a webserver? > Did you just google for 'web server in Python' and find > this? you are right, i mean that it is the core of the webserver > If you

[Tutor] [tutor] how to cast to stucture

2006-09-04 Thread emilia12
Hi list, i have a complex data in binary file and i want to read its fields... the C way is to read file in buffer and then cast it to proper structure. Is there a way to do the same in Python or i have to read the data byte by byte ? Regards, E. - Спортни залагани

[Tutor] UnicodeEncodeError

2006-09-15 Thread emilia12
Hi list, i am using site-package (webPy) that generates "UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)". The full message is: Traceback (most recent call last): File "c:\python24\lib\site-packages\web.py", line 1786, in run_wsgi_app res

[Tutor] [tutor] string encode

2006-09-19 Thread emilia12
hi list is there a way to solve the error in case of : # ... return str(val) #where val is unicode (eg val = u'u') so, how register(?) all imported modules to convert all unicodes to str() with a coder, for eg. encode('cp1251') thanks in advance -e- - Део и Фани

[Tutor] Python scrypts and daemons

2006-12-06 Thread emilia12
Hi all, I have a python script (with endless loop) and i want to start it from the rc.config file. So, the question is: how to covert this script to work as daemon ... or how to start the python interpreter ... to work as background process ? E. - Спортни залагани

[Tutor] [tutor] sort a list

2006-12-23 Thread emilia12
Hi List, I have a list like this x=[7,4,2,6] and print x.sort() gives to me None ! : >> x=[7,4,2,6] >> print x.sort() None ... but >> x=[7,4,2,6] >> x.sort() >> print x [2, 4, 6, 7] so, why list.sort() returns None? is this normal ? (the python is "Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [M

[Tutor] it is about definitions

2007-01-16 Thread emilia12
is there a difference between: class foo: and class foo(): or between these function definitions: def bar(): and def bar: ? thanks in advance E. - Станете част от Европейското On-line семейство! Регистрирайте .EU домейн на изключителна цена от 15,90 лв.! w

[Tutor] arguments

2007-02-15 Thread emilia12
Hi list, I have a function with two arguments (say f(x,y)) and second which returns tuple (say def g(): return (xx,yy)) my question is how to put returned values from g() as arguments to f ? the direct way generates error: f(g()) TypeError: ff() takes exactly 2 arguments (1 given) and the ha

[Tutor] "from X import Y" vs "import X"

2007-03-21 Thread emilia12
Hi list, In Python books one can read that "from X import Y" is better than "import X", but some times (IMO) it is not. for eg. in SciPy, from numpy import matrix from scipy.linalg import inv, det, eig A=matrix([[1,1,1],[4,4,3],[7,8,5]]) print det(A) crashes with : RuntimeError: module compiled

[Tutor] how to split a stream of chars

2007-04-09 Thread emilia12
hi list, i have a long stream of data, represented in hexadecimal form. I need to split it in bytes (by 2 chars each). eg '00010203040506'... -> ['00', '01, '02' ...]. So my question is: is there an inverse function of zip, or an easy way to split this long string in pairs (without indexing in cyc