Hello,
I want to convert the input 24 bit PNG image to 8 bit, I have tried using Imagemagick and Python PIL, neither works.
for instance:
at Imagemagick I try convert console command as such:
convert -depth 8 png24image.png png8image.png
And here is the way I tried with python:
import Image
def convert_8bit(src, dest):
"""
...
this is my html :
<div id='automail'>
<form action = "/admin/mail" method = "get">
auto mail when user :<br/><br/>
<div>
<input type="checkbox" name="automail" value ="signup">signUp</input><br/>
<input type="checkbox" name="automail" value ="login">login</input><br/>
</div>
<d...
Hi there,
I am still writing on a python interface for my c code with ctypes. Today I substituted my file reading function with a python version, which was programmed by somebody else usind NumPy. The 'old' c version was called with a byref(p_data) while p_data=PFloat() (see below). The main function takes the p_data.
Old file reading:...
Hi there,
I am facing a problem with using Django DB module in an external gateway script.
I have the following python file under
myproject/myapplication/lib.py
#<path>/myproject/myapplication/lib.py
from django.db import connection
from django.db import settings
#SOME METHODS ARE HERE
which is using django db module.
I need to ...
Hello, I am using sparse matrices as a mean of compressing data, with loss of course, what I do is I create a sparse dictionary from all the values greater than a specified treshold. I'd want my compressed data size to be a variable which my user can choose.
My problem is, I have a sparse matrix with alot of near-zero values, and what I...
Hi
I need a code portion to refresh the current page. I get the controller object from webbrowser module and start my webpage. And at a certain point I want to refresh my page inside the python code.
According to the documentation at http://docs.python.org/library/webbrowser.html, when I call the open() function of the controller objec...
how to create a lzma file in python and add files
...
I have a data structure that looks like this:
data =[
{'key_1': { 'calc1': 42, 'calc2': 3.142 } },
{'key_2': { 'calc1': 123.4, 'calc2': 1.414 } },
{'key_3': { 'calc1': 2.718, 'calc2': 0.577 } }
]
I want to be able to save/and load the data into a CSV file with the following format
key, calc1, calc2 <- header
key_1, 42, ...
Hello,
I placed a dhtmlxGrid , an Ajax-enabled JavaScript grid control, in HTML page. By clicking a submit button, a javascript function will generate XML file from the grid (it is called Dataprocessor) and send the XML file to a server-side script on the server. Currently, there are ready-made PHP and Ruby on Rails scripts but I am i...
I am unable to get this code to sort a list of objects using either .sort() or sorted(). What am I missing here?
P.S. My solution.distance() method could use some cosmetic surgery too if anyone has any suggestions.
Thanks!
import random
import math
POPULATION_SIZE = 100
data = [[1, 565.0, 575.0],
[2, 25.0, 185.0],
...
I can add several panes to the wx.aui.AuiManager.
Because I have the direction set to CENTER, they attach on themselfs and have a litle border between them where I can define the size of two panes.
Now, I want to know if I can set the size of that border. Is it possible?
Thanks in advance! :D
...
I am trying to call remote (ssh) commands using the subprocess.call function like this.
import shlex
from subprocess import call
cmd1='ssh [email protected] mkdir temp'
cmd2='scp test.txt [email protected]:temp'
call(shlex.split(cmd1))
call(shlex.split(cmd2))
When I call the above, the mkdir does not seem to execute - although the doc...
Hi,
I want to make a QT4 (using QT designer) dialog, that contains a part where a file has to be selected.
Now, I know QFileDialog exists, and I can program something that does what I want.
But can I also just do it in QT designer?
Is there some way to get a "file select" widget in QT designer?
Or, I remember these buttons, having the...
For each of my projects I create an apps directory that holds all the apps I need. Satchmo also has an apps directory. Can I do something like python manage.py runserver --pythonpath=/path/to/my/apps /path/to/satchmo/apps? Is there some separator that it can take?
...
I wrote a Twisted Python HTTP proxy, and keep getting the following Traceback after navigating to a page through the proxy.
Traceback (most recent call last):
File "C:\ZBrownTechnology\Web Lock\Proxy.py", line 57, in <module>
reactor.run()
File "C:\Python26\lib\site-packages\twisted\internet\base.py", line 1165, in run
self....
I wish to sequentially run some c scripts that fork their own processes (in a new command line window) and give the "Press any key to continue..." when they are completed. Technically, it is a special compiler. It pops up with acommand line window and tells me whether the compile was successful or not. But that command line window for...
I'm reading a date from an Excel cell in Python (using .Value on the cell)... the result that I get is:
07/06/10 00:00:00
I thought this was a string, and so went about trying to figure out how to convert this to the format I need ("yyyyMMdd", or "20100706" in this example). However, after some playing around I realized that it is not...
Hi all,
I'm developing my own Python code interpreter using the Python C API, as described in the Python documentation. I've taken a look on the Python source code and I tried to follow the same steps that are carried out in the standard interpreter when executing a py file. These steps (sequence of C API function calls) are basically:
...
Are there any Python built-ins or widely used Python libraries to perform a search in a sorted sequence?
...
In python, I'm compiling a regular expression pattern like so:
rule_remark_pattern = re.compile('access-list shc-[(in)(out)] [(remark)(extended)].*')
I would expect it to match any of the following lines:
access-list shc-in remark C883101 Permit http from UPHC outside to Printers inside
access-list shc-in extended permit tcp object-g...