I am wondering if there are any tips or tricks to converting perl into python. It would be nice if there was a script like python's 2to3. Or perhaps some compatibility libraries.
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit.
I need Pros and Cons for Python development between this two editors...
I like the sinatra framework, but might have to work in python. A quick web search has uncovered a few python equivalents including itty, flask and juno.
I'd like to know people's experience of these, or other sinatra equivalents. Which would you recommend?
I'm studying Python after a lot of PHP experience and it would be handy to have type-hinting in Python. Looks like eclipse + pydev doesn't support this. Any suggestions?
For example, I want my IDE to show function docstrings and types, when I use it, like:
def f(x: int) -> int:
r"""Adds 3 to x"""
return x + 3
f( #and now IDE shows everything about types
im doing a project as part of academic programme.Im doing this in linux platform.I have converted a few pdf files in to html and jpeg images using pdftohtml.now i need to sequence the jpeg images depending on some conditions and to merge them .how can i do this using python?.if anyone can provide any such python script which have done any functions similar to this then it will be very helpful.
A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environment), but using Google there seems to be a preliminary ProLog implementation for both.
Any suggestions on modern (open source) web languages (like Python or Ruby) in combination with AI?
Hi.
I have a text file of URLs, about 14000. Below is a couple of examples:
http://www.domainname.com/pagename?CONTENT_ITEM_ID=100¶m2=123
http://www.domainname.com/images?IMAGE_ID=10
http://www.domainname.com/pagename?CONTENT_ITEM_ID=101¶m2=123
http://www.domainname.com/images?IMAGE_ID=11
http://www.domainname.com/pagename?CONTENT_ITEM_ID=102¶m2=123
I have loaded the text file into a Python list and I am trying to get all the URLs with CONTENT_ITEM_ID separated off into a list of their own. What would be the best way to do this in Python?
Cheers
Is there an application similar to Java's Checkstyle for Python?
By which I mean, I tool that analyzes Python code, and can be run as part of continuous integration (e.g. CruiseControl or Hudson). After analyzing it should produce an online accessible report which outlines any problems found in the code.
Thank you,
scenario: a modular app that loads .py modules on the fly as it works. programmer (me) wishes to edit the code of a module and and then re-load it into the program without halting execution.
can this be done?
i have tried running import a second time on an updated module.py, but the changes are not picked up
I'm trying to compile Python 2.6 for 64bit, I tried various compile commands but not sure whether those are correct
./configure --with-universal-archs=32-bit --prefix="$HOME/python"
make
make install
What is the correct syntax ... ?
hi,
I am trying to call webservice from python client using SUDS. When I call a function with a complex data type as input parameter, it is not passed correctly, but complex data type is getting returned correctly froma webservice call.
Webservice Type:
Soap Binding 1.1
Document/Literal
Webserver:
Weblogic 10.3
Python Version: 2.6.5, SUDS version: 0.3.9
here is the code I am using:
Python Client:
from suds.client import Client
url = 'http://192.168.1.3:7001/WebServiceSecurityOWSM-simple_ws-context-root/SimpleServicePort?WSDL'
client = Client(url)
print client
#simple function with no operation on input...
result = client.service.sopHello()
print result
result = client.service.add10(10)
print result
params = client.factory.create('paramBean')
print params
params.intval = 10
params.longval = 20
params.strval = 'string value'
#print "params"
print params
try:
result = client.service.printParamBean(params)
print result
except WebFault, e:
print e
try:
result = client.service.modifyParamBean(params)
print result
except WebFault, e:
print e
print params
webservice java class:
package simple_ws;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
public class SimpleService {
public SimpleService() {
}
public void sopHello(int i) {
System.out.println("sopHello: hello");
}
public int add10(int i) {
System.out.println("add10:");
return 10+i;
}
public void printParamBean(ParamBean pb) {
System.out.println(pb);
}
public ParamBean modifyParamBean(ParamBean pb) {
System.out.println(pb);
pb.setIntval(pb.getIntval()+10);
pb.setStrval(pb.getStrval()+"blah blah");
pb.setLongval(pb.getLongval()+200);
return pb;
}
}
and the bean Class:
package simple_ws;
public class ParamBean {
int intval;
String strval;
long longval;
public void setIntval(int intval) {
this.intval = intval;
}
public int getIntval() {
return intval;
}
public void setStrval(String strval) {
this.strval = strval;
}
public String getStrval() {
return strval;
}
public void setLongval(long longval) {
this.longval = longval;
}
public long getLongval() {
return longval;
}
public String toString() {
String stri = "\nInt val:" +intval;
String strstr = "\nstrval val:" +strval;
String strl = "\nlong val:" +longval;
return stri+strstr+strl;
}
}
so, as issue is like this:
on call: client.service.printParamBean(params) in python client,
output on server side is:
Int val:0
strval val:null
long val:0
but on call: client.service.modifyParamBean(params)
Client output is:
(reply){
intval = 10
longval = 200
strval = "nullblah blah"
}
What am i doing wrong here??
If Python had a macro facility similar to Lisp/Scheme (something like MetaPython), how would you use it?
If you are a Lisp/Scheme programmer, what sorts of things do you use macros for (other than things that have a clear syntactic parallel in Python such as a while loop)?
Hi
I using buzz-python-client from http://code.google.com/p/buzz-python-client/
In the example:
client.build_oauth_consumer('your-app.appspot.com', 'consumer_secret')
Where can I get a consumer_secret?
Is it possible in Python to run multiple counters in a single for loop as in C/C++? I would want something like -- for i,j in x,range(0,len(x)): I know Python interpretes this differently and why, but I would need to run two loop counters concurrently in a single for...?
Thanks,
Sayan
So I've got plain python downloaded, so I can run .py files from the command line. Now I want to step it up, have a debugger, be able to call .net or other Windows things, etc...
What's my next step? What's a good Python environment for Windows?
I am looking for python stubbing library. Something that could be used to create fake classes/methods in my unit tests.. Is there a simple way to achieve it in python..
Thanks
PS: I am not looking for mocking library where you would record and replay expectation.
I have a messages folder(package) with __init__.py file and another module messages_en.py inside it. In __init__.py if I import messages_en it works, but __import__ fails with "ImportError: No module named messages_en"
import messages_en # it works
messages = __import__('messages_en') # it doesn't ?
I used to think 'import x' is just another way of saying __import__('x')
How do I create a GUID in Python that is platform independent? I here there is a method using ActivePython on Windows but it's Windows only because it uses COM. Is there a method using plain Python?
Hi, I'm looking into using Lua in a web project. I can't seem to find any way of directly parsing in pure python and running Lua code in Python.
Does anyone know how to do this?
Joe
I have just come across quantmod, and I would like to use it from Python. However I am not sure how to use quantmod from a Python script.
Has anyone done this before - any ideas or suggestions on how to get started?
Hi everyone,
I have the following input:
input = [(dog, dog, cat, mouse), (cat, ruby, python, mouse)]
and trying to have the following output:
outputlist = [[0, 0, 1, 2], [1, 3, 4, 2]]
outputmapping = {0:dog, 1:cat, 2:mouse, 3:ruby, 4:python, 5:mouse}
Any tips on how to handle given with scalability in mind (var input can get really large).
Hi,
I am writting a python script and I am running out of time. I need to so some things that I know pretty well in bash, so I just wonder how can I embed some bash lines into a python script.
Thanks
I'm writing a simple alarm utility in Python.
#!/usr/bin/python
import time
import subprocess
import sys
alarm1 = int(raw_input("How many minutes (alarm1)? "))
while (1):
time.sleep(60*alarm1)
print "Alarm1"
sys.stdout.flush();
doit = raw_input("Continue (Y/N)?[Y]: ")
print "Input",doit
if doit == 'N' or doit=='n':
print "Exiting....."
break
I want to flush or discard all the key strokes that were entered while the script was sleeping and only accept the key strokes after the raw_input() is executed.