So I'm looking at various key:value (where value is either strictly a single value or possibly an object) stores for use with Python, and have found a few promising ones. I have no specific requirement as of yet because I am in the evaluation phase. I'm looking for what's good, what's bad, what are the corner cases these things handle we...
I'm noticing that even for system modules, code completion doesn't work too well.
For example, if I have a simple file that does:
import re
p = re.compile(pattern)
m = p.search(line)
If I type p., I don't get completion for methods I'd expect to see (I don't see search() for example, but I do see others, such as func_closure(), func_...
Sometimes I leave debugging printing statements in my project and it is difficult to find it. Is there any way to find out what line is printing something in particular?
Sidenote
It appears that searching smart can solve the majority of cases. In Pydev (and other IDEs) there is a Search function which allows searching through all files...
I have a script that waits until some row in a db is updated:
con=MySQLdb.connect(server,user,pwd,db)
when the script starts the row's value is "running", and it waits for the value to become "finished"
while(True):
sql='''select value from table where some_condition'''
cur=self.getCursor()
cur.execute(sql)
...
Currently I have a bash script which runs the find command, like so:
find /storage/disk-1/Media/Video/TV -name *.avi -mtime -7
This gets a list of TV shows that were added to my system in the last 7 days. I then go on to create some symbolic links so I can get to my newest TV shows.
I'm looking to re-code this in Python, but I have a...
Hi
I am sorry if this question is too simple but I can't seem to reason this out. I want to parse a string. I want to extract the words between 'The final score is: ' and '.'. In other words, if i have a string "The final score is: 25." I want it to extract 25. I don't know how to do this. Should I use match? or split??
Thanks
...
I developed a small program using python and wxwidgets. It is a very simple program that uses only a mini frame to display some information when needed, and the rest of the time it shows nothing, only an icon in the taskbar.
When I build the exe using py2exe (single file exe mode, optimized), I get a 6Mo size file!
I tried not includin...
I'd like to test whether particular socket options have been set on an existing socket. Ie, pretty much everything you can see in:
#!/usr/bin/env python
'''See possible TCP socket options'''
import socket
sockettypelist = [x for x in dir(socket) if x.startswith('SO_')]
sockettypelist.sort()
for sockettype in sockettypelist:
print...
Alright so I am positive my Arduino circuit is correct and the code for it. I know this because when I use the serial monitor built into Arduino IDE and send 'H' an LED lights up, when I send 'L' that LED turns off.
Now I made a python program
import serial
ser = serial.Serial("COM4",9600)
ser.write("H")
When I run the code the LED ...
I'm experiencing a strange behaviour working with the latest branch of tornadoweb when I deploy my app on my production server.
I tested several times the code and it is fully working when I test it on my laptop (Archlinux) with python 2.6.3 and MySQLdb 1.2.3b2.
As soon as I deploy on my production server (Ubuntu x64) with python 2.6.2...
I've been having problems withe getting setup.py to do the sdist thing correctly. I boiled it down to this. I have the following directory structure:
my_package\
my_subpackage\
__init__.py
deep_module.py
__init__.py
module.py
setup.py
And here's what I have in setup.py:
#!/usr/bin/env python
from dist...
In Django's admin, I want disable the links provided on the "select item to change" page so that users cannot go anywhere to edit the item. (I am going to limit what the users can do with this list to a set of drop down actions - no actual editing of fields).
I see that Django has the ability to choose which fields display the link, ho...
I want to implement some friendlier error messages if the user tries to run a python script which tries to import modules that have not been installed. This includes printing out instructions on how to install the missing module.
One way to do this would be to put a try..catch block around the imports, but this is a bit ugly since it wo...
I have a certain class structure in my app, that currently utilizes django for presentation. I was not using the model layer at all, - the database interaction routines are hand-written.
I am, however, considering the possibility of actually using django to its full potential and actually using the database-abstraction layer. The quest...
I'm trying to get the sample and other sample codes i find for pyuno running with openoffice 3.1.1 and python 2.5 with no luck.
Unfortunately, pyuno does not give any clues about what goes wrong.
In [1]: import uno
In [2]: local = uno.getComponentContext()
In [3]: resolver = local.ServiceManager.createInstanceWithContext("com.sun.st...
I'm trying to detect when a new file is created a directory or when an existing file is modified in a directory.
I tried searching for a script that would do this (preferably in python or bash) but came up short. My environment is linux with Python 2.6
Related Questions:
http://stackoverflow.com/questions/415856/how-to-detect-new-or-m...
In python, I compressed a string using zlib, and then inserted it into a mysql column that is of type blob, using the utf-8 encoding. The string comes back as utf-8, but it's not clear how to get it back into a format where I can decompress it. Here is some pseduo-output:
valueInserted = zlib.compress('a')
= 'x\x9cK\x04\x00\x00b\x00b'
...
I've got a huge tuple of strings, which are being returned from a program. An example tuple being returned might look like this:
('(-1,0)', '(1,0)', '(2,0)', '(3,0)', '(4,0)', '(5,0)', '(6,0)')
I can convert these strings to real tuples (with integers inside), but i am hoping someone knows a nice trick to speed this up. Anything i've ...
Why?
C:\path\>manage.py shell
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
('Spanish_Colombia', '1252')
>>> locale.currency( 1885, grouping=True )
'$ 1.885,00'
>>> locale.currency...
Howdy,
One of the best classes I took in college was Programming Languages where the prof would introduce a language or language concept, do a little playing with it in real time, and send us home with like 10 small little functions or programs to write that used what we learned in class and stretched it just enough to make sure you rea...