Title
stringlengths 15
150
| A_Id
int64 2.98k
72.4M
| Users Score
int64 -17
470
| Q_Score
int64 0
5.69k
| ViewCount
int64 18
4.06M
| Database and SQL
int64 0
1
| Tags
stringlengths 6
105
| Answer
stringlengths 11
6.38k
| GUI and Desktop Applications
int64 0
1
| System Administration and DevOps
int64 1
1
| Networking and APIs
int64 0
1
| Other
int64 0
1
| CreationDate
stringlengths 23
23
| AnswerCount
int64 1
64
| Score
float64 -1
1.2
| is_accepted
bool 2
classes | Q_Id
int64 1.85k
44.1M
| Python Basics and Environment
int64 0
1
| Data Science and Machine Learning
int64 0
1
| Web Development
int64 0
1
| Available Count
int64 1
17
| Question
stringlengths 41
29k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How is twisted's Deferred implemented?
| 10,624,853
| 3
| 2
| 673
| 0
|
python,asynchronous,twisted,twisted.web
|
As others have said, a Deferred on its own is just a promise of a value, and a list of things to do when the value arrives (or when there is a failure getting the value).
How they work is like this: some function sees that the value it wants to return is not yet ready. So it prepares a Deferred, and then arranges somehow for that Deferred to be called back ("fired") with the value once it's ready. That second part is what may be causing your confusion; Deferreds on their own don't control when or how they are fired. It's the responsibility of whatever created the Deferred.
In the context of a whole Twisted app, nearly everything is event-based, and events are managed by the reactor. Say your code used twisted.web.client.getPage(), so it now has a Deferred that will be fired with the result of the http fetch. What that means is that getPage() started up a tcp conversation with the http server, and essentially installed handlers in the reactor saying "if you see any traffic on this tcp connection, call a method on this Protocol object". And once the Protocol object sees that it has received the whole page you asked for, it fires your Deferred, whereupon your own code is invoked via that Deferred's callback chain.
So everything is callbacks and hooks, all the way down. This is why you should never have blocking code in a Twisted app, unless on a separate thread- because it will stop everything else from being handled too.
Does that help?
| 0
| 1
| 0
| 0
|
2012-05-15T15:58:00.000
| 2
| 0.291313
| false
| 10,604,523
| 0
| 0
| 1
| 1
|
Does it spawn a new thread underneath? If classical web server spawns a thread to serve a HTTP request and with Twisted web I have to spawn a Deferred() each time I want to query mysql - where's the gain? Looks like it doesn't make sens if it spawned a thread, so how's it implemented?
|
Thrift server facade for clients
| 10,649,734
| 0
| 1
| 314
| 0
|
python,design-patterns,thrift
|
Sounds like you need some sort of a mechanism to correlate requests to the different plugins available. Ideally, there should be a different URL path per set of operations published for each plugin.
I would consider implementing a sort of map/dictionary of URL paths to plugins. Then for each request received, do a lookup in the map and get the associated plugin and send it the request accordingly. If there is no entry in the map, then a redirect/proxy could be sent. For example if URL = http://yourThriftServer/path/operation, the operation or the path and operation would map to a plugin.
An extra step would be to implement a sort of meta request, whereby a client could query what URL paths/operations are available in the server.
| 0
| 1
| 0
| 0
|
2012-05-16T09:53:00.000
| 1
| 0
| false
| 10,616,104
| 0
| 0
| 0
| 1
|
I am having a little trouble with a server / client design and
wonder if anyone had any advice.
I have a Thrift server that abstracts a data store. The idea is that
there will be a number of clients that are essentially
out of process plugins that use the interface provided by the server
to receive, manipulate the underlying data store and also provide
their own data.
There will be a number of other clients which simply access the data
provided by the server and its "plugins".
The problem case is when one of these "plugins" wishes to provide its
own data and provide an interface to that data.
The server should have no knowledge of the plugins data or interface.
I would ideally like all clients to access functionality through the
main thrift server so it acts as a facade for the plugins. If a client
requested some data provided by a plugin the main server could
delegate to the plugin to provide that data. I guess this would mean
have each plugin being a thrift client and server. I have written the
server in python so could probably handle thrift calls that are not
yet defined but would it be possible to forward these calls another
thrift server IE act as a proxy ?
An alternative is maybe have the plugins be clients only and push data
to the server. But the format of these messages
would unknown to the server and would have to be generic enough to
accommodate different types of data. I not sure how I would provide a
useful interface to this data to other clients.
As far as I can see only the plugins knows how to store and manipulate
the data it owns so this idea probably would not work.
Thanks for any advice. Any suggestions welcomed.
|
Creating a KhanAcademy clone via Google App Engine - issues with application name in app.yaml
| 10,637,991
| 3
| 2
| 1,290
| 0
|
python,google-app-engine,clone
|
The problem is that your 'clone' application does not have access to Khans Academy's AppEngine datastore so there is no content to display. Even if you do use all of the code for their application, you are still going to have to generate all of your own content.
Even if you are planning to 'clone' their content, too, you are going to have to do a lot of probably manual work to get it in to your application's datastore.
| 0
| 1
| 0
| 0
|
2012-05-17T14:27:00.000
| 1
| 0.53705
| false
| 10,637,637
| 0
| 0
| 1
| 1
|
I'm trying to create a KhanAcademy (KA) clone on Google App Engine (GAE). I downloaded the offline version of KA (http://code.google.com/p/khanacademy/downloads/list) for Mac, and set it up with GoogleAppEngineLauncher (https://developers.google.com/appengine/). Because KA was produced on Python 2.5, I have the setup running through the Python 2.5 included in the KA offline version download, and I added these extra flags to the app (to essentially duplicate the functionality of the included Run file):
--datastore_path=/Users/Tadas/KhanAcademy/code/datastore --use_sqlite
As is, GAELauncher is able to get that up and running perfectly fine on a localhost. However, to get it up on my Google appspot domain, I need to change the application name in app.yaml. When I change "application: khan-academy" in app.yaml to a new name and try to run the local version via GAELauncher (or the included Run file), the site comes up but all the content (exercises, etc.) has disappeared (essentially, the site loses most of its functionality). If I try to "Deploy" the app in this state, I received a 500 Server Error when I try to go on the appspot website. Any ideas as to what could be going wrong?
Thanks.
|
Simulating the passing of time in unittesting
| 10,653,559
| 4
| 20
| 3,901
| 0
|
python,testing,mocking,integration-testing,celery
|
Without the use of a special mock library, I propose to prepare the code for being in mock-up-mode (probably by a global variable). In mock-up-mode instead of calling the normal time-function (like time.time() or whatever) you could call a mock-up time-function which returns whatever you need in your special case.
I would vote down for changing the system time. That does not seem like a unit test but rather like a functional test as it cannot be done in parallel to anything else on that machine.
| 0
| 1
| 0
| 1
|
2012-05-18T11:48:00.000
| 3
| 0.26052
| false
| 10,652,097
| 0
| 0
| 1
| 1
|
I've built a paywalled CMS + invoicing system for a client and I need to get more stringent with my testing.
I keep all my data in a Django ORM and have a bunch of Celery tasks that run at different intervals that makes sure that new invoices and invoice reminders get sent and cuts of access when users don't pay their invoices.
For example I'd like to be a able to run a test that:
Creates a new user and generates an invoice for X days of access to the site
Simulates the passing of X + 1 days, and runs all the tasks I've got set up in Celery.
Checks that a new invoice for an other X days has been issued to the user.
The KISS approach I've come up with so far is to do all the testing on a separate machine and actually manipulate the date/time at the OS-level. So the testing script would:
Set the system date to day 1
Create a new user and generate the first invoice for X days of access
Advance then system date 1 day. Run all my celery tasks. Repeat until X + 1 days have "passed"
Check that a new invoice has been issued
It's a bit clunky but I think it might work. Any other ideas on how to get it done?
|
Eclipse plugin that just runs a python script
| 10,856,306
| 1
| 2
| 1,884
| 0
|
python,eclipse-plugin,eclipse-pde
|
You can already create an External Launch config from Run>External Tools>External Tools Configurations. You are basically calling the program from eclipse. Any output should then show up in the eclipse Console view. External launch configs can also be turned into External Builders and attached to projects.
If you are looking to run your python script within your JVM then you need a implementation of python in java ... is that what you are looking for?
| 0
| 1
| 0
| 1
|
2012-05-19T13:55:00.000
| 1
| 1.2
| true
| 10,665,768
| 0
| 0
| 1
| 1
|
I want to generate an Eclipse plugin that just runs an existing Python script with parameters.
While this sounds very simple, I don't think it's easy to implement. I can generate a Eclipse plugin. My issue is not how to use PDE. But:
can I call the existing Python script from Java, from an Eclipse plugin?
it needs to run from the embedded console with some parameters
Is this reasonably easy to do? And I don't plan to reimplement it in any way. Calling it from command-line works very well. My question is: can Eclipse perform this, too?
Best,
Marius
|
What's the best way of communication between tornado and Python based daemon?
| 10,667,711
| 0
| 1
| 732
| 0
|
python,sockets,tornado
|
Depending on the scale - the simple thing is to just use HTTP and the AsyncHTTPClient in Tornado. For the request<->response case in our application we're going 300 connections/second with such an approach.
For the first case Fire and forget, you could also use AsyncHTTP and just have the server close out the connection and continue working...
| 0
| 1
| 0
| 1
|
2012-05-19T16:15:00.000
| 2
| 0
| false
| 10,666,877
| 0
| 0
| 0
| 1
|
I use Tornado as the web server. I write some daemons with Python, which run in the server hardware. Sometimes the web server needs to send some data to the daemon and receives some computed results. There are two working:
1. Asynchronous mode: the server sends some data to the daemons, and it doesn't need the results soon. Can I use message queue to do it perfectly?
2. Synchronous mode: the server sends data to the daemons, and it will wait until it get the results. Should Iuse sockets?
So what's the best way of communication between tornado and Python based daemon?
|
Including a locally developed python package in a buildout interpreter
| 10,678,298
| 0
| 0
| 143
| 0
|
python,buildout
|
A) The mr.developer recipe mentioned on your recipe's page is probably a better choice.
B) you want your eggs in bin/python? Include them in 'eggs' in your zc.recipe.eggs part in your buildout where you generate bin/python.
| 0
| 1
| 0
| 1
|
2012-05-19T23:05:00.000
| 2
| 0
| false
| 10,669,497
| 1
| 0
| 0
| 1
|
I'm using isotoma.buildout.autodevelop to develop eggs which I'm currently developing within my buildout.
I would like to include these developed eggs (which are located on the filesystem next to my buildout.cfg) as namespaces in my buildout's custom interpreter.
Can anyone provide an example of this or link to some resource ?
|
Python module for google search in GAE
| 10,671,099
| 1
| 0
| 143
| 0
|
python,google-app-engine,python-module
|
There is no official library for what you're trying to do, and the Google Terms of Service prohibit using automated tools to 'scrape' search results.
| 0
| 1
| 0
| 0
|
2012-05-20T02:26:00.000
| 1
| 1.2
| true
| 10,670,325
| 0
| 0
| 1
| 1
|
I am trying to build an application in GAE using python. I needs to do is give the query received from user and give it to Google search and return the answer in a formatted way to the user. I found lots of questions asked here. But couldn't get a clear answer regarding my requirements. My needs are
Needs to process large number of links. Many Google API described gives only top four links
Which module is best regarding my requirement. Whether I need to go for something like Mechanize, Urllib... I don't know whether they work in GAE. Also found a Google API, but it gives only few results
|
Eclipse + Pydev wont keep interpreter setting within the same session.
| 20,319,027
| 1
| 3
| 2,628
| 0
|
python,eclipse,installation,pydev,interpreter
|
I've been wresting with this problem all evening and just now solved it for me. My problem was with a workspace saved in Google Drive, but where Drive had created a lot of files with a (1) before the first period in the .metadata folder, presumably as a conflict resolution thing.
Using File Commander (the search in Windows 7 ignored the parenthesis ?!) I searched for all the files containing (1) and delted them. (It should be said I made a copy of the folder first and opened it as a workspace to experiment on, as I've never figured out how to import a project once the workspace is lost.)
In my case, it worked like a charm. Now I'm going to be very nervous about having Eclipse open on both coding machines at once. We'll see how it goes from here.
| 0
| 1
| 0
| 1
|
2012-05-20T03:27:00.000
| 5
| 0.039979
| false
| 10,670,576
| 0
| 0
| 0
| 4
|
I'm attempting to get eclipse running as something more powerful than a colored text editor so that I can do some Maya scripting. There's literally nothing fancy about this setup, it just doesn't keep my interpreter once the prefs window is closed.
I can open and view .py docs fine, but pydev will not keep the interpreter I give it. As soon as I save the prefs with vanilla python.exe chosen as the interpreter, eclipse loses it. Opening the prefs again will show a blank interpreter page.
Auto config used to work before I started mucking with settings. I had the same disappearing problem even though Autoconfig could find everything.
c:\Python27 is set in my PYTHONPATH for user and system variables.
I've tried 32 and 64bit python (running win7 64). I was using Aptana with pydev and it seemed to not complain for a while, but then the interpreter went awol and I tried Eclipse to fix it. I can't start an actual project due to the missing interpreter, and the large "help" box that pops up when I'm typing is slowing me down considerably.
Eclipse 3.7.2
Python 2.7.2
Pydev 2.5
Thanks for your help, I'm pretty green at this.
|
Eclipse + Pydev wont keep interpreter setting within the same session.
| 24,027,445
| 0
| 3
| 2,628
| 0
|
python,eclipse,installation,pydev,interpreter
|
I had the same problem in fedora, disappearing interpreter settings. The issue was Eclipse couldn't write to the folder even after granting read+write access.
Solution: Go to terminal and type: sudo eclipse
enter admin password to run as admin. Solved
| 0
| 1
| 0
| 1
|
2012-05-20T03:27:00.000
| 5
| 0
| false
| 10,670,576
| 0
| 0
| 0
| 4
|
I'm attempting to get eclipse running as something more powerful than a colored text editor so that I can do some Maya scripting. There's literally nothing fancy about this setup, it just doesn't keep my interpreter once the prefs window is closed.
I can open and view .py docs fine, but pydev will not keep the interpreter I give it. As soon as I save the prefs with vanilla python.exe chosen as the interpreter, eclipse loses it. Opening the prefs again will show a blank interpreter page.
Auto config used to work before I started mucking with settings. I had the same disappearing problem even though Autoconfig could find everything.
c:\Python27 is set in my PYTHONPATH for user and system variables.
I've tried 32 and 64bit python (running win7 64). I was using Aptana with pydev and it seemed to not complain for a while, but then the interpreter went awol and I tried Eclipse to fix it. I can't start an actual project due to the missing interpreter, and the large "help" box that pops up when I'm typing is slowing me down considerably.
Eclipse 3.7.2
Python 2.7.2
Pydev 2.5
Thanks for your help, I'm pretty green at this.
|
Eclipse + Pydev wont keep interpreter setting within the same session.
| 27,167,729
| 1
| 3
| 2,628
| 0
|
python,eclipse,installation,pydev,interpreter
|
I had the same issue. This is how I solved it:
Go to your workspace folder.
Edit the file ".pydevproject".
Change the path located after "PYTHON_PROJECT_INTERPRETER" pydev property.
Save and you're good to go.
| 0
| 1
| 0
| 1
|
2012-05-20T03:27:00.000
| 5
| 0.039979
| false
| 10,670,576
| 0
| 0
| 0
| 4
|
I'm attempting to get eclipse running as something more powerful than a colored text editor so that I can do some Maya scripting. There's literally nothing fancy about this setup, it just doesn't keep my interpreter once the prefs window is closed.
I can open and view .py docs fine, but pydev will not keep the interpreter I give it. As soon as I save the prefs with vanilla python.exe chosen as the interpreter, eclipse loses it. Opening the prefs again will show a blank interpreter page.
Auto config used to work before I started mucking with settings. I had the same disappearing problem even though Autoconfig could find everything.
c:\Python27 is set in my PYTHONPATH for user and system variables.
I've tried 32 and 64bit python (running win7 64). I was using Aptana with pydev and it seemed to not complain for a while, but then the interpreter went awol and I tried Eclipse to fix it. I can't start an actual project due to the missing interpreter, and the large "help" box that pops up when I'm typing is slowing me down considerably.
Eclipse 3.7.2
Python 2.7.2
Pydev 2.5
Thanks for your help, I'm pretty green at this.
|
Eclipse + Pydev wont keep interpreter setting within the same session.
| 56,161,921
| 1
| 3
| 2,628
| 0
|
python,eclipse,installation,pydev,interpreter
|
I encountered this problem, and the issue was that .project and .pydevproject were read only and Eclipse couldn't save the configurations.
Solution: make .project and .pydevproject writable.
| 0
| 1
| 0
| 1
|
2012-05-20T03:27:00.000
| 5
| 0.039979
| false
| 10,670,576
| 0
| 0
| 0
| 4
|
I'm attempting to get eclipse running as something more powerful than a colored text editor so that I can do some Maya scripting. There's literally nothing fancy about this setup, it just doesn't keep my interpreter once the prefs window is closed.
I can open and view .py docs fine, but pydev will not keep the interpreter I give it. As soon as I save the prefs with vanilla python.exe chosen as the interpreter, eclipse loses it. Opening the prefs again will show a blank interpreter page.
Auto config used to work before I started mucking with settings. I had the same disappearing problem even though Autoconfig could find everything.
c:\Python27 is set in my PYTHONPATH for user and system variables.
I've tried 32 and 64bit python (running win7 64). I was using Aptana with pydev and it seemed to not complain for a while, but then the interpreter went awol and I tried Eclipse to fix it. I can't start an actual project due to the missing interpreter, and the large "help" box that pops up when I'm typing is slowing me down considerably.
Eclipse 3.7.2
Python 2.7.2
Pydev 2.5
Thanks for your help, I'm pretty green at this.
|
Keep command history between (i)python sessions
| 10,671,869
| 2
| 3
| 310
| 0
|
python,shell,command-line
|
Exit ipython cleanly with Ctrl+D and ipython should do this by default.
| 0
| 1
| 0
| 0
|
2012-05-20T07:49:00.000
| 1
| 1.2
| true
| 10,671,709
| 1
| 0
| 0
| 1
|
When I open a python or ipython from command-line, I don't have commands history from previous use, using up key
Is there a way to configure it, to remember commands, like a .bash_history?
|
Save commands sent over to the gnuplot program by Gnuplot-py package
| 10,690,113
| 0
| 0
| 231
| 0
|
python,gnuplot
|
Non-python answer would be to use `script' command.
| 0
| 1
| 0
| 0
|
2012-05-21T17:32:00.000
| 2
| 0
| false
| 10,689,818
| 0
| 0
| 0
| 1
|
I am new to gnuplot. I am using Unix.
I see the commands/error and their output on the terminal but I want to save them on a file too for storage purposes.
There is a save command in gnuplot but it only saves the last plot or splot command given by the module and the final settings.
Suppose I plot a line with settings 'A' and after doing some calculation I went and re-plotted another line with setting 'B'
gnuplot.save() command would only save the last command and the latest settings. How can I save all the issued commands?
Kindly help...
|
queues remain unknown or just don't know how to call them
| 10,698,246
| 1
| 1
| 178
| 0
|
python,google-app-engine
|
If your are running a unitest and using init_taskqueue_stub() you need to pass the path of the queue.yaml when calling it using the root_path parameter.
| 0
| 1
| 0
| 0
|
2012-05-22T07:32:00.000
| 1
| 0.197375
| false
| 10,697,651
| 0
| 0
| 1
| 1
|
I've added a new queue to a python GAE app, and would like to add tasks to it, but always get an UnknownQueueError when I run my tests. On the other hand, I see the queue present in the GAE admin console (both local and remote). So the question is (1) do I miss something when I add a task to my queue? (2) if not, then how can I run custom queues in a test?
Here is my queue.yaml
queue:
- name: requests
rate: 20/s
bucket_size: 100
retry_parameters:
task_age_limit: 60s
and my python call is the following:
taskqueue.add(queue_name="requests", url=reverse('queue_request', kwargs={"ckey":ckey}))
any ideas?
|
IPython magic commands and dashes
| 10,719,912
| 2
| 1
| 429
| 0
|
python,bash,shell,ipython
|
You will have to live with this.
If identifiers are handled across language boundaries (in this case bash/Python) you will have problems if the languages' rules for identifiers allow different things (in this case the - is allowed in bash but not in Python). One way to solve this is name mangling. Sometimes this is done, e. g. by replacing offending characters with allowed characters (e. g. xdg-open by xdg_open); to avoid name clashes (e. g. if there already is an xdg_open besides the xdg-open) the replacement often is escaped in some way, e.g. by the hex value of the character (e. g. - by _2d, _ by _5f etc.). You will probably know this from URL lines containing stuff like %20 and the like. This all becomes either unreadable very quickly, or the rules for the name mangling are very complicated (there's a trade-off).
| 0
| 1
| 0
| 0
|
2012-05-22T17:47:00.000
| 1
| 1.2
| true
| 10,707,259
| 1
| 0
| 0
| 1
|
I recently switched my default shell to IPython, rather than bash, by creating an IPython profile with automagic, autocall and other such features turned on. To make executables visible to the IPython environment, I've included %rehashx to run automatically in my config files. The trouble with this is that commands with dashes in their names, such as xdg-open, are not properly translated into magic commands, and thus require using the shell-escape syntax to run. Is there a way to automagic commands with dashes, so that I can more closely emulate bash-like calling of such commands?
|
Eclipse Error IOError: [Errno 2] No such file or directory: 'Tarr32_Lane2_Next34_FinalAnnotations.txt'
| 15,859,992
| 2
| 0
| 2,472
| 0
|
python,eclipse
|
I had the same issue, but it turned out that my text file was in fact in the wrong place, even though it was in the same directory as my python script. I had to move it into the same package as the script, not just the same directory (I did this by simply dragging the text file onto the package name in the sidebar in Eclipse).
So, for example, this is what my setup looked like:
Hello World (project)
helloworld (package)
__init__.py
hello_world.py
hello_world.txt
Here's what it should have looked like (by moving hello_world.txt into the helloworld package):
Hello World (project)
helloworld (package)
__init__.py
hello_world.py
hello_world.txt
| 0
| 1
| 0
| 0
|
2012-05-23T21:42:00.000
| 2
| 0.197375
| false
| 10,728,309
| 0
| 0
| 0
| 2
|
I keep getting this error when running this python script (that I know runs and works since I ran it in VI) within eclipse.
Traceback (most recent call last):
File "/home/kt/Documents/workspace/Molly's Scripts/src/ProcessingPARFuMSData.py", line 181, in
annotations = open(sys.argv[1], 'r')
IOError: [Errno 2] No such file or directory: 'Tarr32_Lane2_Next34_FinalAnnotations.txt'
I double checked to see that all of the txt files that I need to run the script with are included in the specific directory and yet it is still giving me a bit of trouble. I know it has to be something with eclipse or PyDev because like I mentioned previously it works in the other editor. Any help would be appreciated and I can try a screen shot if one is needed.
Thanks,
KT
|
Eclipse Error IOError: [Errno 2] No such file or directory: 'Tarr32_Lane2_Next34_FinalAnnotations.txt'
| 10,746,692
| 0
| 0
| 2,472
| 0
|
python,eclipse
|
Seems you're launching in the wrong dir. You can configure your launch in run > run configurations.
| 0
| 1
| 0
| 0
|
2012-05-23T21:42:00.000
| 2
| 0
| false
| 10,728,309
| 0
| 0
| 0
| 2
|
I keep getting this error when running this python script (that I know runs and works since I ran it in VI) within eclipse.
Traceback (most recent call last):
File "/home/kt/Documents/workspace/Molly's Scripts/src/ProcessingPARFuMSData.py", line 181, in
annotations = open(sys.argv[1], 'r')
IOError: [Errno 2] No such file or directory: 'Tarr32_Lane2_Next34_FinalAnnotations.txt'
I double checked to see that all of the txt files that I need to run the script with are included in the specific directory and yet it is still giving me a bit of trouble. I know it has to be something with eclipse or PyDev because like I mentioned previously it works in the other editor. Any help would be appreciated and I can try a screen shot if one is needed.
Thanks,
KT
|
python enabled gdb for windows
| 56,772,866
| 1
| 10
| 8,234
| 0
|
python,gdb
|
In mingw installer you need to install a special package called mingw32-gdb-python.
Which is the gdb compiled with python enabled
| 0
| 1
| 0
| 0
|
2012-05-24T07:59:00.000
| 2
| 0.099668
| false
| 10,733,418
| 1
| 0
| 0
| 1
|
I am using gdb 7.4 on a windows 7 machine
When I attempt to execute python script I get
"Python scripting is not supported in this version of GDB"
I thought that it was supported in 7.4?
Where can I get a version of gdb that is python enabled for windows?
|
Script needs to be run as a Celery task. What consequences does this have?
| 10,739,006
| 2
| 0
| 2,052
| 0
|
python,celery
|
Celery implies a daemon using a broker (some data hub used to queue tasks). The celeryd daemon and the broker (RabbitMQ, redis, MongoDB or else) should always run in the background.
Your tasks will be queued, this means they won't happen all at the same time. You can choose how many at the same time can be run as a maximum. The rest of them will wait for the others to finish before starting. This also means some concurrency is often expected, and that you must create tasks that play nice with others doing the same thing.
Celery is not meant to run scripts but tasks, written as python functions. You can of course execute external scripts from Python, but your entry point is always a Python function.
Celery uses Kombu, which uses a message broker to dispatch the tasks. This implies the data you pass to your tasks should be serializable.
| 0
| 1
| 0
| 0
|
2012-05-24T09:26:00.000
| 1
| 1.2
| true
| 10,734,668
| 0
| 0
| 0
| 1
|
My task is it to write a script using opencv which will later run as a Celery task. What consequences does this have? What do I have to pay attention to? Is it enough in the end to include two lines of code or could it be, that I have to rewrite my whole script?
I read, that Celery is a "asynchronous task queue/job queuing system based on distributed message passing", but I wont pretend to know completely what that all entails.
I try to update the question, as soon as I get more details.
|
How do I add a path to PYTHONPATH in virtualenv
| 37,116,291
| 5
| 120
| 122,179
| 0
|
python,virtualenv
|
You can also try to put symlink to one of your virtualenv.
eg.
1) activate your virtualenv
2) run python
3) import sys and check sys.path
4) you will find python search path there. Choose one of those (eg. site-packages)
5) go there and create symlink to your package like:
ln -s path-to-your-package name-with-which-you'll-be-importing
That way you should be able to import it even without activating your virtualenv. Simply try: path-to-your-virtualenv-folder/bin/python
and import your package.
| 0
| 1
| 0
| 0
|
2012-05-24T13:57:00.000
| 6
| 0.16514
| false
| 10,738,919
| 1
| 0
| 0
| 1
|
I am trying to add a path to the PYTHONPATH environment variable, that would be only visible from a particular virtualenv environment.
I tried SET PYTHONPATH=... under a virtualenv command prompt, but that sets the variable for the whole environment.
How do I achieve that?
|
How do I 'lock the keyboard' to prevent any more keypresses being sent on X11/Linux/Gnome?
| 10,769,704
| 2
| 4
| 5,730
| 0
|
python,linux,ubuntu,keyboard,x11
|
The canonical way to do this is by grabbing the input. For this no window must be actually visible. A input only window usually does the trick. However you should give the user some sort of feedback, why his input no longer works. Doing this as a focus grab has the advantage that a crash of the program won't turn the system unresponsive.
BTW: I think forcibly interrupting the user, maybe in the middle of a critical operations is a huge No-Go! I never understood the purpose of those programs. The user will sit in front of the screen idling, maybe loosing his thoughts. Just my 2 cents.
| 0
| 1
| 0
| 0
|
2012-05-24T14:59:00.000
| 3
| 0.132549
| false
| 10,740,067
| 0
| 0
| 0
| 1
|
I am writing an anti-RSI/typing break programme for Ubuntu Linux in python. I would like to be able to "lock the keyboard" so that all keypresses are ignored until I "unlock" it. I want to be able to force the user to take a typing break.
I would like some programmatic way to "turn off" the keyboard (near instantaneously) until my programme releases it later (which could be 0.1 sec → 10 sec later). While I have "turned off the keyboard", no key presses should be sent to any windows, window managers, etc. Preferably, the screen should still show the same content. The keyboard should be locked even if this programme is not at the forefont and does not have focus.
Some programmes are able to do this already (e.g. Work Rave)
How do I do this on Linux/X11? (Preferable in Python)
|
Preferred method of "deploying" python scripts to LibreOffice during macro development?
| 10,743,591
| 1
| 2
| 733
| 0
|
python,openoffice.org,libreoffice
|
Maybe a nice way to go is to get familiarized with Python setup tools itself (http://packages.python.org/an_example_pypi_project/setuptools.html), and write a proper setup.py script which would place all needed files in the appropriate dirs.
Your macros could them even be installable with the "easy_install" Python framework
| 0
| 1
| 0
| 1
|
2012-05-24T17:10:00.000
| 2
| 1.2
| true
| 10,742,188
| 0
| 0
| 0
| 1
|
When developing macros in python for LibreOffice / OpenOffice on Linux at least, I've read that you have to place your py scripts in a particular directory.
Is there a preferred method among Python LibreOffice/OOo developers for deploying these scripts, or is there another way to specify within LibreOffice/OOo to specify where you want these scripts to be?
|
Access Win32 dll on Google App Engine?
| 10,743,291
| 6
| 0
| 191
| 0
|
python,winapi,google-app-engine,licensing
|
Nope, App Engine's python runtime only supports pure python modules. Wrapped native code modules won't work.
| 0
| 1
| 0
| 0
|
2012-05-24T18:21:00.000
| 1
| 1.2
| true
| 10,743,158
| 0
| 0
| 1
| 1
|
BACKGROUND:
I work on a small team in a large company where I'm currently revamping the licensing system for a suite of mixed .Net and Win32 products that I update annually. Each product references a win32 .dll for product validation. I only have the binary file and the header file for the licensing module (so no hash algorithm). Somehow customers are able to purchase software on our website and receive a disk in the mail with a serial key. Keys or product specific and so disks and keys can be easily shared.
GOALS:
Modify the hash input so keys are now based on major version number (done).
Implement a web service using App Engine (it's just me so I don't want to maintain any hardware) whereby a user can purchase a serial that is automatically generated and delivered via email.
Use the existing licensing module or replicate the hash/API (I would like whoever is sending out serial keys to continue to do so except for maybe a minor change to their work flow, like adding the version number).
QUESTIONS:
Is there any way to write wrap this win32 library in a python module and use it on Google's App Engine?
Are there any tools to discover the hashing algorithm being used? The library exports a generatekey function?
Any other comments or suggestions are greatly appreciated.
Cheers,
Tom
|
Ubuntu Linux: terminal limits the output when I get the full Twitter Streaming API
| 10,745,449
| 2
| 1
| 957
| 0
|
python,linux,ubuntu,console,terminal
|
I'd also avoid doing this with a terminal, but to answer the question directly:
right click on the terminal window
profiles
profile preferences
scolling
scollback: unlimited
It's better though to redirect to a file, then access that file. "tail -f" is very helpful.
| 0
| 1
| 0
| 1
|
2012-05-24T21:13:00.000
| 3
| 0.132549
| false
| 10,745,363
| 0
| 0
| 0
| 1
|
I have this python script that outputs the Twitter Stream to my terminal console. Now here is the interesting thing:
* On snowleopard I get all the data I want.
* On Ubuntu (my pc) this data is limited and older data is deleted.
Both terminal consoles operate in Bash, so it has to be an OS thing presumably.
My question is: how do I turn this off? I want to leave my computer on for a week to capture around 1 or 2 gigabytes of data, for my bachelor thesis!
|
python eclipse dependency plugin - m2eclipse like
| 10,803,047
| 0
| 0
| 195
| 0
|
python,eclipse,pydev
|
The only one so far I found available is PyFlakes, it does some level of dependency check and import validations.
| 0
| 1
| 0
| 0
|
2012-05-25T12:32:00.000
| 2
| 0
| false
| 10,754,496
| 0
| 0
| 1
| 1
|
Is there any eclipse plugin for python dependency management? just like what M2Eclipse does for maven project? so I can resolve all the dependencies and get ride off all the errors when I develop python using pydev.
If there is no such plugin, how do I resolve the dependencies, do I have to install the dependency modules locally?
|
How does `cat` work in ipython interactive shell?
| 10,761,540
| 5
| 5
| 2,575
| 0
|
python,shell,ipython,interactive
|
cat is one of the pre-defined system command aliases. Type %alias to see the list of aliases in your current ipython session.
| 0
| 1
| 0
| 0
|
2012-05-25T21:11:00.000
| 2
| 1.2
| true
| 10,761,413
| 1
| 0
| 0
| 1
|
I noticed that using cat on a file works in ipython. It doesn't appear to be listed as a magic command... so I am confused how/why it works. What lets cat work in ipython interactive shell?
|
Execute python commands passed as strings in command line using python -c
| 30,690,444
| 55
| 46
| 42,043
| 0
|
python
|
You can use -c to get Python to execute a string. For example:
python3 -c "print(5)"
However, there doesn't seem to be a way to use escape characters (e.g. \n). So, if you need them, use a pipe from echo -e or printf instead. For example:
$ printf "import sys\nprint(sys.path)" | python3
| 0
| 1
| 0
| 1
|
2012-05-26T18:01:00.000
| 2
| 1
| false
| 10,768,584
| 0
| 0
| 0
| 1
|
Is it possible to execute python commands passed as strings using python -c? can someone give an example.
|
SHA 512 Password with webapp2 and App Engine?
| 10,780,404
| 2
| 1
| 827
| 0
|
python,google-app-engine,webapp2
|
As you observe, the default User model doesn't provide any way to customize the hash function being used. You could subclass it and redefine the problematic methods to take a hash parameter, or file a feature request with the webapp2 project.
Webapp2's password hashing has much bigger issues, though, as it doesn't do password stretching. While it optionally(!) salts the hash, it doesn't iterate it, making brute force attacks more practical than they should be for an attacker. It should implement a proper password primitive such as PBKDF2, SCrypt, or BCrypt.
To answer your question about relative strengths of hash functions, while SHA1 is showing some weakness, nobody has successfully generated a collision, much less a preimage. Further, the HMAC construction can result in secure HMACs even with a hash function that's weak against collision attacks; arguably even MD5 would work here.
Of course, attacks only ever get better, never worse, so it's a good idea to prepare for the future. If you're concerned about security, though, you should be much more concerned about the lack of stretching than the choice of hash function. And if you're really concerned about security, you shouldn't be doing authentication yourself - you should be using the Users API or OAuth, so someone else can have the job of securely storing passwords.
| 0
| 1
| 0
| 0
|
2012-05-27T05:55:00.000
| 1
| 1.2
| true
| 10,771,973
| 0
| 0
| 1
| 1
|
If you are using webapp2 with Google App Engine you can see there is only one way to create an user with the "create_user" method [auth/models.py line:364]
But that method call to "security.generate_password_hash" method where in not possible use SHA 512
Q1: I would like to know what is the best way to create a SHA 512 Password with webapp2 and App Engine Python?
Q2: Is good idea use SHA 512 instead of encryption offered by webapp2 (SHA1), or it's enough?
|
PyDev for App Engine - re-import External Libs
| 10,773,714
| 0
| 0
| 149
| 0
|
python,eclipse,google-app-engine,pydev
|
If you create a new project, you get all the new libs. Move your existing (imported) sources to this new project.
| 0
| 1
| 0
| 0
|
2012-05-27T11:33:00.000
| 1
| 1.2
| true
| 10,773,667
| 0
| 0
| 1
| 1
|
I have a project which I created 2 years ago. I need to work on it again, and didn't have it in my Eclipse Workspace so I downloaded it from git and did an import existing projects into workspace. All worked well, except I notice the External Libraries do not contain all the new libraries added to the SDK since I created the project (and there's loads now compared to then). It would be useful if I could select the GAE root dir and let Eclipse automatically pull in all the libs for me, as it does when you create a new project. I don't see a way of doing this other than adding them 1 by 1. Does anyone have any tips?!
|
In app engine, can I call "get_or_insert" from inside a transaction?
| 10,791,742
| 2
| 2
| 308
| 1
|
python,google-app-engine
|
No. get_or_insert is syntactic sugar for a transactional function that fetches or inserts a record. You can implement it yourself trivially, but that will only work if the record you're operating on is in the same entity group as the rest of the entities in the current transaction, or if you have cross-group transactions enabled.
| 0
| 1
| 0
| 0
|
2012-05-28T21:01:00.000
| 2
| 0.197375
| false
| 10,790,381
| 0
| 0
| 1
| 1
|
In google app engine, can I call "get_or_insert" from inside a transaction?
The reason I ask is because I'm not sure if there is some conflict with having this run its own transaction inside an already running transaction.
Thanks!
|
Is there a way to make Fabric summarise results across a number of hosts?
| 10,807,419
| 2
| 5
| 391
| 0
|
python,fabric
|
It's just python, so you can print whatever you'd like, as well as making your own decorator to wrap the task and spit that out. As it stands though there isn't anything in core nor contrib that does that.
| 0
| 1
| 0
| 0
|
2012-05-29T03:30:00.000
| 2
| 0.197375
| false
| 10,792,748
| 0
| 0
| 0
| 1
|
When I'm administering dozens of servers with Fabric, I often don't care about the specifics of the commands being run on each server, instead I want to collate small bits of information from each host and present it in summary at the end.
Does Fabric support this functionality itself? (I've searched the documentation to no avail, but perhaps I missed something).
Otherwise I suppose one could aggregate this information manually and then add an exit handler, but this feels like something that could be a common use case.
As an example, I have a some scripts that do some basic security checks on a number of servers, and I'd like to create a report at the end instead of scrolling through the output for each server. I don't want to restrict Fabric's output, since if there is an issue I want to scroll back to pinpoint it.
|
Have user sign up with Google and get redirected back to the site afterwards?
| 10,818,524
| 1
| 0
| 688
| 0
|
python,google-app-engine
|
When your user goes to the login url, there is a red SIGN UP button on the top. They can go sign up there.
It took me a second to find too, unfortunately you can't change the login page.
| 0
| 1
| 0
| 0
|
2012-05-30T11:22:00.000
| 2
| 0.099668
| false
| 10,815,286
| 0
| 0
| 1
| 1
|
I am using GAE with python and I can ask users to sign in with Google using:
loginURL = (users.create_login_url(self.request.path))
This gives me a link that lets users sign in and get redirected to my site.
However some users do not have a Google ID,
Is there any way to let them sign up for one and be redirected to my site?
I know there is no:
signupURL = (users.create_signup_url(self.request.path))
That is the kind of thing I am looking for, asking the user to sign up and have her quickly redirected when she is done.
Thank you very much for any insight.
|
Python script to Batch file
| 10,821,382
| 3
| 3
| 13,915
| 0
|
python,windows,batch-file
|
You can't "send" a string. You can print it out and have the calling process capture it, but you can only directly return numbers from 0 through 255.
| 0
| 1
| 0
| 0
|
2012-05-30T17:31:00.000
| 5
| 1.2
| true
| 10,821,300
| 1
| 0
| 0
| 2
|
I have a batch file that runs a python script. I am running Python 3.2. I want to send a variable like an integer or string from the python script back to the batch file, is this possible?
I know I can accept command line arguments in the Python script with sys.argv. Was hoping there was some feature that allows me to do the reverse.
|
Python script to Batch file
| 10,821,423
| 1
| 3
| 13,915
| 0
|
python,windows,batch-file
|
Ignacio is dead on. The only thing you can return is your exit status. What I've done previously is have the python script (or EXE in my case) output the next batch file to be run, then you can put in whatever values you'd like and run it. The batch file that calls the python script then calls the batch file you create.
| 0
| 1
| 0
| 0
|
2012-05-30T17:31:00.000
| 5
| 0.039979
| false
| 10,821,300
| 1
| 0
| 0
| 2
|
I have a batch file that runs a python script. I am running Python 3.2. I want to send a variable like an integer or string from the python script back to the batch file, is this possible?
I know I can accept command line arguments in the Python script with sys.argv. Was hoping there was some feature that allows me to do the reverse.
|
Sending arguments from Batch file to Python script
| 69,202,173
| 0
| 10
| 45,693
| 0
|
python,batch-file,windows-xp
|
Another option is to write arguments right after the python script, following the example:
python your_script.py this that
If you are using Linux .sh file, remember to run dos2unix XXX.sh before you run:
bash XXX.sh.
The reason, in a simple version, is that dos and unix use different newline breakers.
| 0
| 1
| 0
| 1
|
2012-05-30T19:34:00.000
| 2
| 0
| false
| 10,823,033
| 0
| 0
| 0
| 1
|
I'm running Python 3.2 on Win XP. I run a python script thru a batch file via this:
C:\Python32\python.exe test.py %1
%1 is an argument that i pass to do some processing in the python script.
I have 2 variables in the batch file that I also want to send as arguments to the python script.
set $1=hey_hi_hello
set $2=hey_hi
I want to be able to do something like this if possible:
C:\Python32\python.exe test.py %1 $1 $2
And then retrieve these argiments in the python script via sys.argv[2] and sys.argv[3]
Would appreciate any help with this. Thank you.
|
Twisted irc python bot - buffering messages
| 10,837,775
| 4
| 3
| 495
| 0
|
python,twisted,irc,bots
|
No. You cannot send messages instantly. Control must return to the event loop. Fortunately, the problem you're really trying to solve (inferred from comments on the question), rate limiting the messages you send, doesn't require being able to do this. Instead, stop using time.sleep in a loop and start using reactor.callLater to delay the execution of code. Or use features of the IRC API which do these things for you (which you seem to have discovered already, lineRate).
| 0
| 1
| 0
| 0
|
2012-05-31T11:16:00.000
| 1
| 1.2
| true
| 10,832,531
| 0
| 0
| 0
| 1
|
"Why does it take a long time for data I send with transport.write to arrive at the other side of the connection?"
Twisted can only send data after you give up control of execution to the reactor. For example, if you have an infinite loop writing data to a transport, the data will never actually be sent since control will never leave your code and return to the reactor."
I found this in the twisted FAQ, it is exactly as my problem. Is there a way to fix this so I can send messages instantly and not wait for the loop to finish?
|
py2app installation error--Permission Denied
| 23,563,762
| 0
| 0
| 586
| 0
|
python,py2app
|
I had this problem for a long time. Try running it as admin.
| 1
| 1
| 0
| 0
|
2012-05-31T22:31:00.000
| 1
| 0
| false
| 10,842,167
| 0
| 0
| 0
| 1
|
I am trying really REALLY hard to install py2app, but whenever I run the install command on the source code, I get half way through and then I get a permission denied error. Does anyone have an idea about how I could fix this? I do have admin rights on the machine I am using. I am using the admin's profile to do the installation...so I am really stumped. Any help would be awesome.
I am running Mac OS X 10.6.8
I am using Python 2.7 (64 bit, but running with the 32 bit preferences)
I am using wxPython (32 bit because that is all that wxPython has to offer on a Mac)
|
Easy cross-platform python way of colouring text in the command line/shell
| 10,861,269
| 1
| 1
| 844
| 0
|
python,command-line,cross-platform
|
You'll have to use a module if you want something cross-platform / slightly complicated.
I'd recommend using pypi.python.org/pypi/colorama, which is cross-platform.
| 0
| 1
| 0
| 0
|
2012-06-02T09:15:00.000
| 3
| 0.066568
| false
| 10,861,128
| 1
| 0
| 0
| 1
|
Bascially, I want an easy(ish), cross-platform way of colouring text in the command line/shell.
I would really like this to not involve importing a module, but because cross-platform support is pretty complicated, I know it will probably have to.
I don't need it to be too elaborate though, just a few basic colours will do.
|
Shell script output to file is buffered/truncated using python multiprocessing module
| 11,081,096
| 1
| 2
| 1,403
| 0
|
python,subprocess,multiprocessing
|
We found out that the commands sent over ssh inside the scripts were the ones which were getting truncated in their outputs.
For this we used the -n flag of ssh , which solved the problem. There is no more truncation.
But this is a strange issue which happens only in python multiprocessing environment and must be considered seriously by anyone attempting to use such a model for their own purposes.
The man page of -n option says
Redirects stdin from /dev/null (actually, prevents reading from
stdin). This must be used when ssh is run in the background. A
common trick is to use this to run X11 programs on a remote
machine. For example, ssh -n shadows.cs.hut.fi emacs & will
start an emacs on shadows.cs.hut.fi, and the X11 connection will
be automatically forwarded over an encrypted channel. The ssh
program will be put in the background. (This does not work if
ssh needs to ask for a password or passphrase; see also the -f
option.)
| 0
| 1
| 0
| 0
|
2012-06-03T07:40:00.000
| 1
| 1.2
| true
| 10,868,677
| 0
| 0
| 0
| 1
|
I have a python framework which has to execute bash scripts as plugins.
We are using multiprocessing module to create worker processes which pick the plugin details from a multiprocessing.JoinableQueue and execute the plugins using subprocess.Popen().
It has been observed that the final output generated by the shell scripts get truncated and as end result the entire execution goes waste.
So we tried moving to python threads for the workers maintaining the subprocess mechanism to spawn the shell script processes. And the truncation was no longer happening. But threads are awfully slow (due to GIL) and the responses to signals and events are also indeterminate(probably owing to the GIL release timings).
I have read in many places including other questions in stackoverflow that multiprocessing module does a buffering of stdout. We know this is the problem. But are unable to find a proper solution, as we can't give sys.stdout.flush from python for the data that the shell script has to echo to a file.
Also we tried os.fsync with some samples, and truncation is not happening. Again it can't be used directly for our purpose as the names of files created by the shell scripts are not known to the framework. Only a final archive is taken back by the framework.
My question is, is there any way to prevent this buffering in the processes spawned from multiprocessing modules? Will the -u option of python interpreter help here? Or will any modifications to the python library in /usr/lib64/python2.6/multiprocessing clear this problem?
|
How to install Python interpreters on Linux in a fully automated way
| 10,870,525
| 1
| 4
| 4,193
| 0
|
python,linux,installation,build-automation,silent-installer
|
You can compile Python for yourself easily enough. Download and extract the Python source tarballs, then use this sequence of commands instead of the usual:
$ ./configure --prefix=$HOME/local
$ make
$ make install
You will probably want to add $HOME/local/bin to your PATH. The different minor/major versions of Python will not interfere with each other, so you can install 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, and 3.3 all at the same time. (There's no point in testing your code against 3.0.)
The program python will be an alias for one of the specific Python versions, such as python2.6.
| 0
| 1
| 0
| 0
|
2012-06-03T12:42:00.000
| 4
| 0.049958
| false
| 10,870,401
| 1
| 0
| 0
| 1
|
I'd like to have a reliable way to install Python interpreters 2.4 through to Python 3.3 on a linux user account. I am fine to presume that there is a C-compiler but i'd like to avoid relying on particular distributions or distribution versions. Is there already something maybe like a simple python script?
update: i am looking for a script/way to do all downloading and installation automatically and report back any problems in a concise summary.
|
performing backend operations / tasks after specific intervals of time on Google App Engine (python)
| 10,873,056
| 1
| 0
| 203
| 0
|
python,google-app-engine,scheduled-tasks,backend,task-queue
|
Take a look at the Cron task or set a task queue with a specific ETA
| 0
| 1
| 0
| 0
|
2012-06-03T19:00:00.000
| 2
| 1.2
| true
| 10,873,049
| 0
| 0
| 1
| 1
|
I want my GAE app to do some back-end processing and uploading/updating results to data-store after specific intervals of time (say every 6 hours). So whenever a user uses my app (and basically requests those values from the data-store) they would get the recent/updated values from the data-store.
How would this be implemented in google app engine? I'd really appreciate if someone could guide me in the right direction and/or provide me with information pertinent to doing something like this in python.
|
Python interactive CLI application?
| 10,873,170
| 1
| 15
| 13,140
| 0
|
python,command-line-interface
|
Yes, have a look at the different curses implementations.
| 0
| 1
| 0
| 0
|
2012-06-03T19:14:00.000
| 3
| 0.066568
| false
| 10,873,157
| 0
| 0
| 0
| 1
|
I'm not even sure what these would be called? I used to write them in ADA running on VAX-VMS!
I want to make a simple menu-driven application that would let me display menus and use the cursor keys to navigate around them, choose items and navigate around the app. All fully old school text based.
I want to be able to take over the whole terminal window and display stuff in different places.
Is this possible in Python?
|
GAE DataStore python - fetch() vs run()
| 10,874,870
| 2
| 1
| 576
| 0
|
python,google-app-engine,google-cloud-datastore
|
You can run (with run) multiple datastore queries in parallel to improve latency. This has nothing to do with your resulting HTML. The resulting HTML should be the same.
| 0
| 1
| 0
| 0
|
2012-06-03T22:09:00.000
| 2
| 1.2
| true
| 10,874,312
| 0
| 0
| 1
| 2
|
I saw there are two methods for getting data from the datastore:
fetch() and run()
Regarding fetch the documentation says:
Note: You should rarely need to use this method; it is almost always better to use run() instead.
I don't understand the difference between the two.
I am new to GAE and Python, please help me understand.
Thanks
It says that run() is asynchronous which I don't understand cause unlike JavaScript, once you run the Python script for the site, the html is frozen, right?
|
GAE DataStore python - fetch() vs run()
| 10,883,221
| 3
| 1
| 576
| 0
|
python,google-app-engine,google-cloud-datastore
|
Beginner's advice: until you appreciate the difference, stick with fetch(). There are many other things you probably ought to get comfortable with first before this subtle distinction will bother you.
| 0
| 1
| 0
| 0
|
2012-06-03T22:09:00.000
| 2
| 0.291313
| false
| 10,874,312
| 0
| 0
| 1
| 2
|
I saw there are two methods for getting data from the datastore:
fetch() and run()
Regarding fetch the documentation says:
Note: You should rarely need to use this method; it is almost always better to use run() instead.
I don't understand the difference between the two.
I am new to GAE and Python, please help me understand.
Thanks
It says that run() is asynchronous which I don't understand cause unlike JavaScript, once you run the Python script for the site, the html is frozen, right?
|
import error in eclipse, running an app as root
| 10,995,927
| 0
| 1
| 98
| 0
|
python,eclipse,import,root
|
It seems like your PYTHONPATH is different outside/inside Eclipse. Try just removing the Python interpreter and adding it again to gather new paths -- if that's not enough, do: import sys;print('\n'.join(sorted(sys.path))) outside/inside Eclipse to know what's different and fix your paths inside Eclipse.
| 0
| 1
| 0
| 0
|
2012-06-03T23:59:00.000
| 1
| 0
| false
| 10,874,949
| 0
| 0
| 0
| 1
|
Im developing an installer for a GNU/Linux distribution in Python using Eclipse+PyDev. For some tasks on it there is needed that the program runs with root priviledges, but I run Eclipse as a common user.
I had searched a lot of stuff on the Internet about how to run an app as root without having to run Eclipse with priviledges, but no a single clue of how to accomplish this in a "nice way". So I tried with the "gksu2" python module, with has the gksu2.sudo() functions in the same way as gksu in bash.
I created a new module, imported gksu2 and executed the main.py module of the app, but I got a "ImportError: No module named ui.regular_ui.wizard". It runs ok without gksu2 in eclipse, but it doesn't if I use it. I thought it was an environment variables problem, but the sys.path is ok.
The same error happens if I run the app from a terminal, outside of Eclipse. What do you think?
|
Loading external python modules for Pig UDFs on Amazon EMR
| 10,922,348
| 0
| 3
| 1,681
| 0
|
python,amazon,apache-pig,emr
|
could you manually hack sys.path inside of your jython script?
| 0
| 1
| 0
| 0
|
2012-06-04T17:15:00.000
| 1
| 0
| false
| 10,885,312
| 0
| 0
| 1
| 1
|
I've created a python UDF to convert datetimes into different timezones. The script uses pytz which doesn't ship with python (or jython). I've tried a couple things:
Bootstrapping PIG to install it's own jython and including pytz in
that jython installation. I can't get PIG to use the newly installed
jython, it keeps reverting to Amazon's jython.
Setting PYTHONPATH to a local directory where the new modules have been installed
Setting HADOOP_CLASSPATH/PIG_CLASSPATH to the new installation of jython
Each of these ends up with "ImportError: No module named pytz" when I try to load the UDF script. The script loads fine if I remove pytz so it's definitely the external module that's giving it problems.
Edit: Originally put this as a comment but I thought I'd just make it an edit:
I've tried every way I know of to get PIG to recognize another jython jar. That hasn't worked. Amazon's jython is here: /home/hadoop/.versions/pig-0.9.2/lib/pig/jython.jar, with is recognizing this sys.path: /home/hadoop/lib/Lib. I can't figure out how to build external libraries against this jar.
|
QueryFrame very slow on Windows
| 12,700,150
| 1
| 1
| 565
| 0
|
python,windows,performance,opencv
|
I had same issue and I found out that this is caused by prolonged exposure. It may be the case that Windows drivers increased exposure to increase brightness of picture. Try to point your camera to light source or manually set decreased exposure
| 0
| 1
| 0
| 0
|
2012-06-04T20:23:00.000
| 2
| 0.099668
| false
| 10,887,836
| 0
| 1
| 0
| 1
|
I have build a simple webcam recorder on linux which works quite well.
I get ~25fps video and good audio.
I am porting the recorder on windows (win7) and while it works, it is unusable.
The QueryFrame function takes something more than 350ms, i.e 2.5fps.
The code is in python but the problem really seems to be the lib call.
I tested on the same machine with the same webcam (a logitech E2500).
On windows, I installed openCV v2.2. I cannot check right now but the version might be a bit higher on Ubuntu.
Any idea what could be the problem ?
edit : I've just installed openCV2.4 and I have the same slow speed.
|
TimedRotatingFileHandler: Log only when detected time to rotate
| 13,256,718
| 1
| 0
| 239
| 0
|
python
|
Use logging.handlers.TimedRotatingFileHandler(filename, when='H', interval=1)
| 0
| 1
| 0
| 0
|
2012-06-05T07:52:00.000
| 1
| 0.197375
| false
| 10,893,554
| 0
| 0
| 0
| 1
|
I have a function that makes calls to a logger almost every second, however, I only want to log information an hour before the logfile rotates.
|
Is it possible to create an operating system using Python?
| 10,905,302
| 11
| 38
| 76,823
| 0
|
python,operating-system
|
I suggest you find a good textbook on operating system design, and study that. I'm pretty sure you won't find such a book with Python source code; C is more likely. (You might find an older textbook that uses Pascal instead of C, but it's really not that different.)
Once you have studied operating systems design enough to actually be able to write an operating system, you will know enough to have your own opinions on what languages would be suitable.
| 0
| 1
| 0
| 1
|
2012-06-05T20:49:00.000
| 4
| 1
| false
| 10,904,721
| 1
| 0
| 0
| 1
|
Is it possible to make a minimalistic operating system using Python?
I really don't want to get into low-level code like assembly, so I want to use a simple language like Perl, Python. But how?
|
Compiling and running code as dmg or exe
| 10,906,453
| 0
| 0
| 1,925
| 0
|
python,exe,dmg
|
If you mean specifically with Python, as I gather from tagging that in your question, it won't simply run the same way as Java will, because there's no equivalent Virtual Machine.
If the user has a Python interpreter on their system, they they can simply run the .py file.
If they do not, you can bundle the interpreter and needed libraries into an executable using Py2Exe, cxFreeze, or bbFreeze. For replacing a dmg, App2Exe does something similar.
However. the three commands you listed are not python-related, and rely on functionality that is not necessarily available on Windows or Mac, so it might not be as possible.
| 0
| 1
| 0
| 1
|
2012-06-05T23:01:00.000
| 1
| 0
| false
| 10,906,198
| 0
| 0
| 1
| 1
|
Newbie question I am finding it hard to get my head around.
If I wanted to use one of the many tool out their like rsync lsync or s3cmd how can you build these into a program for none computer savvy people to use.
Ie I am comfortable opening terminal and running s3cmd which Is developed in python how would I go about developing this as a dmg file for mac or exe file for windows?
So a user could just install the dmg or exe then they have s3cmd lsync or rsync on their computer.
I can open up eclipse code a simple app in java and then export as a dmg or exe I cannot figure out how you do this for other languages say write a simple piece of code that I cam save as a dmg or exe and that after installed will add a folder to my desktop or something simple like that to get me started?
|
Migrating GAE app from python 2.5 to 2.7
| 10,910,709
| 2
| 3
| 335
| 0
|
google-app-engine,python-2.7
|
Put a main file in the top-level directory and import all your handlers there, then reference them via that file
| 0
| 1
| 0
| 0
|
2012-06-06T08:21:00.000
| 2
| 0.197375
| false
| 10,910,591
| 0
| 0
| 1
| 1
|
I am trying to migrate my app and everything worked fine until I changed in app.yaml
from threadsafe: false to threadsafe: true.
The error I was receiving was:
threadsafe cannot be enabled with CGI handler: a/b/xyz.app
After some googling I found:
Only scripts in the top-level directory work as handlers, so if you have any in subdirectories, they'll need to be moved, and the script reference changed accordingly:
- url: /whatever
# This doesn't work ...
# script: lib/some_library/handler.app
# ... this does work
script: handler.app
Is there any workaround for this(if above research is valid), as I don't want to change my project hirarchy?
|
Twisted Server Sent Events accessing using Internet Explorer
| 10,949,657
| 2
| 2
| 431
| 0
|
python,internet-explorer,real-time,twisted,server-sent-events
|
Answering my own question is a little weird. But I just found the answer. I had to go with long polling. looks like, I have to write a framework which falls-back to long polling when server sent events are not supported. Answering just in case anyone comes for reference in future.
| 0
| 1
| 0
| 0
|
2012-06-06T13:01:00.000
| 1
| 1.2
| true
| 10,914,740
| 0
| 0
| 1
| 1
|
I am working on a project that requires real time update. So, long ago, I decided to go with using Twisted SSE Handler (cyclone.sse). The project is at an end. And all the pub/sub stuff is good on all the browsers except Internet Explorer. IE doesn't support SSE. How do I get pub-sub working on IE without change of code in server-side? Also long polling will not help as I am using cyclone.sse.
|
Cron-like scheduler, something between cron and celery
| 10,918,986
| 1
| 3
| 1,859
| 0
|
python,django,cron,celery
|
In my personal opinion, i would learn how to use cron. This won't take more than 5 to 10 minutes, and it's an essential tool when working on a Linux server.
What you could do is set up a cronjob that requests one page of your django instance every minute, and have the django script figure out what time it is and what needs to be done, depending on the configuration stored in your database. This is the approach i've seen in other similar applications.
| 0
| 1
| 0
| 0
|
2012-06-06T17:11:00.000
| 2
| 1.2
| true
| 10,918,905
| 0
| 0
| 1
| 1
|
I'd like to run periodic tasks on my django project, but I don't want all the complexity of celery/django-celery (with celerybeat) bundled in my project.
I'd like, also, to store the config with the times and which command to run within my SCM.
My production machine is running Ubuntu 10.04.
While I could learn and use cron, I feel like there should be a higher level (user friendly) way to do it. (Much like UFW is to iptables).
Is there such thing? Any tips/advice?
Thanks!
|
As part of development, I am committing to github and pulling down and executing elsewhere. It feels wrong
| 10,919,450
| 3
| 1
| 97
| 0
|
python,github,jenkins
|
The solution is quite simple: make cleaner commits (fix typos before committing, only commit changes that belong together, not for too small edits). It's a bit odd that you don't take the time to fix typos (by running/testing locally) but wish to reduce the number of commits by some other means.
| 0
| 1
| 0
| 0
|
2012-06-06T17:40:00.000
| 2
| 0.291313
| false
| 10,919,301
| 0
| 0
| 1
| 2
|
I have a standard-ish setup. Call it three servers - www, app and db, all fed from fabric scripts, and the whole on github.
I have a local laptop with the repo clone. I change a file locally, and push it to github then deploy using jenkins - which pulls from github and does its business. The problem here is I can put a dozen rubbish commits up till I manage to fix all my typos.
Its not so much the round trip to github that matters, but the sheer number of commits - I cannot squash them as they have been pushed. It looks ugly. It works sure but it is ugly.
I don't think I can edit on the servers directly - the file are spread out a lot, and I cannot make each directory on three servers a clone of github and hope to keep things sane.
And trying to write scripts that will synch the servers with my local repo is insane - fabric files took long enough.
I cannot easily git pull from jenkins, because I still have to commit to have jenkins pull, and we still get ugly ugly commit logs.
I cannot see a graceful way to do this - ideas anyone.
|
As part of development, I am committing to github and pulling down and executing elsewhere. It feels wrong
| 10,920,164
| 0
| 1
| 97
| 0
|
python,github,jenkins
|
The solution is to not use github / jenkins to deploy to the servers.
The servers should be seen as part of the 'local' deployment (local being pre-commit)
So use the fab files directly, from my laptop.
That was harder because of pre processing occuring on jenkins but that is replicable.
So, I shall take Jeff Atwoods advice here
embrace the suck, in public.
Well I certainly sucked at that - but hey I learnt.
Will put brain in the right way tomorrow.
| 0
| 1
| 0
| 0
|
2012-06-06T17:40:00.000
| 2
| 1.2
| true
| 10,919,301
| 0
| 0
| 1
| 2
|
I have a standard-ish setup. Call it three servers - www, app and db, all fed from fabric scripts, and the whole on github.
I have a local laptop with the repo clone. I change a file locally, and push it to github then deploy using jenkins - which pulls from github and does its business. The problem here is I can put a dozen rubbish commits up till I manage to fix all my typos.
Its not so much the round trip to github that matters, but the sheer number of commits - I cannot squash them as they have been pushed. It looks ugly. It works sure but it is ugly.
I don't think I can edit on the servers directly - the file are spread out a lot, and I cannot make each directory on three servers a clone of github and hope to keep things sane.
And trying to write scripts that will synch the servers with my local repo is insane - fabric files took long enough.
I cannot easily git pull from jenkins, because I still have to commit to have jenkins pull, and we still get ugly ugly commit logs.
I cannot see a graceful way to do this - ideas anyone.
|
How can I run my python script in the background on a schedule?
| 10,924,388
| 3
| 2
| 7,997
| 0
|
python,linux,service
|
The cron job is probably a good approach in general, as the shell approach requires manual intervention to start it.
A couple of suggestions:
You could use a lock file to ensure that the cron job only ever starts one instance of the python script - often problems occur when using cron for larger jobs because it starts a second instance before the first instance has actually finished. You can do this simply by checking whether the lock file exists, then, if it does not, 'touch'ing the file at the beginning of the script and 'rm'ing it as your last action at the end of the script. If the lock file exists -- simply exit the script, as there is already one instance running. (Of course, if the script dies you will have to delete the lock file before running the script again).
Also, if excessive resource use is a problem, you can ensure that the script does not eat too many resources by giving it a low priority (prefix with, for example, nice -n 19).
| 0
| 1
| 0
| 1
|
2012-06-07T00:51:00.000
| 2
| 0.291313
| false
| 10,924,309
| 0
| 0
| 0
| 1
|
I have a small python script that creates a graph of data pulled from MySQL. I'm trying to figure out a way to run the script in the background all time on a regular basis. I've tried a number of things:
A Cron Job that runs the script
A loop timer
Using the & command to run the script in the background
These all have there pluses and minuses:
The Cron Job running more then every half hour seems to eat up more resources then it's worth.
The Loop timer put into the script doesn't actually put the script in the background it just keeps it running.
The Linux & command backgrounds the process but unlike a real Linux service I can't restart/stop it without killing it.
Can someone point me to a way to get the best out of all of these methods?
|
Can I keep state across GAE Pipeline API workers?
| 10,957,940
| 2
| 3
| 123
| 0
|
python,google-app-engine,pipeline
|
There's no official way at the moment. You could probably prepend a task to the MapReduce pipeline to compute and cache the list (in the datastore or blobstore, whichever is most appropriate, plus a copy in memcache). Then have your mapper and/or reducer function do a lazy initialization of a global variable that holds the list, checking first in memcache, and falling back on datastore/blobstore as necessary (and re-caching the list). As new instances are spun up to handle tasks, they'll initialize themselves.
Assuming the list is fixed at the time the MapReduce starts, competing reads from different instances won't be an issue.
| 0
| 1
| 0
| 0
|
2012-06-08T19:05:00.000
| 1
| 1.2
| true
| 10,954,677
| 0
| 0
| 0
| 1
|
I've begun creating a MapReduce job with the new Google App Engine Pipeline API, and I've run into a situation where I'd like every worker to have a copy of the same list during runtime.
One option would be to use memcache, but I'm worried that the size of this list might eventually be greater than what I can set with memcache. I think my other option would be to initialize every worker with this list context at runtime, but I can't find any way to do this in the docs and looking at the source code hasn't offered any obvious answers.
Is there a way to add extra parameters into a map reduce function or otherwise inject state into a MapReduce worker context?
|
Is concurrency possible in tornado?
| 10,962,103
| 10
| 11
| 5,472
| 0
|
python,concurrency,wsgi,tornado
|
If you are truly going to be dealing with multiple simultaneous requests that are compute-bound, and you want to do it in Python, then you need a multi-process server, not multi-threaded. CPython has Global Interpreter Lock (GIL) that prevents more than one thread from executing python bytecode at the same time.
Most web applications do very little computation, and instead are waiting for I/O, either from the database, or the disk, or from services on other servers. Be sure you need to handle compute-bound requests before discarding Tornado.
| 0
| 1
| 0
| 0
|
2012-06-09T15:08:00.000
| 2
| 1
| false
| 10,962,076
| 1
| 0
| 0
| 1
|
I understand tornado is a single threaded and non-Blocking server, hence requests are handled sequentially (except when using event driven approach for IO operation).
Is there a way to process multiple requests parallel in tornado for normal(non-IO) execution. I can't fork multiple process since I need a common memory space across requests.
If its not possible please suggest to me other python servers which can handle parallel request and also supports wsgi.
|
What is the Google Appengine Ndb GQL query max limit?
| 10,974,037
| 9
| 5
| 1,106
| 1
|
python,google-app-engine,gql,app-engine-ndb
|
This depends on lots of things like the size of the entities and the number of values that need to look up in the index, so it's best to benchmark it for your specific application. Also beware that if you find that on a sunny day it takes e.g. 10 seconds to load all your items, that probably means that some small fraction of your queries will run into a timeout due to natural variations in datastore performance, and occasionally your app will hit the timeout all the time when the datastore is having a bad day (it happens).
| 0
| 1
| 0
| 0
|
2012-06-10T11:51:00.000
| 2
| 1
| false
| 10,968,439
| 0
| 0
| 1
| 2
|
I am looking around in order to get an answer what is the max limit of results I can have from a GQL query on Ndb on Google AppEngine. I am using an implementation with cursors but it will be much faster if I retrieve them all at once.
|
What is the Google Appengine Ndb GQL query max limit?
| 10,969,575
| 7
| 5
| 1,106
| 1
|
python,google-app-engine,gql,app-engine-ndb
|
Basically you don't have the old limit of 1000 entities per query anymore, but consider using a reasonable limit, because you can hit the time out error and it's better to get them in batches so users won't wait during load time.
| 0
| 1
| 0
| 0
|
2012-06-10T11:51:00.000
| 2
| 1.2
| true
| 10,968,439
| 0
| 0
| 1
| 2
|
I am looking around in order to get an answer what is the max limit of results I can have from a GQL query on Ndb on Google AppEngine. I am using an implementation with cursors but it will be much faster if I retrieve them all at once.
|
Hadoop streaming: reporting error
| 10,970,649
| 4
| 3
| 1,374
| 0
|
python,hadoop,amazon-web-services,amazon-emr
|
If you want to signal error, return a non-zero code from your python script. You can write any logging to stderr and hadoop will capture that in the task logs. You can also send status to the reporter and counters by prefixing the stderr lines with reporter:status:<msg> or reporter:counter:<group>,<name>,<increment>
| 0
| 1
| 0
| 0
|
2012-06-10T16:28:00.000
| 1
| 1.2
| true
| 10,970,310
| 0
| 0
| 0
| 1
|
What is the best practice for reporting exceptions in Hadoop streaming with Python scripts?
I mean: let's say I have a mapper script that can't understand its input, how do I signal Hadoop to terminate the job & report an error message?
Do I use logging and finish off with sys.exit?
|
How to do this kind of session related task in App Engine Python?
| 10,973,713
| 1
| 0
| 42
| 0
|
python,google-app-engine,web-applications
|
You'd use the datastore to create a union as an entity class, with a description and a name. If your image is small you can store it in your entity, if it's large, you may store it in the blobstore and store a link to it inside your entity.
You can use the python User API for authentication. You don't really need any special session work if you're using the User API.
| 0
| 1
| 0
| 0
|
2012-06-11T00:21:00.000
| 1
| 0.197375
| false
| 10,973,432
| 0
| 0
| 1
| 1
|
First than all, I don't even know if this is a session related question. But I could not think a better way to describe it in the title.
I'm developing a web application for registered users so they can create and manage trade unions.
A user can create several unions. Each union can store an image, a description and a name.
The index page shows the list of unions created by the currently registered user.
When the user clicks on a union from the list, all the pages of the application must show
in they headers the corresponding name and image stored for that union.
Also, all the options of the application must refer to the currently selected union.
That is the process for every selected union.
How could I do this on App Engine Python? What technique could I use? Is it something
related to sessions? I do the authentication process with the Gmail service.
I hope I explained myself clearly.
Thanks in advance!
|
How to make newest version of Python the default or first in path
| 10,979,970
| 1
| 1
| 109
| 0
|
python,upgrade,pythonpath,system-variable
|
I know you say you've updated %PATH%. However, from the description of the symptoms it is almost certain that c:\Python27 still appears on the %PATH% instead of (or before) c:\Python32.
To diagnose, start cmd.exe and type set. Then locate PATH and see what Python directories it contains and in what order.
| 0
| 1
| 0
| 0
|
2012-06-11T12:15:00.000
| 2
| 0.099668
| false
| 10,979,918
| 1
| 0
| 0
| 2
|
I have installed a new version of Python, so I want to make sure when Python is invoked that version is first in my path. So, now on my 'C' drive I have "Python27" and "Python32" (old and new version, respectively).
When I type "python" in the command line I get "Python 2.7". Using control panel I have changed the "path" and "pythonpath" user variables (from 'C:\Python27' to 'C:\Python32') and to be sure I have reload the system. It still does not work. Does anyone have any idea how I can force the system to use the new version of Python?
ADDED
May be this is important. When I go to the 'Python32' directory and type in command line 'python', I do get the new version.
|
How to make newest version of Python the default or first in path
| 10,980,880
| 1
| 1
| 109
| 0
|
python,upgrade,pythonpath,system-variable
|
Personally, I put the dirs to all installed Python versions in %PATH%, but changed the executable names for all but the 'default' version. E.g., I have a C:\Python26\Python.exe, C:\Python27\Python27.exe and a C:\Python32\Python32.exe. This way I can easily start any version from the command line.
| 0
| 1
| 0
| 0
|
2012-06-11T12:15:00.000
| 2
| 0.099668
| false
| 10,979,918
| 1
| 0
| 0
| 2
|
I have installed a new version of Python, so I want to make sure when Python is invoked that version is first in my path. So, now on my 'C' drive I have "Python27" and "Python32" (old and new version, respectively).
When I type "python" in the command line I get "Python 2.7". Using control panel I have changed the "path" and "pythonpath" user variables (from 'C:\Python27' to 'C:\Python32') and to be sure I have reload the system. It still does not work. Does anyone have any idea how I can force the system to use the new version of Python?
ADDED
May be this is important. When I go to the 'Python32' directory and type in command line 'python', I do get the new version.
|
Rabbitmq connection issue when using a username and password
| 72,374,505
| 0
| 2
| 3,691
| 0
|
python,rabbitmq,celery
|
To get resolve connection with rabbitmq need to inspect below points:
Connectivity from client machine to rabbitmq server machine [in case if client and server are running on separate machine], need to check
along with port as well.
Credential (username and password), a user must be onboarded into RabbitMQ which will be used to connect with RabbitMQ
Permission to User must be given (permission may be attached to VHOST as well so need to provide permission carefully)
| 0
| 1
| 1
| 0
|
2012-06-13T04:47:00.000
| 2
| 0
| false
| 11,008,337
| 0
| 0
| 0
| 1
|
I am trying to start some background processing through rabbitmq, but when I send the request, I get the below error in the rabbitmq log. But, I think I am providing the right credentials, as my celery works are able to connect to rabbitmq server using the same username/password combination.
=ERROR REPORT==== 12-Jun-2012::20:50:29 ===
exception on TCP connection from 127.0.0.1:41708
{channel0_error,starting,
{amqp_error,access_refused,
"AMQPLAIN login refused: user 'guest' - invalid credentials",
'connection.start_ok'}}
|
Django vs webapp2 on App Engine
| 11,020,530
| 24
| 11
| 9,275
| 0
|
python,django,google-app-engine,python-2.7,webapp2
|
Choosing between Django and webapp2 really depends on what you're using it for. In your question you haven't given any of the parameters for your decision making, so it's impossible to tell which is "better". Describing them both as "web frameworks" shows you haven't done much research into what they are.
Webapp2 is essentially a request handler. It directs HTTP requests to handlers that you write. It's also very small.
Django has a request handler. It also has a template engine. It also has a forms processor. It also has an ORM, which you may choose to use, or not. Note that you can use the ORM on CloudSQL, but you'll need to use Django-nonrel if you want to use the ORM on the HRD. It also has a library of plugins that you can use, but they'll only work if you're using the Django ORM. It also has bunch of 3rd party libraries, which will also require the Django ORM.
If you have portability in mind the Django ORM would help a lot.
You'll have to make your decision comparing what you actually need.
| 0
| 1
| 0
| 0
|
2012-06-13T08:29:00.000
| 1
| 1.2
| true
| 11,010,953
| 0
| 0
| 1
| 1
|
I would like to know your opinion of which of these two web frameworks (Django & webapp2) is better for using on App Engine Platform, and why?
Please don't say that both are completely different, because Django is much more complete. Both are the "web frameworks" you can use in App Engine.
|
Run Python in cmd
| 30,681,229
| 1
| 10
| 74,076
| 0
|
python,windows-7,path,cmd,python-2.7
|
I hope, your problem really was the problem I think it is, because I (hopefully) had the same. I'm very sure, Levon's answer was right, so this is the n00b solution.
For the CMD to recognize "python", you need to add something to the environment variable "Path". When you're done with the insturctions you can type "echo %PATH%" into the cmd and it should show you the variable value you just changed.
Go to Computer > System Properties > Advanced Settings > Environment Variables
Click the variable "Path" and add ;C:\Python27 to the variable value. Don't forget the ";" to separate the values.
Confirm with OK in both windows and you're done.
| 0
| 1
| 0
| 0
|
2012-06-13T23:49:00.000
| 3
| 0.066568
| false
| 11,024,993
| 1
| 0
| 0
| 1
|
I am running python 2.7, I can run a program fine when I open the *.py file.
But when I go to cmd and type "python *.py any other args", it doesn't work, it says that python is not recognised. This is hard because I am trying to do things like sys.argv[], any help is great.
Thanks
|
Eclipse and pyddev: Error can't find Python32
| 11,192,462
| 3
| 2
| 820
| 0
|
python,eclipse
|
You probably still have that selected in your project or launch configuration... You can try to delete your existing launch configurations (run > run configurations) so that they get recreated on a new run and if that's not it, take a look at your project properties > pydev - interpreter/grammar and see if an old interpreter was selected.
| 0
| 1
| 0
| 1
|
2012-06-14T13:59:00.000
| 1
| 1.2
| true
| 11,034,733
| 1
| 0
| 0
| 1
|
I cannot compile python in pydev in eclipse. I get the following error:
"unable to make launch because launch configuration is not valid
Reason:
Interpreter: Python32 not found"
I am actually runnning Python26 and have configured Python26 as the interpreter in "Windows->Preferences"
I have deleted and replaced my copy of eclipse and this persists. Any help would be appreciated. I think that at one time I had Python32 running and then switched to Python26.
|
Can eclipse pydev interpret a file as a python file without a suffix
| 11,062,473
| 2
| 1
| 123
| 0
|
python,eclipse,pydev
|
Just right-click on the file, then hit "Open With" -> "Other", then choose "Python editor" and hit OK. Eclipse will remember your choice and from then on will open that particular file in the Python editor when you double-click it.
| 0
| 1
| 0
| 0
|
2012-06-15T14:48:00.000
| 1
| 1.2
| true
| 11,052,999
| 1
| 0
| 0
| 1
|
If I have a python file that has no suffix. Can pydev read that file as a python file using the first line of the file if it includes a #!/usr/bin/python? I'm not really concerned specifically about using that first line, just that that line exists and might be useable. If there is a manual way to mark a file as a python file without mucking with its suffix that'd be fine as well.
|
Setting up tornado in mac
| 21,272,652
| 1
| 0
| 5,106
| 0
|
python,installation,tornado
|
Try running it like this:
sudo easy_install tornado
When you are using stock python on OSX the easy_install command will install tornado system wide and it therefore needs admin rights. When using homebrew python (e.g. installed brew and python with "brew install python") then you can install python packages without having to do the sudo.
One word of advice: when working on a lot of python projects it's better to use virtualenv for installing python deps; that way you can have multiple isolated python environments AND you don't need the sudo.
| 0
| 1
| 0
| 0
|
2012-06-16T17:31:00.000
| 2
| 0.099668
| false
| 11,065,607
| 0
| 0
| 0
| 2
|
I'm new to using mac and tornado. I have installed easy_install and tried installing tornado but I am keep getting "Permission denied"
easy_install tornado
Searching for tornado
Best match: tornado 2.3
Processing tornado-2.3-py2.7.egg
Adding tornado 2.3 to easy-install.pth file
error: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/easy-install.pth: Permission denied
What is going wrong?
|
Setting up tornado in mac
| 11,065,625
| 0
| 0
| 5,106
| 0
|
python,installation,tornado
|
You might want to try running that command as root if you want to install tornado system-wide or take a look at virtualenv for installing python packages in a sandboxed environment. Also, I recommend pythonbrew if you want to experiment with various versions of Python.
| 0
| 1
| 0
| 0
|
2012-06-16T17:31:00.000
| 2
| 0
| false
| 11,065,607
| 0
| 0
| 0
| 2
|
I'm new to using mac and tornado. I have installed easy_install and tried installing tornado but I am keep getting "Permission denied"
easy_install tornado
Searching for tornado
Best match: tornado 2.3
Processing tornado-2.3-py2.7.egg
Adding tornado 2.3 to easy-install.pth file
error: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/easy-install.pth: Permission denied
What is going wrong?
|
Open new python shell on C-c C-c in python-mode.el
| 11,602,461
| 2
| 1
| 1,178
| 0
|
emacs,python-mode
|
python-mode.el comes with a command py-execute-buffer-dedicated,
opening a new and reserved process for it
| 1
| 1
| 0
| 0
|
2012-06-16T20:11:00.000
| 2
| 0.197375
| false
| 11,066,684
| 0
| 0
| 0
| 1
|
I have a small GTK python application that imports a package (Twisted) that may not be loaded twice.
If I run my application in emacs with python-mode.el and press C-c C-c, the application gets executed in a python shell window.
If I now close the application, the python shell stays up and running. If I now press C-c C-c again, emacs "reuses" the old python process and thus I run into problems because I'm installing a Twisted reactor twice.
Is it possible to have python-mode.el open a new shell window each time I execute a buffer?
|
appengine DateTimeProperty auto_now=True unexpected behavior
| 11,094,276
| 2
| 1
| 327
| 0
|
python,google-app-engine
|
No, this is not due to the HRD -- auto_now is implemented purely in the client library. After you write the entity, the property's value does not correspond to what's written to the datastore, but to what was last read. I'm not sure what you'll see for a brand new entity but it's probably still not the same as what was written.
If you switch to NDB you'll find that auto_now behaves much more reasonably. :-)
| 0
| 1
| 0
| 0
|
2012-06-17T14:42:00.000
| 1
| 1.2
| true
| 11,072,138
| 0
| 0
| 1
| 1
|
I use a last_touch_date DateTimeProperty as a means for revisioning entities in my application's datastore using the auto_now=True flag.
When a user posts an entity it receives its last_touch_date as a reference for future updates.
However, when I check the entity's last_touch_date afterwards I always find a slight delta between this property as read right after writing and soon afterwards. I have a feeling this is a result of the high consistency model.
Is this known behavior? Is there a workaround besides managing this property my self?
|
how to install python-rest-client lib in linux
| 11,184,777
| 1
| 1
| 1,855
| 0
|
python,json,rest
|
avasal, you were right. I did it by pip install python-rest-client
| 0
| 1
| 1
| 0
|
2012-06-18T10:45:00.000
| 1
| 1.2
| true
| 11,081,209
| 0
| 0
| 0
| 1
|
I need to use python-rest-client package into my project. I tried several times for installing python-rest-client into my linux python, it never worked. But it works well in Windows python. Would anybody tell me how to install python-rest-client in linux python.
|
Google App Engine: Determine whether Current Request is a Taskqueue
| 11,082,412
| 7
| 4
| 923
| 0
|
python,google-app-engine,task-queue
|
Pick any one of the following HTTP headers:
X-AppEngine-QueueName, the name of the queue (possibly default)
X-AppEngine-TaskName, the name of the task, or a system-generated unique ID if no name was specified
X-AppEngine-TaskRetryCount, the number of times this task has been retried; for the first attempt, this value is 0
X-AppEngine-TaskETA, the target execution time of the task, specified in microseconds since January 1st 1970.
Standard HTTP requests won't have these headers.
| 0
| 1
| 0
| 0
|
2012-06-18T11:23:00.000
| 2
| 1.2
| true
| 11,081,767
| 0
| 0
| 1
| 1
|
Is there a way to dynamically determine whether the currently executing task is a standard http request or a TaskQueue?
In some parts of my request handler, I make a few urlfetches. I would like the timeout delay of the url fetch to be short if the request is a standard http request and long if it is a TaskQueue.
|
Generating users accounts inside Google App Engine
| 11,093,808
| 3
| 11
| 4,278
| 0
|
python,google-app-engine,openid
|
If you don't want to require a Google Account or OpenID account you have to roll your own accounts system. This gives you maximum freedom, but it is a lot of work and makes you responsible for password security (ouch). Personally I would advise you to reconsider this requirement -- OpenID especially has a lot going for it (except IIUC it's not so simple to use Facebook).
| 0
| 1
| 0
| 0
|
2012-06-18T13:19:00.000
| 3
| 0.197375
| false
| 11,083,776
| 0
| 0
| 1
| 1
|
For a project, I'm going to create an application on Google App Engine where:
Discussion Leaders can register with their e-mail address (or OpenID or Google Account) on the website itself to use it.
In the application admin page they can create a group discussion for which they can add users based on their e-mail address
and these users should then receive generated account details (if they don't have accounts yet) making them able to log in to that group discussion with their newly created account.
I don't want to require discussion leaders to having a Google Account or OpenID account in order to register for the application and all user other accounts must be generated by the discussion leader.
However Google App Engine seems to only support Google Accounts and OpenID accounts. How would I go about this? Is there an existing pattern for creating leader-accounts and generating user-accounts from within the Google App Engine which still support the GAE User API?
|
Getting standard output from a Python Gnome Applet
| 11,083,956
| 2
| 0
| 135
| 0
|
python,applet,gnome
|
stdout and stderr of applications started via X or one of its children are written to ~/.xsession-errors if not redirected.
| 0
| 1
| 0
| 0
|
2012-06-18T13:22:00.000
| 1
| 0.379949
| false
| 11,083,838
| 0
| 0
| 0
| 1
|
I'm currently writing a Gnome Panel Applet in Python. Everything is working fine as long as I don't try to actually add it to the panel (running it in a window works).
When trying to add it to a panel it crashes and I have no idea why, because I can't see the error trace.
Is there a simple way to log the output of a Gnome Applet to a file so I can find the problem?
|
IDLE not integrated in desktop
| 11,091,290
| 2
| 1
| 397
| 0
|
python,installation,python-idle
|
try making a .py file and then try to open it, and a window should appear asking you what to open it with, and then select idle in your program files.
| 0
| 1
| 0
| 0
|
2012-06-18T21:07:00.000
| 1
| 1.2
| true
| 11,091,052
| 1
| 0
| 0
| 1
|
Just installed Python 2.7.3 on a Windows7 machine.
How do I get .py files to be associated with python (they are with notepad ATM) and how do I get the context menu shortcut for "edit in IDLE"? Somehow I didn't get that on this particular computer.
|
How do you run the Tornado web server locally?
| 11,096,932
| 0
| 9
| 19,432
| 0
|
python,tornado
|
If you want to daemonize tornado - use supervisord. If you want to access tornado on address like http://mylocal.dev/ - you should look at nginx and use it like reverse proxy. And on specific port it can be binded like in Lafada's answer.
| 0
| 1
| 0
| 0
|
2012-06-19T05:33:00.000
| 4
| 0
| false
| 11,094,920
| 0
| 0
| 0
| 2
|
Is it possible to run Tornado such that it listens to a local port (e.g. localhost:8000). I can't seem to find any documentation explaining how to do this.
|
How do you run the Tornado web server locally?
| 39,968,411
| 1
| 9
| 19,432
| 0
|
python,tornado
|
Once you've defined an application (like in the other answers) in a file (for example server.py), you simply save and run that file.
python server.py
| 0
| 1
| 0
| 0
|
2012-06-19T05:33:00.000
| 4
| 0.049958
| false
| 11,094,920
| 0
| 0
| 0
| 2
|
Is it possible to run Tornado such that it listens to a local port (e.g. localhost:8000). I can't seem to find any documentation explaining how to do this.
|
How to read other files in hadoop jobs?
| 11,098,023
| 0
| 0
| 91
| 0
|
python,hadoop
|
Problem solved by adding the file needed with the -file option or file= option in conf file.
| 0
| 1
| 0
| 0
|
2012-06-19T06:00:00.000
| 1
| 1.2
| true
| 11,095,220
| 0
| 1
| 0
| 1
|
I need to read in a dictionary file to filter content specified in the hdfs_input, and I have uploaded it to the cluster using the put command, but I don't know how to access it in my program.
I tried to access it using path on the cluster like normal files, but it gives the error information: IOError: [Errno 2] No such file or directory
Besides, is there any way to maintain only one copy of the dictionary for all the machines that runs the job ?
So what's the correct way of access files other than the specified input in hadoop jobs?
|
Jenkins takes too long to execute
| 11,126,510
| 0
| 2
| 2,535
| 0
|
python,windows,selenium,build,jenkins
|
Check load on the machine and ensure you set Jenkins with enough memory to run those tests.
It is not clear if you are working with Jenkins-slaves or directly on the master -
This may also have an affect on performance.
| 0
| 1
| 0
| 1
|
2012-06-19T16:28:00.000
| 2
| 0
| false
| 11,105,304
| 0
| 0
| 0
| 2
|
I'm currently building Python regression tests using Jenkins. For some reason, each individual test in the test suite is taking approx. 15 minutes to run (and there are about 70/80 tests total) in Jenkins, but when I run the tests from the command line on the same windows box, each individual tests takes only about 30seconds to 1minute to run. I even put print statements in some of the files and none of them show up on the jenkins command line output.
Has anyone else faced this problem or have any suggestions?
Thanks
Also, I'm not doing a sync every time I build, only syncing once!
|
Jenkins takes too long to execute
| 11,109,668
| 1
| 2
| 2,535
| 0
|
python,windows,selenium,build,jenkins
|
This may have to do with running Jenkins in the background (and/or as a service). Try running it in the foreground with java -jar jenkins.war an see if it helps.
| 0
| 1
| 0
| 1
|
2012-06-19T16:28:00.000
| 2
| 1.2
| true
| 11,105,304
| 0
| 0
| 0
| 2
|
I'm currently building Python regression tests using Jenkins. For some reason, each individual test in the test suite is taking approx. 15 minutes to run (and there are about 70/80 tests total) in Jenkins, but when I run the tests from the command line on the same windows box, each individual tests takes only about 30seconds to 1minute to run. I even put print statements in some of the files and none of them show up on the jenkins command line output.
Has anyone else faced this problem or have any suggestions?
Thanks
Also, I'm not doing a sync every time I build, only syncing once!
|
Determine the current number of backlogged connections in TCP listen() queue
| 11,127,146
| 2
| 8
| 3,268
| 0
|
python,linux,sockets,tcp,twisted
|
There is no function for this in the BSD Sockets API that I have ever seen. I question whether it is really a useful measure of load. You are assuming no connection pooling by clients, for one thing, and you are also assuming that latency is entirely manifested as pending connections. But as you can't get the number anyway the point is moot.
| 0
| 1
| 1
| 0
|
2012-06-20T19:00:00.000
| 3
| 0.132549
| false
| 11,126,372
| 0
| 0
| 0
| 1
|
Is there a way to find out the current number of connection attempts awaiting accept() on a TCP socket on Linux?
I suppose I could count the number of accepts() that succeed before hitting EWOULDBLOCK on each event loop, but I'm using a high-level library (Python/Twisted) that hides these details. Also it's using epoll() rather than an old-fashioned select()/poll() loop.
I am trying to get a general sense of the load on a high-performance non-blocking network server, and I think this number would be a good characterization. Load average/CPU statistics aren't helping much, because I'm doing a lot of disk I/O in concurrent worker processes. Most of these stats on Linux count time spent waiting on disk I/O as part of the load (which it isn't, for my particular server architecture). Latency between accept() and response isn't a good measure either, since each request usually gets processed very quickly once the server gets around to it. I'm just trying to find out how close I am to reaching a breaking point where the server can't dispatch requests faster than they are coming in.
|
How can I ssh into a windows box running cygwin/sshd and have the resulting terminal session use cygwin instead of default BASH?
| 11,140,725
| 1
| 1
| 865
| 0
|
python,windows,ssh,cygwin
|
Got it. The solution is simply to run the Cygwin.bat from the c:\cygwin folder, which puts you into a cygwin terminal, allowing the use of all of the needed functionality. The same also works for the mozilla-build terminal that I neeeded. :-D
| 0
| 1
| 0
| 0
|
2012-06-20T19:57:00.000
| 1
| 0.197375
| false
| 11,127,205
| 0
| 0
| 0
| 1
|
I am trying to port my linux network automation to a set of Windows machines. The program I have starts with a single admin console, and transmits instructions over sockets and ssh tunnels to client machines instructing them to run specific mozmill/python scripts. I have gotten the individual client script to run on windows using cygwin, but I need to be able to call them from an ssh session, and ssh-ing in through Cygwin's sshd distribution logs me in with a basic Bash terminal instead of the Cygwin terminal. How can I switch which terminal is used in this situation?
|
top user authentication method for google app engine
| 11,132,393
| 2
| 1
| 637
| 0
|
python,google-app-engine,jinja2,authentication
|
Your choices are Google's own authentication, OpenID, some third party solution or roll your own. Unless you really know what you are doing, do not choose option 4! Authentication is very involved, and if you make a single mistake or omission you're opening yourself up to a lot of pain. Option 3 is not great because you have to ensure the author really knows what they are doing, which either means trusting them or... really knowing what you're doing!
So I'd suggest you chose between Google's authentication and OpenID. Both are well trusted; Google is going to be easier to implement because there are several OpenID account providers you have to test against; but Google authentication may turn away some users who refuse to have Google accounts.
| 0
| 1
| 0
| 0
|
2012-06-21T01:32:00.000
| 1
| 1.2
| true
| 11,130,434
| 0
| 0
| 1
| 1
|
Having ease of implementation a strong factor but security also an issue what would the best user authentication method for google app engine be? My goal is to have a small very specific social network. I know how to make my own but making it hack-proof is a little out of my league right now. I have looked at OpenID and a few others.
I am using Jinja2 as my template system and writing all of my web app code in python.
Thanks!
|
Is any other open source web server available other than Apache webserver for web application development?
| 11,132,477
| 3
| 0
| 1,701
| 0
|
python,apache,web-applications,webserver
|
Apart from Apache web server is there any open source web servers available for web application development? are you looking for an HTTP server or a web framework, the two are quite different.
HTTP servers simply send/recieve requests among other tasks, yes you can use PHP and other tools most commonly through CGI or FCGI but fundamentally an HTTP server simply accepts HTTP requests, some content maybe dynamic if its coming from an underlying framework.
A web framework is a collection of tools used to generate dynamic content, or web apps, many frameworks come with a built in http server so you don't have to configure one on your own, but they aren't as powerful or as robust since the underlying frameworks tends to concentrate on generating the content.
nginx is one my favorite HTTP servers, among the many out there, since it tends to be one of the easier ones to configure.
As for web frameworks, there are many many out there, in the python comunity (giving the python tag) django tends to be quite popular since it tends to include virtually all the tools you'd ever need to deploy a web app, which include, url dispatchig, database engine + ORM Object Relational Mapper and its own templating engine to render dynamic html in its own limited language, to remove as much as possible the logic from the rendering phase.
Usually django apps are deployed behind nginx, to control multiple instances of sites on the server, as well as serving static content, web frameworks are not great at it.
Theres also micro-webframeworks like bottle which is basically a single python file, its quite cool, I usually use sqlalchemy as the ORM when building simple bottle apps.
| 0
| 1
| 0
| 0
|
2012-06-21T05:33:00.000
| 3
| 0.197375
| false
| 11,132,059
| 0
| 0
| 1
| 2
|
Apart from Apache web server is there any open source web servers available for web application development?
I am looking for a web server developing python web applications and deploy it and test it.
|
Is any other open source web server available other than Apache webserver for web application development?
| 11,132,139
| 0
| 0
| 1,701
| 0
|
python,apache,web-applications,webserver
|
If you simply Google "Open Source Web Server" you'll get a lot of results.
Nginx
Lighttpd
Cherokee
Savant
Tornado
Nginx is probably the best alternative.
| 0
| 1
| 0
| 0
|
2012-06-21T05:33:00.000
| 3
| 0
| false
| 11,132,059
| 0
| 0
| 1
| 2
|
Apart from Apache web server is there any open source web servers available for web application development?
I am looking for a web server developing python web applications and deploy it and test it.
|
Troubles with http server on linux
| 11,219,337
| 0
| 0
| 93
| 0
|
python,performance,http
|
It looks like that you have problems with DNS. can you check this idea running host 192.168.1.100 on the host? Please also check that other DNS queries being quickly processed.
Check /etc/hosts file for a quick-and-dirty solution.
| 0
| 1
| 0
| 0
|
2012-06-21T16:17:00.000
| 2
| 0
| false
| 11,142,427
| 0
| 0
| 1
| 1
|
I have such problem. I have local http server (BottlePy or Django), and when i use http:// localhost/ or http:// 127.0.0.1/ - it loads immediately. But when i use my local ip (192.168.1.100), it loads very long time (some minutes). What could be the problem?
Server works on Ubuntu 11.
|
/dev/urandom range
| 11,147,069
| 4
| 1
| 1,684
| 0
|
python,linux,random,cryptography
|
It generates bytes, so 0x00 to 0xFF inclusive.
| 0
| 1
| 0
| 0
|
2012-06-21T21:29:00.000
| 2
| 1.2
| true
| 11,147,044
| 1
| 0
| 0
| 1
|
I need to generate some token that can only take on a range of characters, [a-zA-Z0-9_]
I'm trying to work with binascii.b2a_base64(os.urandom(64)), which has other characters such as + and are causing problems.
What's the range of /dev/urandom (i'm on linux) so that I can just map the output integers to a value uniformly myself.
|
Writing python on mac to use on Windows
| 11,161,658
| 4
| 2
| 6,062
| 0
|
python,windows,macos,ironpython
|
You can't make a native py2exe-style executable on Mac. Use Virtualbox to run Windows inside your Mac environment. No need to reboot the whole machine.
| 0
| 1
| 0
| 0
|
2012-06-22T17:55:00.000
| 2
| 1.2
| true
| 11,161,613
| 1
| 0
| 0
| 1
|
I've seen from some sources that although you can make an exe or mac equivalent app using py2exe or py2app, you can only make the one your system is. Makes sense when I think about it.
But my problem is sometimes I want to write python scripts and send them to my Windows-using friends to test and play with. But Windows doesn't come with python installed, and I don't want to make them have to install Python.
Is there any way to use a MAC to create a python-made file that can be opened without python or any installation ON WINDOWS?
If there's not I suppose I could try using the emulated Windows on my system to make it an exe, but I'd rather not boot that every time I need to change something.
|
pip: inconsistent permissions issues
| 42,556,424
| 0
| 16
| 11,217
| 0
|
python,centos,pip,python-module
|
If executing pip with sudo, you may want sudo's -H flag
-H, --set-home set HOME variable to target user's home dir
e.g
sudo -H pip install virtualenv
| 0
| 1
| 0
| 0
|
2012-06-22T18:05:00.000
| 2
| 0
| false
| 11,161,776
| 1
| 0
| 0
| 2
|
When installing a package via sudo pip-python (CentOS 6 package: python-pip-0.8-1.el6.noarch), I sometimes get permission issues with the installed packages being readable only by root.
Re-installing again one or two times usually fixes the problem. Has anyone experienced this? Or can anyone suggest any troubleshooting steps to nail down the cause?
|
pip: inconsistent permissions issues
| 11,169,137
| 13
| 16
| 11,217
| 0
|
python,centos,pip,python-module
|
When you run a command using sudo, it will preserve the users umask. pip just installs files, it doesn't change access rights, so you'll end up with the files having the access rights set conforming to the current user's umask, which may be owner-readable only (0077) and therefore readable by root only.
That means you can set umask to something sensible like umask 0022 before running sudo pip install. Or use sudo su to open a root shell with default settings and then pip install.
| 0
| 1
| 0
| 0
|
2012-06-22T18:05:00.000
| 2
| 1
| false
| 11,161,776
| 1
| 0
| 0
| 2
|
When installing a package via sudo pip-python (CentOS 6 package: python-pip-0.8-1.el6.noarch), I sometimes get permission issues with the installed packages being readable only by root.
Re-installing again one or two times usually fixes the problem. Has anyone experienced this? Or can anyone suggest any troubleshooting steps to nail down the cause?
|
Fabric equivalent of try finally
| 11,497,518
| 0
| 5
| 1,088
| 0
|
python,fabric
|
You could always use the new execute() and wrap that in a try/except or just look at the return codes from your run()s.
| 0
| 1
| 0
| 0
|
2012-06-22T18:39:00.000
| 2
| 0
| false
| 11,162,214
| 1
| 0
| 0
| 1
|
In the eventuality that Fabric exits cleanly or not, I need to execute a bunch of clean-up tasks (mostly delete temp files and folders).
How can I achieve this with Fabric?
|
How can I detect my RAM free and total space in Python?
| 11,170,901
| 1
| 0
| 186
| 0
|
linux,python-2.7
|
You are asking for a number that is nearly impossible to calculate and has very little value.
Any Linux system that is running for an amount of time will have hardly any 'free' ram available. Just cat /proc/meminfo - the MemFree entry is usually in order of just a few megabytes.
So, where did that memory go?
The kernel caches all disk access, for starters.
That's usually visible in the Cached entry. Disk cache will be pruned when you require more memory, so you could add that number to MemFree .
But, if an application allocates (malloc() in C) 2 gigabytes on a system with exactly 2 gigabytes of RAM, that usually will just be granted: you get a valid pointer back.
However, none of the RAM is actually reserved for your application - that only happens when your application starts touching memory pages - each touched page will be allocated.
The maximum size you can ask for is available as CommitLimit.
But the application code itself might not be in RAM either - binary file and libraries are mmapp()ed, so again only pages that are touched are loaded into RAM.
If you run a tool like top - you get all kinds of memory info per process, including VIRT, RES and SHR.
VIRT is for 'virtual' - all memory pages that the app would need if it would claim all pages it has asked for.
RES is 'resident' - the amount of memory actually used
SHR is 'shared' - the amount of pages that are shared with other applications, like e.g. libraries that are loaded in multiple applications.
So, what is the value of knowing how much memory is available?
You can start an application that could require significantly more RAM than your system has, and yet it runs...
You might even be able to run the application twice or thrice - code pages are shared anyway...
Note: the above answer cuts quite a few corners, the real mechanisms are significantly more complex. And I haven't even started bringing swap space into the story.
But this will do for you, I hope...
| 0
| 1
| 0
| 0
|
2012-06-22T21:55:00.000
| 1
| 0.197375
| false
| 11,164,651
| 1
| 0
| 0
| 1
|
So, the title describes almost all the necessary to answer me. Just one more thing: please, just reply about libraries installed with Python by default, as the app which I'm developing is part of the Ubuntu App Showdown.
Running Python 2.7, Ubuntu 12.04.
|
python libraries in cpanel
| 11,169,154
| 1
| 0
| 1,172
| 0
|
python,django,web-hosting,cpanel
|
You could try to put them in your PYTHONPATH. Usually, your current working directory is in your PYTHONPATH. If that changes, you might need to add a path to it (maybe in each file, you should check, or one common file which is always included), and put the libraries there. You can do this with import sys;sys.path.append(the_path)
I'm not sure all of the libraries will work, but those which are pure-python, you should be able to copy/paste the source in a directory, and they will work I think.
| 0
| 1
| 0
| 1
|
2012-06-23T10:23:00.000
| 2
| 1.2
| true
| 11,168,747
| 0
| 0
| 1
| 2
|
I am using heliohost's free service to test my django apps. But Heliohost does not provide me shell access. Is there anyway to install python libraries on the host machine?
|
python libraries in cpanel
| 45,138,203
| 0
| 0
| 1,172
| 0
|
python,django,web-hosting,cpanel
|
You should inform the support of heliohost.this server has very good support that help you or install any package you want
| 0
| 1
| 0
| 1
|
2012-06-23T10:23:00.000
| 2
| 0
| false
| 11,168,747
| 0
| 0
| 1
| 2
|
I am using heliohost's free service to test my django apps. But Heliohost does not provide me shell access. Is there anyway to install python libraries on the host machine?
|
Running Python Scripts from Command Line with Pypy Interpreter
| 11,194,517
| 0
| 0
| 1,249
| 0
|
python,command-line,path,pypy
|
to add to your path just open your start menu
right click on "Computer"
select "Properties"
click option for "Advanced System Settings"
click option for "environmental Variables"
change the one named "PATH" to include the folder that you need
| 0
| 1
| 0
| 0
|
2012-06-25T17:37:00.000
| 2
| 0
| false
| 11,194,380
| 1
| 0
| 0
| 1
|
So, I have installed the pypy pre-built interpreter to my home folder in windows; however, it only allows me to execute python scripts through the interpreters interface (similar to IDLE). I would like to extend this functionality to the cmd line in windows by putting something referencing the pypy interpreter to my system's PATH, however, I cannot find any documentation about this.
|
Do I need to install Homebrew if I am planning to install Virtualenv?
| 11,214,702
| 2
| 1
| 680
| 0
|
python,macos,osx-lion,virtualenv,homebrew
|
Homebrew is just a package manager for Mac, like pip for Python. Of course you never need a package manager, you can just get all the programs, or libraries in case of pip and Pypi yourself. The point of package managers however is to ease this process and give you a simple interface to install the software, and also to remove it as that is usually not so simply when compiling things yourself etc.
That being said, Homebrew will only install things you tell it to install, so by just having Homebrew you don’t randomly get new versions of something. Homebrew is just a nice way to install general OSX stuff you need/want in general.
| 0
| 1
| 0
| 0
|
2012-06-26T19:28:00.000
| 2
| 1.2
| true
| 11,214,620
| 1
| 0
| 0
| 1
|
Being fairly new to programming, I am having trouble understanding exactly what Homebrew does... or rather - why it is needed. I know it contains pip for package management, but so does Virtualenv and I'm planning on installing this in due course.
Does Homebrew install another version of python that is not the system version, upon which you would install Virtualenv and manage the different development environments from there?
I have a clean install of OSX Lion and I want to keep my projects separated, but am unsure why I need Homebrew.
I realise this is basic stuff, but if someone could explain it, I would be grateful.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.