Possibly a horribly stupid question: will the pywin32 extensions work on Windows 7? If not, does anyone know of plans for windows 7 extensions for python?
I want to extend some locale-specific features of a python application named OpenERP. All I need is implementing a third party module.function that would be called every time OpenERP calls locale.setlocale() function without changing neither OpenERP nor locale module source code.
The only way I can imagine is provide a module named locale.py inside main application package dir, but It seems that is an unpythonic workaround.
Python says I need 4 bytes for a format code of "BH":
struct.error: unpack requires a string argument of length 4
Here is the code, I am putting in 3 bytes as I think is needed:
major, minor = struct.unpack("BH", self.fp.read(3))
"B" = Unsigned char (1 byte) + "H" unsigned short (2 bytes) = 3 bytes (!?)
struct.calcsize("BH") says 4 bytes.
I'm trying to integrate facebook into my application so that users can use their FB login to login to my site. I've got everything up and running and there are no issues when I run my site using the command line
python manage.py runserver
But this same code refuses to run when I try and run it through Apache.
I get the following error:
Environment:
Request Method: GET
Request URL: http://helvetica/foodfolio/login
Django Version: 1.1.1
Python Version: 2.6.4
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'foodfolio.app',
'foodfolio.facebookconnect']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'facebook.djangofb.FacebookMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'facebookconnect.middleware.FacebookConnectMiddleware')
Template error:
In template /home/swat/website-apps/foodfolio/facebookconnect/templates/facebook/js.html, error at line 2
Caught an exception while rendering: No module named app.models
1 : <script type="text/javascript">
2 : FB_RequireFeatures(["XFBML"], function() {FB.Facebook.init("{{ facebook_api_key }}", " {% url facebook_xd_receiver %} ")});
3 :
4 : function facebookConnect(loginForm) {
5 : FB.Connect.requireSession();
6 : FB.Facebook.get_sessionState().waitUntilReady(function(){loginForm.submit();});
7 : }
8 : function pushToFacebookFeed(data){
9 : if(data['success']){
10 : var template_data = data['template_data'];
11 : var template_bundle_id = data['template_bundle_id'];
12 : feedTheFacebook(template_data,template_bundle_id,function(){});
Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/home/swat/website-apps/foodfolio/app/controller.py" in __showLogin__
238. context_instance = RequestContext(request))
File "/usr/lib/pymodules/python2.6/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/lib/pymodules/python2.6/django/template/loader.py" in render_to_string
108. return t.render(context_instance)
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
178. return self.nodelist.render(context)
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
779. bits.append(self.render_node(node, context))
File "/usr/lib/pymodules/python2.6/django/template/debug.py" in render_node
71. result = node.render(context)
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
946. autoescape=context.autoescape))
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
779. bits.append(self.render_node(node, context))
File "/usr/lib/pymodules/python2.6/django/template/debug.py" in render_node
81. raise wrapped
Exception Type: TemplateSyntaxError at /foodfolio/login
Exception Value: Caught an exception while rendering: No module named app.models
I've googled a lot,and still can't make it work,
each time it reports some dll load failed(mainly because of gtk,how can I make it work in windows without ImportError: DLL load failed?)...
I'm gonna uninstall all python/gtk related stuff and start from the beginning.
Is there a tutorial that covers every problem of the installation?
I was wondering what language to use when talking about a function that takes in a specific object, acts on it and returns something else. Clearly they're functions, but I was wondering if there's a more specific term.
A couple examples of Python built-in functions that fit this spec are: 'len', 'dir', 'vars'
I thought it was 'predicate', but apparently that's specific to functions that return a boolean value.
Hi,
I am trying to talk to a SOAP web service using SUDS and Python. After lots of messing around learning Python (yes I am new to this) and working out how to use SUDS I have come across a problem.
The signature of the web method I am calling, according to suds, is
(FWTCaseCreate){
ClassificationEventCode = None
Priority = None
Title = None
Description = None
Queue = None
DueDate = None
AssociatedObject =
(FWTObjectBriefDetails){
ObjectID =
(FWTObjectID){
ObjectType = None
ObjectReference[] = <empty>
}
ObjectDescription = None
Details = None
Category = None
}
Form =
(FWTCaseForm){
FormField[] = <empty>
FormName = None
FormKey = None
}
Internal = None
InteractionID = None
XCoord = None
YCoord = None
}
So I use SUDS to create the classes that I want and send it to the method. However I get an error. So I turned logging on and I can see that the XML that is being sent is not correct which is causing a deserialize error.
The SOAP package looks like the following
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.lagan.com/wsdl/FLTypes" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security>
<wsse:BinarySecurityToken>eaadf1ddff99a8</wsse:BinarySecurityToken>
</wsse:Security>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:FWTCaseCreate>
<ClassificationEventCode>
<ClassificationEventCode>2000023</ClassificationEventCode>
<Priority>1</Priority>
<Title>testing</Title>
<Description>testing</Description>
<Queue/>
<Internal>True</Internal>
<XCoord>356570</XCoord>
<YCoord>168708</YCoord>
</ClassificationEventCode>
</ns0:FWTCaseCreate>
</ns1:Body>
As you can see there is a
'ClassificationEventCode'
element around all the other elements, this should not be there. If I cut and paste this xml into SOAPUI and first remove this element and then post it directly to the web service it works successfully.
Does anyone have any ideas why this is happening? I guess SUDS thinks that it should be there based on the WSDL.
Thanks.
I am in a need of programatically convert an Word-XML file into a RTF file. It has become a requirement, because of some third party libraries. Any API/Library that can do that?
Actually the language is not a problem because I just need to work done. But Java, .NET languages or Python are preferred.
I am using minidom in Python and I'd like getElementsByTagName() to match elements purely by tag-name and ignore any namespaces. The documents are being parsed by minidom.parseString(). Is it possible?
I'm using the python OpenCV bindings and at the moment I try to isolate a colorrange. That means I want to filter out everything that is not reddish.
I tried to take only the red color channel but this includes the white spaces in the Image too.
What is a good way to do that?
Being new to Python, I decided to get some feedback on a class I'd written ASAP so I ran it against pylint. Is the message it gave "Warning: Method could be a function" telling me that it would be better to move this method out of the class because it doesn't use any instance variables? In c# I would make this a static method. What's the most pythonic thing to do here?
Hello everyone,
I am trying to write Python wrap for C code which uses struct.
modules.c:
struct foo
{
int a;
};
struct foo bar;
modulues.i
%module nepal
%{
struct foo
{
int a;
}
%}
extern struct foo bar;
But during compiling I am given error:
In function ‘Swig_var_bar_set’:
error: ‘bar’ undeclared (first use in this function)
Could you be so kind to help me how to correctly define export struct variable ?
I'd like to generate an array with defined Min, Max, Mean and Stdev with given number of elements and error level. Is there such a library in C, C++, PHP or Python to do so? Please kindly advise. Thanks!
Let's say that I have the following text:
input = "one aaa and bbb two bbbb er ... // three cccc"
I would like to parse this into a group of variables that contain
criteria = ["one", "two", "three"]
v1,v2,v3 = input.split(criteria)
I know that the example above won't work, but is there some utility in python that would allow me to use this sort of approach? I know what the identifiers will be in advance, so I would think that there has got to be a way to do this...
Thanks for any help,
jml
How do I randomly add buttons to a Tkinter GUI? I need it to be able to create a button, then put it anywhere on the window, is this possible? I am using Python 2.6 on Windows.
How do I use a Python library such as Scrapy in a CGI script or even in a framework such as Django if I need to do so later?
Here is the documentation I've consulted thus far, but it doesn't seem to meet the concern I have.
http://doc.scrapy.org/topics/spiders.html
http://doc.scrapy.org/topics/webconsole.html
Critique and suggestions are welcomed!
For example, say I have string like:
duck duck duck duck goose goose goose dog
And I want it to be as sparsely populated as possible, say in this case
duck goose duck goose dog duck goose duck
What sort of algorithm would you recommend? Snippets of code or general pointers would be useful, languages welcome Python, C++ and extra kudos if you have a way to do it in bash.
Hi,
I know python and have just read a basic intro of django. I have to built something like a travel website with real time updates. Will django be sufficent for this? Somebody advised me to look at django-CMS, I couldn't find a very beginner's tutorial there. Should I opt for django-CMS? Also how much of django should i know before i can try out django-cms?
Thanks
I configured my Emacs for code completion and other help using this link (from another question here on SO). I am a complete newbie to emacs.
Can anyone tell me what should I change so it (rope, ropemacs, pymacs, yasnippet etc) picks up symbols of IronPython modules for code completion and snippets.
Also I want to map:
C-x RET - to invoke IronPython.exe and not Python.exe (any clue on how to do that)
PS I am using Emacs with Cygwin on XP machine
I want to write a command line utility that can be used to synchronize the execution off programs in different consoles.
Console A:
$ first_program && semaphore -signal
Console B:
$ semaphore -wait && second_program
The first program takes a long take to complete. The second program can only start when the first program has finished.
Which synchronization object do I need to implement this (in Python)?
Seems that even after unchecking the option in the PyDev/Debug preferenecs pane to launch in the background, once it's launched I have to go to task manager to kill the python process.
i look at this article : http://code.google.com/intl/zh-CN/appengine/docs/python/mail/receivingmail.html
and i want to know : is article used to deal with mail from others send to me ?
and my gmail is [email protected] , so someone send email to [email protected],i can do something automatically use incoming mail ,yes ?
thanks
Hi all -
I'm attempting to write a Python wrapper for poker-eval, a c static library. All the documentation I can find on ctypes indicates that it works on shared/dynamic libraries. Is there a ctypes for static libraries?
I know about cython, but should I use that or recompile the poker-eval into a dynamic library so that I can use ctypes?
Thanks,
Mike