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?
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
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 am building a website where my pages are written in MediaWiki Markup, for which I have a working parser function in Python.
Where exactly do I parse my markup: in the view's code, or in the template? My first guess would be something like:
return render_to_response( 'blog/post.html', {'post': post,
'content': parseMyMarkup(post.content) })
Is this the usual convention, or should I do something different?
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
This may be a basic question but how can I include a module with my app.
I'm very new to python and what I want to do is to include this module simplejson with my app, but after downloading it I have no idea what to do next :(
This is how the module looks like after unzip it.
I don't know what files to move to my app.
This is the standard question, "How do I set a process limit for a user account in Linux to prevent fork-bombing," with an additional twist. The running program originates as a root-owned Python process, which then setuids/setgids itself as a regular user. As far as I know, at this point, any limits set in /etc/security/limits.conf do not apply; the setuid-ed process may now fork bomb. Any ideas how to prevent this?
I am looking for a resource to download fixed income data online, much like there is access to stock data from yahoo. At the very least I'd like the treasury bonds.
I use python, but any help would be appreciated.
how can I write a .py file from python such that its type should not be like 'ASCII file with Windows CRLF'
because when i run file.write(data) inside windows it write the file but when I try to
eval(open(file.py).read()) it fails and gives syntax error because of windows CRLF on each line......
I have the following Python 2.6 program and YAML definition (using PyYAML):
import yaml
x = yaml.load(
"""
product:
name : 'Product X'
sku : 123
features :
- size : '10x30cm'
weight : '10kg'
"""
)
print type(x)
print x
Which results in the following output:
<type 'dict'>
{'product': {'sku': 123, 'name': 'Product X', 'features': [{'weight': '10kg', 'size': '10x30cm'}]}}
It is possible to create a strongly typed object from x?
I would like to the following:
print x.features(0).size
I am aware that it is possible to create and instance from an existent class, but that is not what I want for this particular scenario.
See here: http://api.giantbomb.com/documentation/
Would I need to use something similar to the WebClient.DownloadData() from C#, but only in Python3?
I'm incredibly new to Python so maybe something even simpler already exists. Thank you for your time.
http://code.google.com/intl/en/appengine/docs/python/tools/uploadingdata.html
the api is :
Downloading Data from App Engine
To start a data download, run appcfg.py download_data with the appropriate arguments:
appcfg.py download_data --config_file=album_loader.py --filename=album_data_archive.csv --kind=Album <app-directory>
i want to download data from my gae app zjm1126.appspot.com
so i write this in the commond:
appcfg.py download_data --config_file=GreetingLoad.py --filename=GreetingLoad.csv
but, i don't know how to write the 'app-directory'
so , how to write the 'app-directory'..
thanks
I want to use Google Data API on a Symbian device with pys60 but I could'nt find any doc.
Is there any way to install Google Data APIs Python Client Library on Symbian ?
I would like to implement a Python script which has the same functionality as http://www.greymagic.com/security/tools/decoder/
Is the encoding rule open for this type of javascript code encoding?
Thanks.
Okay. I have completed my first python program.It has around 1000 lines of code.
During development I placed plenty of print stmt before running a command using os.system()
say something like,
print "running command",cmd
os.system(cmd)
Now I have completed the program.I thought about commenting them but redirecting all these unnecessary print (i can't remove all print stmt- since some provide useful info for user) into a log file will be more useful? Any tricks or tips.
I would like to add subfolders while creating the python script using py2exe..
The syntax I have used is --
setup(windows = [{"script":"test.py"}],data_files=
[('Folder A',
[('Subfolder B'
,[os.path.join('Folder A','XYZ.py')]
)]
)]
)
What will be the correct syntax for creating a folder A, a subfolder B which includes file
XYZ??
Is there anyway to know which functions exported from the dll througth python foreign function library -ctypes-
and if possible to know details about the exported functions throught ctypes.
if yes could someone provide snippet of code
Hi guys,
Sorry to bother again, but I really need help transforming this Python2 code into PHP.
net, cid, lac = 25002, 9164, 4000
import urllib
a = '000E00000000000000000000000000001B0000000000000000000000030000'
b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8)
c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfill(8)
string = (a + b + c + 'FFFFFFFF00000000').decode('hex')
data = urllib.urlopen('http://www.google.com/glm/mmap',string)
r = data.read().encode('hex')
print float(int(r[14:22],16))/1000000, float(int(r[22:30],16))/1000000
Would be great if someone could help, thanks in advance!
How Google App instance can get the list of developers (like in Administration Developers).
I would like to get a solution in python (because I don't know java).
I have FigureCanvasWxAgg instance with a figure displayed on a frame. If user clicks on the canvas another frame with a new FigureCanvasWxAgg containing the same figure will be shown. By now closing the new frame can result in destroying the C++ part of the figure so that it won't be available for the first frame.
How can I save the figure? Python deepcopy from copy module does't work in this case.
Thanks in advance.
Hello, I am wanting to write a script to play the .pls files Shoutcast uses to broadcast, but I am not sure how to do that. I want to write it in Python. Any help would be great!
I have a python list as
[
(A,{'a':1,'b':2,'c':3,'d':4}),
B,{'a':1,'b':2,'c':3,'d':4}),
...
]
I want to know if there is a standard library of serializing this kind of list to xml or should I hand code it to a file.
My code in the view:
from django.contrib import messages
messages.add_message(request, messages.INFO, 'Hello world.')
I don't want to show this code to the user the second time if he/she refreshes again. How do I go about doing that? Messages don't seem to have any sort of expiry setting. There is documentation here:
http://docs.djangoproject.com/en/1.2/ref/contrib/messages/#expiration-of-messages
I want to develop a gwt application using python .. but I fear that google will be the only host to host the code. is it possible to run gwt app on private server of other host.