Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-21 Thread Дамјан Георгиевски
> I have a web page (existing page, can't modify it) and I would like > to browse it in a QtWebview. (This is already working) > > Now I Wonder how I could achieve following behaviour: > > When I click on a certain element e.g. "" > I would like to notify my python script. > > What is important:

Re: ANN: PyQt v4.8.1 Released

2010-11-07 Thread Дамјан Георгиевски
>> Given the context, "PyQt is available under the GPL and a commercial >> license," the commercial license Phil is talking about is not the >> GPL. > > Which is a wrong interpretation of “commercial”. But he is not interpreting either “commercial” or GPL. What he says is: here's the code for fr

Re: ANN: PyQt v4.8.1 Released

2010-11-02 Thread Дамјан Георгиевски
>> PyQt is available under the GPL and a commercial license. > > Surely you mean “proprietary” rather than “commercial”. There is > nothing about the GPL that prevents “commercial” use. I think he means a license that *he* sells comercially :) -- дамјан ((( http://damjan.softver.org.mk/ )))

Re: Py3: Import relative path module

2010-10-31 Thread Дамјан Георгиевски
> I am loathe to duplicate programming in files that should just load a > copy from a module. I tried all kinds of tricks to import a module > from one level up. What's the secret? > > It works if I say: > > from Data import DumpHT > > but ONLY if the search path in sys.path. I want a relative

Re: Print to an IPP printer (pkipplib?)

2010-10-19 Thread Дамјан Георгиевски
> I've found the module pkipplib which seems to work well for things > like > interrogating an IPP (CUPS) server. But is there a way to send a > print job to an IPP print queue? [and no, the local system knows > nothing about > the print architecture so popenlp is not an option]. I just want

Re: Pydev 1.6.0 Released

2010-07-21 Thread Дамјан Георгиевски
> Pydev 1.6.0 has been released > > Details on Pydev: http://pydev.org > Details on its development: http://pydev.blogspot.com The supposed feature to start a console in which the contents of the current editor window are automatically "exec"ed /available still doesn't work for me. I'm talking

Re: simples setup for an wsgi https server in python

2010-07-13 Thread Дамјан Георгиевски
> It seems, that wsgiref.simple_server.make_server can only create an > http server. > > What I wondered would be how to easiest create an https server, that > supports wsgi modules PythonPaste has a WSGI server that supports https http://pythonpaste.org/modules/httpserver.html#module-paste.https

Re: Lua is faster than Fortran???

2010-07-12 Thread Дамјан Георгиевски
On the positive side, Lua supports tail call optimization and coroutines are built in by default. -- дамјан ((( http://damjan.softver.org.mk/ ))) Education is one of the "prices" of freedom that some are unwilling to pay. -- http://mail.python.org/mailman/listinfo/python-list

Re: A question about the posibility of raise-yield in Python

2010-07-06 Thread Дамјан Георгиевски
>> > I'm writing this as a complete newbie (on the issue), so don't be >> > surprised if it's the stupidest idea ever. >> >> > I was wondering if there was ever a discusision in the python >> > community on a 'raise-yield' kind-of combined expression. I'd like >> > to know if it was proposed/reject

Re: A question about the posibility of raise-yield in Python

2010-06-30 Thread Дамјан Георгиевски
> I'm writing this as a complete newbie (on the issue), so don't be > surprised if it's the stupidest idea ever. > > I was wondering if there was ever a discusision in the python > community on a 'raise-yield' kind-of combined expression. I'd like to > know if it was proposed/rejected/discussed/

Re: Readability (html purifier) in Python

2010-06-16 Thread Дамјан Георгиевски
>> http://lab.arc90.com/experiments/readability/ >> >> Readability is a javascript bookmarklet that "makes reading on the >> Web more enjoyable by removing the clutter around what you're >> reading." >> >> Does anyone know of something similar in Python? > > Well, that sounds like a browser tool.

Readability (html purifier) in Python

2010-06-15 Thread Дамјан Георгиевски
http://lab.arc90.com/experiments/readability/ Readability is a javascript bookmarklet that "makes reading on the Web more enjoyable by removing the clutter around what you're reading." Does anyone know of something similar in Python? -- дамјан ((( http://damjan.softver.org.mk/ ))) "Debug

Re: Building a GUI Toolkit

2010-04-20 Thread Дамјан Георгиевски
> Rather than writing a windowing toolkit from the low-level, I would > rather like to see some wrapper for existing windowing toolkit which > uses more pythonic idioms. Isn't PyGUI exactly that? http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ -- дамјан ((( http://damjan.softver.org.mk/

Re: python glibc crypt() function

2010-04-20 Thread Дамјан Георгиевски
>> Hello i have to do this : >> glibc crypt() function, using salt $1$abcdefgh$ >> >> cryptPw = crypt(plainPw, "$1$abcdefgh$") >> >> I can do it in python, with package i need? >> Thanks > import ctypes lib = ctypes.CDLL("libcrypt.so.1") crypt = lib.crypt crypt.restype = ctyp

A question about the posibility of raise-yield in Python

2010-04-15 Thread Дамјан Георгиевски
I'm writing this as a complete newbie (on the issue), so don't be surprised if it's the stupidest idea ever. I was wondering if there was ever a discusision in the python community on a 'raise-yield' kind-of combined expression. I'd like to know if it was proposed/rejected/discussed/not-decided

Re: Pydev 1.5.6 Released (Django Integration)

2010-04-09 Thread Дамјан Георгиевски
> Hi All, > > Pydev 1.5.6 has been released > > Details on Pydev: http://pydev.org > Details on its development: http://pydev.blogspot.com Question, Does it have a feature to evaluate the current edit buffer and continue with an interactive prompt? -- дамјан ((( http://damjan.softver.org.mk

Re: staticmethod and namespaces

2010-04-07 Thread Дамјан Георгиевски
> Having an odd problem that I solved, but wondering if its the best > solution (seems like a bit of a hack). > > First off, I'm using an external DLL that requires static callbacks, > but because of this, I'm losing instance info. It could be import > related? It will make more sense after I di

Re: Python for newbies (Pythno users group in Macedonia)

2010-03-15 Thread Дамјан Георгиевски
>> we are starting with bi-monthly Python User Group meetings in Skopje, >> Macedonia. The meetings are targeted for both beginners and more >> experienced users. >> > ... > http://us.pycon.org/2010/conference/schedule/event/108/ Great resource, exactly what I needed. So, they use this book ht

Re: Python for newbies (Pythno users group in Macedonia)

2010-03-15 Thread Дамјан Георгиевски
> If you are all English-speakers then perhaps you could consider > showing a PyCon video - see > > http://pycon.blip.tv That's certainly something I'm considering for the more advanced users > Good luck with the group. I hope to see PyCon Macedonia emerging > before too long! Thanks :) I gue

Python for newbies (Pythno users group in Macedonia)

2010-03-13 Thread Дамјан Георгиевски
Hi all, we are starting with bi-monthly Python User Group meetings in Skopje, Macedonia. The meetings are targeted for both beginners and more experienced users. The basic idea is to have an 1 hour presentation at the start for the beginners and an 1 hour ad-hoc discussion about projects, appli

Re: SCGIServer and unusal termination

2009-11-20 Thread Дамјан Георгиевски
> everything works just fine, but one thing bothers me. All prints after > try-except block are executed twice after the Ctrl+C is pressed! > > test.py: > #- > from scgi.scgi_server import SCGIServer > > n = 0 > print "Starting server." > > try: > SCGIServer().serve(

Re: iterate over list while changing it

2009-09-30 Thread Дамјан Георгиевски
>> a = [1, 2, 3, 4, 5, 6] >> >> for i, x in enumerate(a): > > If you change a list while iterating over, start at the tail. > > ...reversed(enumerate(a)) Python 2.6.2 (r262:71600, Jul 20 2009, 02:19:59) >>> a = [1, 2, 3, 4, 5, 6] >>> reversed(enumerate(a)) Traceback (most recent call last):

Re: is this whiff/wsgi claim true?

2009-09-27 Thread Дамјан Георгиевски
> Hi folks. I just modified the WHIFF concepts index page > > http://aaron.oirt.rutgers.edu/myapp/docs/W1000.concepts > > To include the following paragraph with a startling and arrogant > claim in the final sentence :) mod_wsgi (the apache module) can be configured to automatically run a

Re: What python can NOT do?

2009-09-08 Thread Дамјан Георгиевски
> Boot loaders are another type of software which would be impractical > to write in existing Python implementations. I wonder if TinyPy (http://www.tinypy.org/) could be used to write a boot loader. It would probably need some more code to replace the services it uses from an OS, and perhaps it

Re: String to valid Python identifier

2009-08-08 Thread Дамјан Георгиевски
>> Is there any easy function in the stdlib to convert any random string >> in a valid Python identifier .. possibly by replacing non-valid >> characters with _ ? > > I think this is fairly underspecified as a problem statement. A > solution that would meet your specification would be True, I w

String to valid Python identifier

2009-08-05 Thread Дамјан Георгиевски
Is there any easy function in the stdlib to convert any random string in a valid Python identifier .. possibly by replacing non-valid characters with _ ? Python 2.x only, so no need to do Unicode. -- дамјан ( http://softver.org.mk/damjan/ ) Religion ends and philosophy begins, just as alche

Re: Problem in installing PyGreSQL

2009-08-04 Thread Дамјан Георгиевски
>> > By the way, you don't have to be super user to install PyGreSQL. >> > You just need SU if you want to install it system wide. PyGreSQL >> > doesn't require any special privileges to run. >> >> Right, but the packages install system-wide. That's why he could >> compile it himself but not use

Re: [ANN] pyKook 0.0.2 - a simple build tool similar to Make or Ant

2009-07-30 Thread Дамјан Георгиевски
> I have released pyKook 0.0.2. > http://pypi.python.org/pypi/Kook/0.0.2 > http://www.kuwata-lab.com/kook/ > http://www.kuwata-lab.com/kook/pykook-users-guide.html How does it compare to http://code.google.com/p/fabricate/ and why is this problem (solution) reoccurring all the time -- дамјан (

Re: If Scheme is so good why MIT drops it?

2009-07-28 Thread Дамјан Георгиевски
> So do all these OSes have some kind of __mega_unifying_poll system > call that works for anything that might possibly block, that you can > exploit from a user process? On Linux at least, the select/poll/epoll is that system, the trick is to use eventfd, timerfd and signalfd which are Linux spe

Re: locale doesn' format

2009-07-20 Thread Дамјан Георгиевски
>> I want to format values to the german form eg. 1.034,56 but >> locale.format() doesn't work for me. > > seems to work here In 2.6 this is good too: >>> import decimal, locale >>> locale.setlocale(locale.LC_ALL, 'mk_MK.UTF-8') >>> '{0:n}'.format(1234.56) '1 234,56' -- дамјан ( http://soft

Re: locale doesn' format

2009-07-20 Thread Дамјан Георгиевски
> I want to format values to the german form eg. 1.034,56 but > locale.format() doesn't work for me. seems to work here >>> import decimal, locale >>> locale.setlocale(locale.LC_ALL, 'mk_MK.UTF-8') 'mk_MK.UTF-8' >>> locale.localeconv()['grouping'] [3, 3, 0] >>> locale.localeconv()['thousands_sep

Best way to enumerate classes in a module

2009-06-23 Thread Дамјан Георгиевски
I need to programmaticaly enumerate all the classes in a given module. Currently I'm using dir(module) but the Notice on the documentation page [1] says "dir() is supplied primarily as a convenience for use at an interactive prompt" so that kind of scares me. Is there a better approach? If th

Re: Uppercase/Lowercase on unicode

2009-06-05 Thread Дамјан Георгиевски
> I just to check it in the python shell and it's correct. > Then the problem is by iPython that I was testing it from there. yes, iPython has a bug like that https://bugs.launchpad.net/ipython/+bug/339642 -- дамјан ( http://softver.org.mk/damjan/ ) A: Because it reverses the logical flow of

Re: How to reuse TCP listening socket immediately after it was connected at least once?

2009-05-25 Thread Дамјан Георгиевски
> I have written a socket server and some arbitrary clients. When I > shutdown the server, and do socket.close(), I cannot immediately start > it again cause it has some open sockets in TIME_WAIT state. It throws > address already in use exception at me. I have searched for that in > google but h

Re: html ui + py background? any tut?

2009-05-23 Thread Дамјан Георгиевски
> I have read for many times that the modern appliaction (not a web one, > but desktop on) uses html + js for its UI, and python code is for the > background work > but I have never found event a simple (yet completed) article on how > to develop such a thing from scrach in these advocacy thing.

Re: how to consume .NET webservice

2009-05-14 Thread Дамјан Георгиевски
>> OpenOfficeXML document format AKA ODF? ;) > > No...Office Open XML, which is used in Microsoft Office 2007 and which > Microsoft rammed through the ISO: > http://en.wikipedia.org/wiki/Office_Open_XML Even worse, Microsoft Office 2007 doesn't even implement the ISO standard for Open XML. --

Re: Fill Javascript form

2009-05-12 Thread Дамјан Георгиевски
> On 11 Mag, 23:06, Shawn Milochik wrote: >> How is the form "written in JavaScript"? Is it dynamically generated? >> >> In any case, can you just send a POST request if you know the values >> required? > > The problem is indeed that the form is dynamically generated. > That's the .js file: T

How can I dynamically insert a base class in a given class

2009-05-09 Thread Дамјан Георгиевски
How can I dynamically insert a base class in a given class? Yeah, I'm writing a class decorator that needs to manipulate the class by inserting another base class in it. Something like: class ReallyBase(object): def someimportantmethod(self): return 'really really' @expose(args) class

Re: [Python-Dev] .pth files are evil

2009-05-09 Thread Дамјан Георгиевски
> Ah, ok. Is there also an easy_install invocation that unpacks the zip > file into some location of sys.path (which then wouldn't require > editing sys.path)? You have pip that does that :) -- дамјан ( http://softver.org.mk/damjan/ ) ... knowledge is exactly like power - something to be dist

Re: Doc strings in descriptors

2009-05-03 Thread Дамјан Георгиевски
> I have a simple descriptor to create a cached property as shown below. ... > The problem is that when I use the help() function on them, I don't > get the doc string from the function that is being wrapped. ... > What do I need to do to get the doc string of the wrapped function to > apper when

Re: return functions

2009-05-03 Thread Дамјан Георгиевски
> You seem to have finally discovered that when using Apache/mod_wsgi, > Apache does a level of URL matching to filesystem based resources. didn't Paste include something like that ... > This isn't automatic in normal WSGI servers unless you use a WSGI > middleware that does the mapping for you.

Re: eval(WsgiApplication)

2009-05-02 Thread Дамјан Георгиевски
>> > How do I do this in python3? >> >> What's wrong with importing it? > > The problem is that my wsgi files have a wsgi extention for mod_wsgi > use .. > mod_wsgi has a .wsgi handler because it is recommended to rename the > wsgi file with wsgi extensions to avoid double imports > cherrypy serve

Re: Replacing files in a zip archive

2009-05-01 Thread Дамјан Георгиевски
> Which will produce the same output as the original, confounding > your user. You could just write the new values out, since .read > picks the last entry (as I believe it should). Alternatively, if > you want to replace it "in place", you'll need a bit more smarts > when there is more than one c

Re: Replacing files in a zip archive

2009-04-30 Thread Дамјан Георгиевски
> I'm writing a script that should modify ODF files. ODF files are just > .zip archives with some .xml files, images etc. > > So far I open the zip file and play with the xml with lxml.etree, but > I can't replace the files in it. > > Is there some recipe that does this ? I ended writing this, p

Replacing files in a zip archive

2009-04-30 Thread Дамјан Георгиевски
I'm writing a script that should modify ODF files. ODF files are just .zip archives with some .xml files, images etc. So far I open the zip file and play with the xml with lxml.etree, but I can't replace the files in it. Is there some recipe that does this ? -- дамјан ( http://softver.org

Re: AtrributeDict

2009-04-29 Thread Дамјан Георгиевски
>> I've needed an attribute accessible dict, so I created this. >> Are there any obviously stupid shortcomings? > > If you know the attribute names ahead of time, you might consider > using a namedtuple instead. > See > http://docs.python.org/library/collections.html#collections.namedtuple I do u

Re: stuck with PyOBEX

2009-04-29 Thread Дамјан Георгиевски
> This module asks the socket module for AF_BLUETOOTH... in the socket > module there is no such thing as AF_BLUETOOTH. Could it be that the > person that made PyOBEX modified his socket module and forgot to give > his socket module? Or am I missing something? Maybe AF_BLUETOOTH > stands for someth

AtrributeDict

2009-04-29 Thread Дамјан Георгиевски
I've needed an attribute accessible dict, so I created this. Are there any obviously stupid shortcomings? class AttrDict(dict): def __getattr__(self, name): try: return self[name] except KeyError, e: raise AttributeError(e) -- дамјан ( http://softver.org.m

Re: Screenshot of a web page

2009-04-29 Thread Дамјан Георгиевски
> Are you aware of any python module that automatically gives you a > screenshot of a web page? PyQt then use it's WebKit based component, load the web page, then render it into an image. -- дамјан ( http://softver.org.mk/damjan/ ) Give me the knowledge to change the code I do not accept, th

Re: JSON and Firefox sessionstore.js

2009-04-24 Thread Дамјан Георгиевски
> Unless I'm badly mistaken, the Firefox sessionstore.js file is > supposed to be JSON. ... > If it matters, I'm using Firefox 2.0.0.5 under Linux. maybe it can be parsed with PyYAML? -- дамјан ( http://softver.org.mk/damjan/ ) Well when _I_ was in school, I had to run Netscape on HP/UX, displ

Re: QT , Wxwidgets are not just UI framework ?

2009-04-17 Thread Дамјан Георгиевски
>> However, mostly people agree that Qt is the most powerful, but often >> was debunked because of it's licensing. This has changed to the much >> more liberal LGPL for Qt4.5. >> >> Now it might be though that you'd still need to buy a license from >> Phil Thompson for his excellent PyQt-wrapping -

Re: Get the ipv6 address from a interface

2009-04-10 Thread Дамјан Георгиевски
> In Linux, you can only have one IPv4 address per interface (and you > have to use alias interfaces, such as eth0:0, to assign multiple > addresses to a physical link). that's actually not correct, use the "ip" tool (iproute2 package) to see how easily you can have several addresses to a single

Re: ~/.local not in sys.path?

2009-03-28 Thread Дамјан Георгиевски
> I don't see ~/.local in sys.path. Is this some feature which needs to > be enabled? I was kind of unclear after reading the section on it in > the 2.6 What's New document. Here it is, /home/damjan/.local/lib/python2.6/site-packages by default no special settings (on ArchLinux if it matters).

Re: Python3.0 has more duplication in source code than Python2.5

2009-02-10 Thread Дамјан Георгиевски
> I have made the same analysis to some commercial source code, the > dup60 rate is quite often significantly larger than 15%. commercial code sucks often .. that's why they hide it :) -- дамјан ( http://softver.org.mk/damjan/ ) Scarlett Johansson: You always see the glass half-empty. Woody Al

Re: is python Object oriented??

2009-02-03 Thread Дамјан Георгиевски
> Why? - Python is object oriented, but I can write whole systems > without defining a single class. > By analogy, if data hiding is added to language, I could write a > whole system without hiding a single item. I guess the problem is that you would not be able to use some libraries because the

Re: Completer with history for Python 3 ?

2009-02-01 Thread Дамјан Георгиевски
> I've been long using this recipe [1] „Completer with history viewer > support and more features“ with the interactive prompt of python 2.x > But it's not compatible with Python 3.0 > > Anyone know of a similar functionality for Python 3.0 or I should try > to port this script? > > [1] > http://

Completer with history for Python 3 ?

2009-02-01 Thread Дамјан Георгиевски
I've been long using this recipe [1] „Completer with history viewer support and more features“ with the interactive prompt of python 2.x But it's not compatible with Python 3.0 Anyone know of a similar functionality for Python 3.0 or I should try to port this script? [1] http://code.activestate

Using lxml to screen scrap a site, problem with charset

2009-02-01 Thread Дамјан Георгиевски
So, I'm using lxml to screen scrap a site that uses the cyrillic alphabet (windows-1251 encoding). The sites HTML doesn't have the header, but does have a HTTP header that specifies the charset... so they are standards compliant enough. Now when I run this code: from lxml import html doc = htm

Re: small python-cgi wiki?

2009-01-28 Thread Дамјан Георгиевски
> I'm looking to set up a small private wiki, and am looking for > recommendations. > > Some sort of CGI based package that I could just untar somewhere web > accessable via Apache would be great. http://hatta.sheep.art.pl/About · single file · stores stuff in mercurial. · it's WSGI, so yes you c

Re: Reuse of DB-API 2.0 cursors for multiple queries?

2009-01-28 Thread Дамјан Георгиевски
> Today, I used the adodbapi module against an SQL Server Express > database. I was surprised to get an exception, when I attempted to > submit a second query with my cursor object. The full session is > below. >>> curs.execute('select * from localview_roles') >>> curs.execute('select * from loc

Re: USB in python

2009-01-26 Thread Дамјан Георгиевски
>> Sorry, by USB device, I meant a device that is powered/activated by a >> bunch of wires that I want to control using a computer and since I >> had a spare USB jack lying around, I used that instead. But so far I >> haven't tried it, nor will try it if it wont work properly. Yes, it >> is not a p

Re: A different kind of interface

2009-01-25 Thread Дамјан Георгиевски
>> I don't know what an IBQ is. > > +IBQ- seems to be the way your newsreader displays the dashes that > where in Ben's posting. I see "em dash" characters there: I see IBQ too ... also weird is that he has Content-Type: text/plain; charset=utf-7 -- дамјан ( http://softver.org.mk/damjan/ ) G

Re: v = json.loads("{'test':'test'}")

2009-01-25 Thread Дамјан Георгиевски
> raise ValueError(errmsg("Expecting property name", s, end)) > http://docs.python.org/library/json.html > What am I doing wrong ? try this v = json.loads('{"test":"test"}') JSON doesn't support single quotes, only double quotes. -- дамјан ( http://softver.org.mk/damjan/ ) A: Because it revers

Re: ifconfig in python

2009-01-19 Thread Дамјан Георгиевски
Something *like* this could work: myip = urllib2.urlopen('http://whatismyip.org/').read() of course then you are depending on an external service, not a very reliable one even. But then again, you might create an internal service like that yourself. This cgi-bin shell code like this fo

Re: wsgi silently swallows errors

2009-01-19 Thread Дамјан Георгиевски
> Consider the following wsgi app: > > def application(env, start_response): > start_response('200 OK',[('Content-type','text/plain')]) > yield "hello" > x=1/0 > yield "world" > > The result of this is that the web browser displays "hello" and an > error > message ends up in the web log

Re: redirecting stderr back..

2009-01-12 Thread Дамјан Георгиевски
> Hi All, > > Can someone tell me how to redirect stderr back to the console once > you've moved it? > > import os,sys > se = os.open("/tmp/mod.log", os.O_WRONLY|os.O_APPEND|os.O_CREAT) > sys.stderr.write("Foobar\n") > Foobar > os.dup2(se, 2) why not os.dup2(2, 10) and then later os.dup2(10, 2

Re: Problem with -3 switch

2009-01-12 Thread Дамјан Георгиевски
> Perhaps you also like to hear from a developer who has worked on > Python 3.0 itself and who has done lots of work with internationalized > applications. If you want to get it right you must > > * decode incoming text data to unicode as early as possible > * use unicode for all internal text dat

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread Дамјан Георгиевски
> The themed Tk widgets (ttk) that come with Tk 8.5 add a lot of the > same things that Tix does, but they do so in a more modern way, > hooking into platform-specific themes and API's wherever possible (XP, > Vista, Mac) and updating the generic X11 look as well. As such, they > are more appropria

Re: python is great

2009-01-06 Thread Дамјан Георгиевски
>> And there are >> some things (such as Flash-style web applets) that you still can't do >> at all in Python, even after all these years. > > You're looking for Silverlight: > > http://www.voidspace.org.uk/ironpython/silverlight/index.shtml or clutter which has Python bindings http://www.clutte

Re: mod_python resources

2008-12-16 Thread Дамјан Георгиевски
> I'm trying again because I'm stubborn. Maybe the fourth time will be > the charm... > > Are there any good tutorials out there for setting up Apache with > mod_python? mod_python is depreceated, nobody uses it. use mod_wsgi http://www.modwsgi.org/ -- дамјан ( http://softver.org.mk/damjan/

Re: ethical questions about global variables

2008-12-16 Thread Дамјан Георгиевски
> By "per-class-instance variables", you are talking > about instance attributes? I.e. "self.use_gmt_times"? > I don't see much difference between global variables > and instance attributes. using global variable in modules makes the module not Thread-safe Using a instance attribute allows more

Re: Structure using whitespace vs logical whitespace

2008-12-15 Thread Дамјан Георгиевски
> In most languages, I'll do something like this > > xmlWriter.BeginElement("parent"); > xmlWriter.BeginElement("child"); > --xml.Writer.Characters("subtext"); > xmlWriter.EndElement(); > xmlWriter.EndElement(); > > Where the dashes are indentation (since some newsgroup handlers d

Re: File names, character sets and Unicode

2008-12-13 Thread Дамјан Георгиевски
> In a nutshell, this is likely to cause pain until all file systems are > standardized on a particular encoding of Unicode. Probably only about > another fifteen years to go ... well, most Linux distros are defaulting to a UTF-8 locale now, the exception beeing Gentoo&similar that expect the use

Re: Python 3 read() function

2008-12-04 Thread Дамјан Георгиевски
> I don't think it matters. Here's a quick comparison between 2.5 and > 3.0 on a relatively small 17 meg file: > > C:\>c:\Python30\python -m timeit -n 1 > "open('C:\\work\\temp\\bppd_vsub.csv', 'rb').read()" > 1 loops, best of 3: 36.8 sec per loop > > C:\>c:\Python25\python -m timeit -n 1 > "op

Re: Switching windows in PyQT

2008-12-03 Thread Дамјан Георгиевски
> I am new to PyQT and GUI programming in general. What tutorials I have > found are relatively clear on standard operations within a single > window (QtGui.QWidget or QtGui.QMainWindow). Exiting this window exits > the overall application. > > How would I switch between windows, that is close on

Re: HELP!...Google SketchUp needs a Python API

2008-11-29 Thread Дамјан Георгиевски
> Fight with me for Glory not riches. Fight with me and > you shall be free. FREDOM! SketchUp is not free -- дамјан ( http://softver.org.mk/damjan/ ) war is peace freedom is slavery restrictions are enablement -- http://mail.python.org/mailman/listinfo/python-list

Re: Tools for using virtual environments and PEP 370

2008-11-28 Thread Дамјан Георгиевски
> Python 2.6 implemented PEP 370: Per-user site-packages Directory Ok, you can completelly replace virtualenv with a) setting PYTHONUSERBASE= b) Editing ~/.pydistutils.cfg to be like: [install] user=True After this, installing new packages go to $PYTHONUSERBASE/lib/python2.6/si

Re: Tools for using virtual environments and PEP 370

2008-11-27 Thread Дамјан Георгиевски
> Python 2.6 implemented PEP 370: Per-user site-packages Directory[1] > > Now, are there any tools I could use to create and activate virtual > environments like workingenv, virtualenv etc. but that will use > PYTHONUSERBASE instead of hard-linking the python program. > > > [1] > http://docs.pyt

Tools for using virtual environments and PEP 370

2008-11-20 Thread Дамјан Георгиевски
Python 2.6 implemented PEP 370: Per-user site-packages Directory[1] Now, are there any tools I could use to create and activate virtual environments like workingenv, virtualenv etc. but that will use PYTHONUSERBASE instead of hard-linking the python program. [1] http://docs.python.org/dev/what

Re: end child process when parent dies (on Unix)

2008-11-17 Thread Дамјан Георгиевски
>> I'm starting a Unix tool with subprocess.Popen() from a python script >> and I want the child to be killed when the parent (my script) ends >> for whatever reason *including* if it gets killed by SIGKILL. > > A Linux-specific solution is prctl(2). I've tried this in a test C program... exactly

Re: Single-instance daemons

2008-11-16 Thread Дамјан Георгиевски
> As per Stevens/Rago, "file and record locking provides a convenient > mutual-exclusion mechanism". On linux (at least) there's one nice trick to get a single-instance program. Create a unix domain socket, and bind it to an address that begins with the null character '\0'. You can bind the sa

end child process when parent dies (on Unix)

2008-11-16 Thread Дамјан Георгиевски
Hi all, I'm starting a Unix tool with subprocess.Popen() from a python script and I want the child to be killed when the parent (my script) ends for whatever reason *including* if it gets killed by SIGKILL. For normal situations I can send a signal to the pid of the Popen object. But not if the