I am trying to customize the "Event" portlet in Plone 3 that shows the upcoming events. The "view" link in the footer of that portlet goes to the /events URL. But my site is multi-lingual so that URL is not always correct. For example, the correct URL for Dutch events should be /evenementen.
In my setup I use one folder per language. /e...
What is the best way to map a network share to a windows drive using Python?
This share also requires a username and password.
...
I have generator object returned by multiple yield. Preparation to call this generator is rather time-consuming operation. That is why I want to reuse generator several times.
y = FunctionWithYield()
for x in y: print(x)
#here must be something to reset 'y'
for x in y: print(x)
Of course, I'm taking in mind copying content into simpl...
I get this error when I try to use one of the py2exe samples with py2exe.
File "setup.py", line 22, in ?
import py2exe
ImportError: no module named py2exe
I've installed py2exe with the installer, and I use python 2.6. I have downloaded the correct installer from the site (The python 2.6 one.)
My path is set to C:\Python26 and I c...
This crops up every now and then for me: I have some C# code badly wanting the range() function available in Python.
I am aware of using
for (int i = 0; i < 12; i++)
{
// add code here
}
But this brakes down in functional usages, as when I want to do a Linq Sum() instead of writing the above loop.
Is there any builtin? I guess I ...
Hello
I am in facing a performance problem in my code.I am making db connection a making a select query and then inserting in a table.Around 500 rows in one select query ids populated .Before inserting i am running select query around 8-9 times first and then inserting then all using cursor.executemany.But it is taking 2 miuntes to in...
Do you know if it is possible to know in a django template if the TEMPLATE_DEBUG flag is set?
I would like to disable my google analytics script when I am running my django app on my development machine. Something like a {% if debug %} template tag would be perfect. Unfortunately, I didn't find something like that in the documentation.
...
I'm new to Python / GAE / Django. I get that with GAE there are no in-memory sessions per se... but I think I want something equivalent. I read that Django sessions can be backed by BigTable or MemCache, but I never got them working. I guess what I'm asking is "Should I..."
Persist with getting Django sessions working?
Look at some oth...
I don't know the correct terminology to do a google search.
What I want is to make a POST http request to other url, for example
twitter, from within mi app in google app engine.
If the question is unclear please comment.
Thanks!
Manuel
...
I get a warning that BaseException.message is deprecated in Python 2.6 when I use the following user-defined exception:
class MyException(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return repr(self.message)
This is the warning:
DeprecationWarning: BaseException.message has been dep...
Hi,
I have a python script calling an exe file. The exe file can be in the same folder as that of the python script or in a network drive. Is it possible to call the exe if it is in a remote drive/computer? Can this be done by setting the %PATH% variable
...
This is the scenario:
We have a Python script that starts a Windows batch file and redirects its output to a file. Afterwards it reads the file and then tries to delete it:
os.system(C:\batch.bat >C:\temp.txt 2>&1)
os.remove(C:\temp.txt)
In the batch.bat we start a Windows GUI programm like this:
start c:\the_programm.exe
Thats al...
I have csv files with the following format:
CSV FILE
"a" , "b" , "c" , "d"
hello, world , 1 , 2 , 3
1,2,3,4,5,6,7 , 2 , 456 , 87
h,1231232,3 , 3 , 45 , 44
The problem is that the first field has commas "," in it. I have no control over file generation, as that's the format I receive them i...
I'm looking for the simplest way of using python and SQLAlchemy to produce some XML for a jQuery based HTTP client. Right now I'm using mod_python's CGI handler but I'm unhappy with the fact that I can't persist stuff like the SQLAlchemy session.
The mod_python publisher handler that is apparently capable of persisting stuff does not al...
class __init__:
path = "articles/"
files = os.listdir(path)
files.reverse()
def iterate(Files, Path):
def handleXml(content):
months = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
parse = re.compile('<(.*?)>(.*?)<(...
I want to repeat this question using python. Reason is I have access to 10 nodes in a cluster and each node is not identical. They range in performance and I want to find which is the best computer to use remotely based on memory and cpu-speed/cores available.
EDIT: Heck, even just a command line interface would be useful. Any quick and...
Hello everyone,
here is my problem: I would like to create a boolean matrix B that contains True everywhere that matrix A has a value contained in vector v. One inconvenient solution would be:
import numpy as np
>>> A = np.array([[0,1,2], [1,2,3], [2,3,4]])
array([[0, 1, 2],
[1, 2, 3],
[2, 3, 4]])
>>> v = [1,2]
>>> B = (A...
I'm trying to write some code that uses Numpy. However, I can't import it:
Python 2.6.2 (r262, May 15 2009, 10:22:27)
[GCC 3.4.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
...
How do I disable assertions in Python? That is - if it fails, I don't want it to throw an AssertionError, but to keep going.
...
Hello, I am working on a django app. One part would involve uploading files (e.g. spreadsheet or whatever). I am getting this error:
IOError at /fileupload/
[Errno 13] Permission denied: 'fyi.xml'
Where 'fileupload' was the django app name and 'fyi.xml' was the test document I was uploading.
So, I used chmod and chown to make the ...