Python Script Cannot Write to Directory Hi, I am writing a script that, at one point, copies a file from directory A to directory B. Directory B can only be written to by root, but the script is always called with sudo, so this shouldn't be an issue, but it is. I have tried using shutil.copy() and calling "sudo cp " with os.popen to no avail. I cannot... 6 Aug 2010 06:04
Global variables problem Hey guys, I am using a multiprocessing program, where the new process is supposed to change a variable in the main class that it branches out from. This is somehow not working, following is an approximate code. Would really appreciate any insight into this matter: var = {} class Something(): def set_var(... 4 Aug 2010 05:59
Loading pyd fails with "The operating system cannot run %1" Running python 2.6 (r26:66714) on Win Xp Pro SP3, I receive the following message: python -v -v -v import functions .. .. # trying U:\wss\v72212\components\trm\python\lib\lib\site-packages \_fk_cl.pyd # clear[2] __file__ # clear[2] __package__ # clear[2] __path__ # clear[2] __name__ # clear... 4 Aug 2010 02:46
parsing tab and newline delimited text Hi, I have a large file of text I need to parse. Individual 'entries' are separated by newline characters, while fields within each entry are separated by tab characters. So, an individual entry might have this form (in printed form): Title date position data with each field separated by tabs, and ... 4 Aug 2010 02:46
None is negative? I did the google search... I must be blind as I don't see any hits... None is negative in Python? (v2.6) http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python if None < -9999999.99: print "hi" hi if -9999999 > None: print "hi" hi Is there a way to have the compari... 4 Aug 2010 16:53
regular expressions and the LOCALE flag the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". here's what i currently see on my system: import re, locale locale.getdefaultlocale() ('en_GB', 'UTF8') locale.getlocale() (None, None) re.findall(r'\w', u'a b c \xe5 \xe6 \xe7', re.L) ... 3 Aug 2010 21:19
finding homopolymers in both directions Hi, Suppose I have a string such as this 'aabccccccefggggghiiijkr' I would like to print out all the positions that are flanked by a run of symbols. So for example, I would like to the output for the above input as follows: 2 b 1 aa 2 b -1 cccccc 10 e -1 cccccc 11 f 1 ggggg 17 h 1 iii 17 h -1 g... 3 Aug 2010 14:44
[ANN] pyxser-1.4.6r --- Python Object to XML serializer/deserializer -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hello Python Community. I'm pleased to announce pyxser-1.4.6r, a python extension which contains functions to serialize and deserialize Python Objects into XML. It is a model based serializer. Here is the ChangeLog entry for this release: This release contain... 3 Aug 2010 13:38
cPickle error when caching data Hi i get the following error when trying to set data in the cache of a django application. The error is however a python error as it involves pickling and i can reproduce it in a shell. The error i get is this: cPickle.PicklingError: Can't pickle <class 'management.views.Stats'>: attribute lookup management.vi... 3 Aug 2010 12:32
subclassing versus object redefinition Hi! I have a class (supposed to be an abstract base class): In python (as opposed to static languages like C++) I don't seed to subclass the base class, but instead I can simply override the behavior of stub methods and values. Is there a preference between between subclassing (C++ approach) and overriding meth... 3 Aug 2010 12:32 |