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!
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 ?
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?
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.
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
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 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.
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.
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.
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?
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.
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 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.
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
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??
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).
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 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.
I've just recently switched over to using 64-bit Python 2.6.1 on Mac OS X 10.6 (Snow Leopard). IPython won't work with Django anymore, but IPython works from the command-line.
The error says:
shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'
I could use the ./manage.py --plain option, but it's not really a fix. Any help very gratefully received!
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.
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.