Q_Id
int64
2.93k
49.7M
CreationDate
stringlengths
23
23
Users Score
int64
-10
437
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
DISCREPANCY
int64
0
1
Tags
stringlengths
6
90
ERRORS
int64
0
1
A_Id
int64
2.98k
72.5M
API_CHANGE
int64
0
1
AnswerCount
int64
1
42
REVIEW
int64
0
1
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
15
5.1k
Available Count
int64
1
17
Q_Score
int64
0
3.67k
Data Science and Machine Learning
int64
0
1
DOCUMENTATION
int64
0
1
Question
stringlengths
25
6.53k
Title
stringlengths
11
148
CONCEPTUAL
int64
0
1
Score
float64
-1
1.2
API_USAGE
int64
1
1
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
15
3.72M
9,696,294
2012-03-14T05:13:00.000
0
0
0
0
0
python,django,ftp,web-hosting
0
9,698,149
0
3
0
false
1
0
There are different tools for FTP and SSH file transfer. Which one is best for you depends on your environment (e.g. operating system) and your needs (do you want a graphical or command line interface?). But basically it's always a program you run on your machine that connects to a server to upload files. You don't do anything through a web site (except finding out which server to connect to and maybe setting up an account / password).
1
0
0
0
I'm in the midst of trying to get my first website up and running all of the sudden I get to the point where I need to get my file online and I have zero idea on how to do that. I thought it would be as easy as selecting your files and clicking upload but so far it has not been that easy. Currently I'm using djangoeurope.com. So if anyone has experience with that site that would help extra.
Beginner advice on how to use FTP or SSH? (django)
0
0
1
0
0
676
9,698,557
2012-03-14T08:54:00.000
0
0
0
0
1
python,authentication,proxy,pip
0
65,307,484
0
11
0
false
0
0
For me, the issue was being inside a conda environment. Most likely it used the pip command from the conda environment ("where pip" pointed to the conda environment). Setting proxy-settings via --proxy or set http_proxy did not help. Instead, simply opening a new CMD and doing "pip install " there, helped.
1
99
0
0
My computer is running windows behind a proxy on a windows server (using active directory), and I can't figure out how to get through it with pip (in python3). I have tried using --proxy, but it still just timeouts. I have also tried setting a long timeout (60s), but that made no difference. My proxy settings are correct, and I compared them with those that I'm using successfully in TortoiseHG to make sure. Are there any other tricks that anyone knows of that I can try, or is there some limitation in pip with regards to windows proxies? Update: My failed attempts involved searching pypi. I've just tried actually installing something and it worked. Searching still fails though. Does this indicate a bug in pip or do they work differently?
How to use pip on windows behind an authenticating proxy
1
0
1
0
0
241,528
9,722,778
2012-03-15T15:21:00.000
1
1
0
1
0
python,unix
0
10,034,142
0
1
0
true
0
0
You're asking about something pretty messy here. I suspect that none of this is what you want to do at all, and that you really want to accomplish this some simpler way. However, presuming you really want to mess with process groups... Generally, a new process group is created only by the setpgrp(2) system call. Otherwise, processes created by fork(2) are always members of the current process group. That said, upon creating a new process group, the processes in that group aren't even controlled by any tty and doing what you appear to want to do properly requires understanding the whole process group model. A good reference for how all this works is Stevens, "Advanced Programming in the Unix Environment", which goes into it in gory detail. If you really want to go down this route, you're going to have to implement popen or the equivalent yourself with all the appropriate system calls made.
1
1
0
0
I'm writing a unittesting framework for servers that uses popen to basically execute "python myserver.py" with shell=False, run some tests, and then proceed to take the server down by killpg. This myserver.py can and will use multiprocessing to spawn subprocesses of its own. The problem is, from my tests, it seems that the pgrp pid of the server processes shares the same group pid as the actual main thread running the unittests, therefore doing an os.killpg on the group pid will not only take down the server but also the process calling the popen (not what I want to do). Why does it do this? And how can I make them be on separate group pids that I can kill independently?
Popen-ing a python call that invokes a script using multiprocessing (pgrp issue)?
0
1.2
1
0
0
241
9,724,539
2012-03-15T16:59:00.000
0
0
0
0
1
python,django
0
10,783,975
0
2
0
false
1
0
Think of CBV, more specifically "Generic Class Based Views" as a large tree of Python classes. Starting with the simplest class. Each one subclasses and over rides methods from one another. For example, the ArchiveIndexView is typically the view you will sub-class for the index of your site. It adds an extra context variable called latest. You must supply it with a date_field, num_latest, and a couple optionals in the view class. You can also pass these arguements in through the URLConf. However, it is more tidy and clean to have the logic in the views.py . It is quite convenient once you get the hang of it. You can create mixins of your own that essentially are as powerful as your brain. Beyond, a mixin though for something you want available on every page then perhaps a template tag or a custom context processor at worst.
1
0
0
0
I have a news on my site done with "James Bennett - Practical Django Projects, 2nd Edition (2009)". So I am using a date-based views, which will be deprecated in django-1.4. How can I just convert my views and urls to class-based views ? May be you have seen this, please just post a link, I can't find any working example, at least for MonthMixin.
Can you share an example of using class based view with MonthMixin?
0
0
1
0
0
362
9,726,483
2012-03-15T19:09:00.000
3
0
1
0
0
python,wxpython
0
9,726,647
0
2
0
false
0
0
Only the first import executes the file. Subsequent imports copy the reference from sys.modules.
2
2
0
0
Just for my knowledge, how does python, especially wxpython reacts to multiple imports? If I import wx in multiple files, how does it handle that when called the main frame? Does it slows the speed or it firstly checks whether it is already been imported or not?
Multiple imports of python modules
0
0.291313
1
0
0
111
9,726,483
2012-03-15T19:09:00.000
5
0
1
0
0
python,wxpython
0
9,726,645
0
2
0
true
0
0
When Python imports a file, it keps track of it by storing it in sys.modules. So whenever Python is importing a file it checks there first and, if it finds it there, returns that instead; if it is not there, it imports it, adds it to sys.modules, and then returns it.
2
2
0
0
Just for my knowledge, how does python, especially wxpython reacts to multiple imports? If I import wx in multiple files, how does it handle that when called the main frame? Does it slows the speed or it firstly checks whether it is already been imported or not?
Multiple imports of python modules
0
1.2
1
0
0
111
9,736,542
2012-03-16T11:38:00.000
1
0
1
0
0
python
0
9,739,990
0
2
0
true
0
0
Sounds like you have a stand-alone program that reads from stdin, and you want to automate input to it using python. Download and use the pexpect module, that's what it's for.
1
1
0
0
I have a python script say script1.py. It will prompt the user with a serious of questions like Name, 'Y' / 'N' type questions. Now i need to call this python script from another python script,say scripts2.py such that I would define the user inputs in script2.py. So how to pass the input sequentially??? Help would be appreciated. Regards, Sujith
Python : Automate the user input data(Multiple sequential inputs)?
0
1.2
1
0
0
751
9,739,963
2012-03-16T15:22:00.000
2
0
1
0
0
python
0
9,740,014
0
4
0
false
0
0
You can seek() to a position and write a single byte. It will overwrite what's there, rather than inserting.
1
6
0
0
This is a theoretical question as I don't have an actual problem, but I got to wondering ... If I had a huge file, say many gigs long and I wanted to change a single byte and I knew the offset of that byte, how could I do this efficiently? Is there a way to do this without rewriting the entire file and only writing the single byte? I'm not seeing anything in the Python file api that would let me write to a particular offset in a file.
Python - Small Change to a Huge File
1
0.099668
1
0
0
1,583
9,752,891
2012-03-17T19:08:00.000
0
0
0
0
0
python,url,dynamic
0
9,753,135
0
1
0
true
1
0
If you parsing some product pages, usually these URLs have some kind of product id. Find the pattern to extract product id from URLs, and use it to filter already visited URLs.
1
0
0
0
I am crawling online stores for price comparison. Mot of the stores are using dynamic URLs heavily. This is causing my crawler to spend lot of time on every online stores. Even though most of them have only 5-6k unique products, they have unique URLs >= 300k. Any idea how to get around this. Thanks in advance!
How to handle dynamic URLs while crawling online stores?
0
1.2
1
0
1
205
9,763,675
2012-03-19T00:41:00.000
5
1
1
0
0
python
0
9,763,705
0
2
0
true
0
0
Opening the file in write/read mode (w+) will truncate the file without rewriting it if it already exists.
1
2
0
0
I want to basically copy whats from the clipboard and paste it in a file in utf-8 encoding, but what ever I try, the file has the '?' symbols in it and is Anscii encoding... But what I found out is, if there is a file that's already in utf-8 encoding, then whatever I paste in it manually (deleting whats there already), wont have the '?' in it. So if there is a way to clear content in a utf-8 file, then copy whats from the clipboard and write it to that file then that would be great. If I create the file, it's always ends up being Ancii... Now I already know how to copy from clip board and write it to a file, its just how to clear a file which is confusing...
How to erase all text from a file using python, but not delete/recreate the file?
1
1.2
1
0
0
12,883
9,764,895
2012-03-19T04:03:00.000
2
0
0
1
0
python,google-app-engine,coffeescript,go
0
9,764,949
0
2
0
true
1
0
Coffeescript compiles to Javascript, which can be run in a web browser. In that case, App Engine can serve up the resulting javascript. I don't know of any way to compile coffeescript to python, java or go though, so you can't use it as a server side language.
1
2
0
0
Does anyone know if it is possible to use Coffeescript on Google App Engine? If so how can this be done with the app engine Python or Go platforms?
How to use Coffeescript on Google App Engine
1
1.2
1
0
0
1,031
9,782,972
2012-03-20T07:42:00.000
6
0
0
0
0
python,pdf,pdf-scraping
0
9,803,283
0
4
0
false
0
0
This is a very complex problem and not solvable in general. The reason for this is simply that the format PDF is too flexible. Some PDFs are only bitmaps (you would have to do your own OCR then—obviously not our topic here), some are a bunch of letters literally spilled out over the pages; this means that by parsing the text information in the PDF you could get single characters placed on some coordinates. In some cases these come in an orderly fashion (line by line, from left to right), but in some cases you will get rather random-like distributions, most commonly with and stuff, but also special characters, characters in a different font etc. can come way out of line. The only proper approach is to place all characters according to their coordinates on a page model and then use heuristics to find out what the lines are. I propose to have a look at your PDFs and the tables therein you want to parse before starting. Maybe they are alike all the time and well-parsable. Good luck!
1
4
0
0
I am working on a pdf file. There is number of tables in that pdf. According to the table names given in the pdf, I wanted to fetch the data from that table using python. I have worked on html, xlm parsing but never with pdf. Can anyone tell me how to fetch tables from pdf using python?
Working on tables in pdf using python
0
1
1
0
0
12,830
9,788,264
2012-03-20T13:58:00.000
0
0
0
1
0
django,google-app-engine,github,development-environment,python-2.7
0
9,793,302
0
1
1
true
1
0
I'm on a pretty similar setup, though I'm still runing on py2.5, django-nonrel. 1) I usually use 'git status' or 'git gui' to see if I forgot to check in files. 2) I personally don't check in my datastore. Are you familiar with .gitignore? It's a text file in which you list files for git to ignore when you run 'git status' and other functions. I put in .gaedata as well as .pyc and backup files. To manage the database I use "python manage.py dumpdata > file" which dumps the database to a json encoded file. Then I can reload it using "python manage.py loaddata". 3) I don't know of any deploy from git. You can probably write a little python script to check whether git is up to date before you deploy. Personally though, I deploy stuff to test to make sure it's working, before I check it in.
1
1
0
0
Here is my current setup: GitHub repository, a branch for dev. myappdev.appspot.com (not real url) myapp.appspot.com (not real url) App written on GAE Python 2.7, using django-nonrel Development is performed on a local dev server. When I'm ready to release to dev, I increment the version, commit, and run "manage.py upload" to the myappdev.appspot.com Once testing is satisfactory, I merge the changes from dev to main repo. I then run "manage.py upload" to upload the main repo code to the myapp.appspot.com domain. Is this setup good? Here are a few issues I've run into. 1) I'm new to git, so sometimes I forget to add files, and the commit doesn't notify me. So I deploy code to dev that works, but does not match what is in the dev branch. (This is bad practice). 2) The datastore file in the git repo causes issues. Merging binary files? Is it ok to migrate this file between local machines, or will it get messed up? 3) Should I be using "manage.py upload" for each release to the dev or prod environment, or is there a better way to do this? Heroku looks like it can pull right from GitHub. The way I'm doing it now seems like there is too much room for human error. Any overall suggestions on how to improve my setup? Thanks!
Google App Engine Development and Production Environment Setup
0
1.2
1
0
0
398
9,796,643
2012-03-20T23:38:00.000
11
0
1
0
0
python,garbage-collection,python-3.x,destructor
0
9,796,689
0
3
0
true
0
0
Python doesn't make any guarantees about when __del__ is called, or whether it is called at all. As it is, __del__ methods are unlikely to be called if the object is part of a reference cycle, because even if the cycle as a whole is cleaned up, Python has no way to decide where to break the cycle and in what order the __del__ methods (if any) should be called. Because of __del__'s rather quirky semantics (in order to call __del__ the refcount of the object is temporarily increased, and the __del__ method can prevent destruction of the object by storing the reference somewhere else) what happens in other implementations is a bit of a crapshoot. (I don't remember the exact details in current Jython, but it has changed a few times in the past.) That said, in CPython, if __del__ is called, it's called as soon as the reference count drops to zero (since refcounting is the only way __del__ methods are called, and the only chance CPython has of calling __del__ is when the actual refcount is changed.)
1
4
0
0
How soon after the reference count reaches zero is __del__ method called? Does the language promise that it's done right away, before any other use code can execute? Or can each implementation do what it likes, potentially delaying the call to __del__ arbitrarily long? Please ignore the situation when the program is about to exit (I assume it means the last statement in the given block has finished, and the stack is empty). I understand that in such cases, there's no promises about __del__; it may not even be called at all. Also, I'm aware that reference count may be non-zero due to cycles, etc. I am not concerned about that here (I'm asking a separate question about it).
how soon is `__del__` called after reference count drops to zero?
0
1.2
1
0
0
743
9,807,215
2012-03-21T15:01:00.000
0
0
1
0
1
java,python,abstract-class,jython
1
9,993,155
0
1
0
false
0
0
Code would really be needed, but my gut feeling is, that your system has access to the compiled .class file from Jython but not the .py source file
1
1
0
0
We need to use in Java written software some Python subclasses of an abstract Python class. Trying to do it with Jython we had some troubles that we haven't experienced importing not-abstract Python classes. More specifically, the error that we get is this the source attachment is not contain the source for the file PyTableCode.class Does anybody knows how to fix this issue?
How to import in Java Python subclasses that use abstract methods of other classes?
0
0
1
0
0
189
9,808,250
2012-03-21T15:56:00.000
1
0
0
1
0
android,python,http,google-app-engine
0
9,808,831
0
1
0
false
1
0
You don't seem to have understood how web applications work. They don't wait for signals - or, rather, that's all they do. Every page served by a Web service is in response to a signal, ie a request. Your web service just needs to respond to normal requests in the normal way.
1
0
0
0
I don't know how to present the title more clearly. I want build a site on Google app engine (GAE), and one app on android. The site on GAE should wait the signal which is from the app on android and handle the signal to do something. I don't know how to search the "keyword" on Google of waiting signal on GAE, or what method should I use. Is here have anyone who have some related experiment on it ? Thank you very much.
GAE wait response from other source
0
0.197375
1
0
0
68
9,812,084
2012-03-21T20:10:00.000
0
0
1
0
0
c#,python,vb.net,visual-studio
0
9,812,140
0
5
0
false
0
0
If the arguments are of a different type you could overload the method Alternatively, you can just pass in a value indicating the sequence of arguments and have logic within the method to treat it accordingly.
1
0
0
0
In C#, Python and/or VB.NET, how can I write a method of a class that can accept different sequences of arguments? As an indication, the multiple choices of arguments sequence would be accessible when pressing shift+shift+space in Visual Studio.
How do I define a method which can accept different sequences of arguments?
0
0
1
0
0
290
9,826,322
2012-03-22T16:16:00.000
1
1
0
0
0
python,django,deployment,distutils,project-organization
0
9,826,658
0
1
0
true
1
0
There's different philosophies on how apps should be packaged, but most Python developers adhere to a very minimalistic approach. In other words, you package up the smallest units of logic you can. So, your goal here shouldn't be to cram everything together, but to package each discrete application separately. By application, here, I don't mean necessarily each Django app, although breaking out some of the apps into their own packages may be worthwhile as well. This is really all about reusability. Any piece that could serve a purpose in some other scenario should get its own package. Then, you can set them up to have dependencies on whatever other packages they require.
1
0
0
0
We have multiple Python projects that have dependencies on each other. Hierarchically, these are organized like this: P1 P2 ... Pn Each of these is an PyDev project within Eclipse and they co-exist just fine within that environment. We are in the process of structuring out build process to enable us to deploy these and distribute these in a more systematic fashion. Currently, we just zip up these projects and copy them over for deployment. I need some advice on how to go about this task using distutils. Our objective is to have a script to build a zip file (or tar file) using distutils that contains all the necessary code and necessary data/properties from the projects P1 through Pn. We should then be able to deploy this with setup.py and having our DJango-based web layer access it. My first attempt is to create a project whose sole purpose is to build the deployment artifacts. This will sit parallel to the projects P1 through Pn, called PBuild. Does this seem reasonable? I'm having some issues with this approach. Does anybody have any other ideas of how to do this?
Multiple Python projects organization for deployment and/or distribution
0
1.2
1
0
0
180
9,861,344
2012-03-25T15:26:00.000
1
0
0
0
0
python,mongodb,openshift
0
9,862,914
0
2
0
false
0
0
You could write a python script using pymongo (or any other mongodb client library) that does the necessary cleanup and configure cron to run it regularly.
1
1
0
0
I have a python web app that essentially allows 2 computers to talk with one another. If a session ends abruptly the record is still stored in pymongo, I want to be able to run a cron job to clean up old records, but I am not clear on how to do that, can't figure how to use bash to talk to pymongo... What else could I do, call python from the cron job?
Openshift, python, mongodb, and cron guidance needed
0
0.099668
1
0
0
457
9,864,843
2012-03-25T23:01:00.000
2
0
0
0
0
python,qt,model,pyqt,pyqt4
0
9,864,880
0
1
0
true
0
1
Set the QTableModel as the model for each QListView, and use QListView.setModelColumn to choose which column they each display.
1
2
0
0
Salut, community! Briefly. I wrote usual model over QAbstractTableModel and using it in usual way for QTableView. But I think I need to use some columns of this model for the few QListViews in QWizard to fill main table in the right way (for user). For example: use the column2 as the QListView's model on the page1 of the wizard; column3 for page2 for its QListView etc. Please, help me to understand just two things: Am I on the right way? If yes then how can I make it simply and explicitly?
QAbstractTableModel as a model for one QTableView and few QListViews
0
1.2
1
0
0
371
9,868,711
2012-03-26T08:16:00.000
2
1
1
0
0
python,eclipse,pydev
0
13,807,754
0
4
0
false
0
0
On a Mac, I can get to the PyDev settings via: Eclipse → Preferences → PyDev (in tree) → Editor (subtree) In my case, I wanted to change hash tag comments from nearly invisible grey to a better color. It worked like a charm.
2
12
0
0
In Eclipse, how can I change default font for Python code in the editor (PyDev plugin)? I navigate to menu Window → Preference → General → Appearance → Colors & Fonts, but I don't find which item would affect the Python code font.
How do I change the default font for Python code in Eclipse?
0
0.099668
1
0
0
16,217
9,868,711
2012-03-26T08:16:00.000
2
1
1
0
0
python,eclipse,pydev
0
9,883,196
0
4
0
false
0
0
Following the guidance of gecco, I found out the item in General → Appearance → Colors & Fonts which affects Python code fonts. It's Text Font in the Basic folder.
2
12
0
0
In Eclipse, how can I change default font for Python code in the editor (PyDev plugin)? I navigate to menu Window → Preference → General → Appearance → Colors & Fonts, but I don't find which item would affect the Python code font.
How do I change the default font for Python code in Eclipse?
0
0.099668
1
0
0
16,217
9,872,029
2012-03-26T12:22:00.000
1
0
0
1
1
python,google-app-engine,types
0
9,885,834
0
1
0
true
1
0
When browser renders html it thinks that <type 'str'> is a (unknown) tag, so it renders it as <type 'str'></type>, hence it becomes part of your page markup... You can see this with Firebug or any similar tool.
1
0
0
0
For debug use I want to show the type of a variable in Google App Engine. In traditional environment, I will use "print type( x )" to do it. But in GAE I just don't know why I can't use self.response.out.write( str( type( x ) ) ) to echo it in the browser. I got confused because I did transform the <type 'type'> to < type 'str' >. Since that doesn't work I have to use self.response.out.write( str( type( x) == type( "123" ) ) ) instead of directly echoing the type. So what did I miss in thinking? I am also using logging module to echo the type which works well. But I still want to know why self.response.out.write( ) doesn't work. Thanks all for help!!
how to show an object's type in google app engine
1
1.2
1
0
0
89
9,873,626
2012-03-26T14:05:00.000
3
0
1
0
0
python,algorithm
0
9,873,885
0
5
0
false
0
0
Use a loop (int i=0; i < m; i++) Then to get the indexes you want, Ceil(i*m/n).
1
12
1
0
I have a vector/array of n elements. I want to choose m elements. The choices must be fair / deterministic -- equally many from each subsection. With m=10, n=20 it is easy: just take every second element. But how to do it in the general case? Do I have to calculate the LCD?
Choose m evenly spaced elements from a sequence of length n
0
0.119427
1
0
0
11,243
9,886,494
2012-03-27T09:13:00.000
0
1
0
0
1
python,django,shipping,satchmo
0
14,647,712
0
1
0
true
0
0
it seems like the tieredweight shipping module is what I need here.
1
0
0
0
I'm taking over a Satchmo site and need it to charge a different shipping rate for international versus local postage. Any idea what I need to do to enable this?
Different national and international shipping rate in Satchmo?
0
1.2
1
0
0
84
9,893,317
2012-03-27T16:04:00.000
0
0
1
0
1
python,pypy
0
68,372,961
0
3
0
false
0
0
install Chocolatey choco install python.pypy -y
2
15
0
0
I was wondering how to use PyPy 1.8 on Windows XP 32-bit. I downloaded the zip file off the website and installed it into a My Documents file. Initially, I thought it was similar to psyco in that I had to "import psyco," but I found that PyPy.exe acted like the Python command line instead. I tried dragging my scripts into the PyPy.exe to run them, but it didn't seem to work at all. Attempting to use the "python" command within PyPy yielded a "global name 'python' is not defined." So I was hoping if someone can assist me in making PyPy run because I'm pretty much out of ideas. The documentation on the PyPy website confused me mainly and was not very helpful. Ans: I found that I could simply right-click the script and "Open with" Pypy.exe to make it work. Not sure why it didn't work with the drag since I thought that was equivalent. Thanks everyone.
How to use PyPy on Windows?
0
0
1
0
0
24,210
9,893,317
2012-03-27T16:04:00.000
9
0
1
0
1
python,pypy
0
9,895,099
0
3
0
true
0
0
Maybe I'm not following what you're trying to do, but isn't it just a question of opening a command prompt and running pypy myscriptname ? Assuming you've got all the paths for PyPy and your script straight, anyway (e.g. your script's in PyPy's folder).
2
15
0
0
I was wondering how to use PyPy 1.8 on Windows XP 32-bit. I downloaded the zip file off the website and installed it into a My Documents file. Initially, I thought it was similar to psyco in that I had to "import psyco," but I found that PyPy.exe acted like the Python command line instead. I tried dragging my scripts into the PyPy.exe to run them, but it didn't seem to work at all. Attempting to use the "python" command within PyPy yielded a "global name 'python' is not defined." So I was hoping if someone can assist me in making PyPy run because I'm pretty much out of ideas. The documentation on the PyPy website confused me mainly and was not very helpful. Ans: I found that I could simply right-click the script and "Open with" Pypy.exe to make it work. Not sure why it didn't work with the drag since I thought that was equivalent. Thanks everyone.
How to use PyPy on Windows?
0
1.2
1
0
0
24,210
9,899,180
2012-03-27T23:32:00.000
1
0
1
0
0
python,python-3.x,cloud
0
9,899,346
0
3
0
false
1
0
I haven't tried myself. You may want to check out ipython notebook.
1
0
0
0
Is there any way in a browser, to type python code into an input field, it will then be sent to a local server and executed and the result pushed back to the browser. Basically a browser hosted python notebook, where the code gets evaluated on a different machine. Is there any python package to do this. something like what ideone.com or picloud do, but opensource and that can install on your own server. Or any suggestions on how to do it, I have looked around already but have struggled to find something meaningful.
cloud scripting through browser and evaluate python on server
0
0.066568
1
0
1
92
9,899,313
2012-03-27T23:48:00.000
2
1
1
0
0
python,beautifulsoup,mechanize
0
9,899,341
0
1
1
false
0
0
Use a dict or set. Consider computing a checksum of each item. This brings you toward what's known as Content Addressable Storage, which is where the checksum actually is stored as if it were the item's "name", and a separate index is stored which maps things like filenames or song names to the checksums or data blocks. The problem with the CAS approach in your particular case is that it may not be possible for you to get a checksum computed on the remote side for new content--that's how programs like rsync avoid copying duplicate data.
1
1
0
0
This isn't as much of a specific problem as something I am looking for more of a "Pythonic" philosophical answer to. Namely, what's the best way to keep track of unique items and ensure duplicates don't arise? For example, I am writing a script to scrape a website for links to songs on SoundCloud so I can automatically download them. If I want to automate this program with, say, cron, what's the most efficient way to ensure that I am downloading only content I don't have already? Or if I downloaded images, how could I make sure that there aren't any duplicates, or have some sort of process that searches for and removes duplicates efficiently? Kind of open ended, so contribute as little or as much as you please. Thanks.
What is the most efficient way to keep track of unique downloaded files in a Python program?
0
0.379949
1
0
0
214
9,916,873
2012-03-28T22:58:00.000
0
0
1
0
0
python,exception,gevent
1
17,853,380
0
2
0
false
0
0
You can use spawn_link_exception instead of spawn.
1
2
0
0
i'm working with an application written in python using gevent. i want it to exit immediately as a result of any exception that i haven't explicitly trapped. it looks like i'd have to patch the core gevent code. is there any way can i do this in my app, without patching gevent or greenlet?
how can i make gevent application exit immediately after any exception?
1
0
1
0
0
1,560
9,921,057
2012-03-29T07:41:00.000
0
0
1
0
0
java,python,math
0
9,921,123
0
2
0
false
0
0
You can use the built-in function round: round(3.5) gives 4.0 round(3.4) gives 3.0 round(3.6) gives 4.0
1
1
0
0
Does an analogue to Java's Math.rint exist in Python? If not, how can I achieve the same result?
Rounding numbers: Java's 'Math.rint' in Python
0
0
1
0
0
1,638
9,926,825
2012-03-29T13:54:00.000
0
0
0
0
1
python,amazon-web-services
0
9,928,772
0
4
0
false
1
0
Don't put it in applications you plan to distribute. It'll be visible and they can launch instances that are directly billable to you or worst..they can take down instances if you use it in production. I would look at your programs design and seriously question why I need to include that information in the app. If you post more details on the design I'm sure we can help you figure out a way in which you don't need to bundle this information.
1
11
0
0
I'm making an application in Python and using Amazon Web Services in some modules. I'm now hard coding my AWS access id and secret key in *.py file. Or might move them out to an configuration file in future. But there's a problem, how can I protect AWS information form other people? As I know python is a language that easy to de-compile. Is there a way to do this? Well what I'm making is an app to help user upload/download stuff from cloud. I'm using Amazon S3 as cloud storage. As I know Dropbox also using S3 so I'm wondering how they protects the key. After a day's research I found something. I'm now using boto (an AWS library for python). I can use a function of 'generate_url(X)' to get a url for the app to accessing the object in S3. The url will be expired in X seconds. So I can build a web service for my apps to provide them the urls. The AWS keys will not be set into the app but into the web service. It sounds great, but so far I only can download objects with this function, upload doesn't work. Any body knows how to use it for uploading? Does anyone here know how to use key.generate_url() of boto to get a temporary url for uploading stuff to S3?
How can I protect my AWS access id and secret key in my python application
0
0
1
0
1
6,307
9,927,821
2012-03-29T14:48:00.000
0
1
0
0
1
python,user-interface,wxpython,pyqt,tkinter
0
9,928,114
0
4
0
false
0
0
Basically you just need to figure out what widgets will hold the data you want the best. I suspect you could use a couple combo boxes to hold different sets of extensions. Or you could just use the path name strings to figure that out. Hit a button and run the conversion process, probably in another thread so the GUI remains responsive. I'm biased for wxPython. However, you're better off taking a look at their demos and documentation and seeing which GUI toolkit fits your brain the easiest.
3
3
0
0
I have a command-line Python script that works well to convert one sort of file into another given a few parameters and would now like to deploy this to some of my colleagues who may not know what a command line is. I could work for hours trying to determine which Python GUI toolkit is "best", then learning how to do what I need, but it seems like this would have been done before. Is there a relatively cook-book method to GUIify my program? Direction to either some sort of lesson/tutorial or an existing, documented, concise program would be excellent.
Cookbook GUI interface for a command-line script
0
0
1
0
0
4,233
9,927,821
2012-03-29T14:48:00.000
1
1
0
0
1
python,user-interface,wxpython,pyqt,tkinter
0
9,934,956
0
4
0
false
0
0
There are a few answers advocating wxpython. However, any toolkit will work for this project. Tkinter has the added benefit tha you and your collegues already have it installed and it is very easy to use. That being said, the other toolkits are more-or-less equally easy to use but you might have to jump through a hoop or two to get them installed. If installation is not an issue it won't matter which one you pick. Unfortunately, telling you how to "GUIfy" your program is hard since we know nothing about your app. Probably all it will involve is putting up a few labels and input widgets, then creating a button that collects all the data and then runs your program with the subprocess module.
3
3
0
0
I have a command-line Python script that works well to convert one sort of file into another given a few parameters and would now like to deploy this to some of my colleagues who may not know what a command line is. I could work for hours trying to determine which Python GUI toolkit is "best", then learning how to do what I need, but it seems like this would have been done before. Is there a relatively cook-book method to GUIify my program? Direction to either some sort of lesson/tutorial or an existing, documented, concise program would be excellent.
Cookbook GUI interface for a command-line script
0
0.049958
1
0
0
4,233
9,927,821
2012-03-29T14:48:00.000
0
1
0
0
1
python,user-interface,wxpython,pyqt,tkinter
0
9,928,262
0
4
0
false
0
0
This depends mostly on your need. If your need is simple, you can just go with tkinter that is bundled with python itself. If you use this, you will not be relying on third party library to implement your GUI. Since you are wanting to make this available for your collegues, this might be easier to compile with py2exe or other similar stuffs to exe which might be tricky if you use third party library for GUI. However, if you want to add more functionality to your GUI, wxpython/pyqt/pyGTK are the GUI toolkit to look for. Personally, I favor wxpython due to its cross-platform nature but pyqt and pyGTK are also equally good as far as I have heard.
3
3
0
0
I have a command-line Python script that works well to convert one sort of file into another given a few parameters and would now like to deploy this to some of my colleagues who may not know what a command line is. I could work for hours trying to determine which Python GUI toolkit is "best", then learning how to do what I need, but it seems like this would have been done before. Is there a relatively cook-book method to GUIify my program? Direction to either some sort of lesson/tutorial or an existing, documented, concise program would be excellent.
Cookbook GUI interface for a command-line script
0
0
1
0
0
4,233
9,979,602
2012-04-02T15:55:00.000
23
0
1
0
0
python
0
9,979,626
0
10
0
true
0
0
Put them in a list, sort them, pick the middle one.
1
8
0
0
Given 3 numbers, I need to find which number lies between the two others. ie,given 3,5,2 I need 3 to be returned. I tried to implement this by going thru all three and using if else conditions to check if each is between the other two.But this seems a naive way to do this.Is there a better way?
how to find the middle number in python
0
1.2
1
0
0
55,236
9,991,838
2012-04-03T10:56:00.000
4
0
1
0
1
python,linux,shell,ipython,line-breaks
0
9,991,864
0
3
0
true
0
0
Nothing is the problem. Python code is executed line-by-line. If your code does not work when executed line-by-line, it should not work when loaded from a file (assuming in both cases a "clean" environment).
2
8
0
0
Hi I'm new to Linux and I really like the idea of writing and testing python code in a shell. But my problem is how can I do line breaks in IPython. Every time I use the (I think) "normal" shortcut shift+enter the code gets executed. Function keys are disabled and keyboard layout works fine on my laptop, what could be the problem?
Linux - Linebreak in IPython
0
1.2
1
0
0
7,327
9,991,838
2012-04-03T10:56:00.000
7
0
1
0
1
python,linux,shell,ipython,line-breaks
0
9,992,118
0
3
0
false
0
0
If you want to do a line-break, you end the line with the \ escape character, same as you do in a Python file. Shift+Enter doesn't have any special meaning in ipython, and indeed most over places in the shell. It doesn't have special meaning in Python, either. It does have special meaning in some text editors and word processors, most notably LyX and LibreOffice, and of course on some websites (through a web browser).
2
8
0
0
Hi I'm new to Linux and I really like the idea of writing and testing python code in a shell. But my problem is how can I do line breaks in IPython. Every time I use the (I think) "normal" shortcut shift+enter the code gets executed. Function keys are disabled and keyboard layout works fine on my laptop, what could be the problem?
Linux - Linebreak in IPython
0
1
1
0
0
7,327
9,995,041
2012-04-03T14:10:00.000
1
0
0
0
0
python,django
0
9,995,337
0
3
0
false
1
0
I certainly use class methods, and I have found that where there are similar operations to be performed on classes, it is possible (and easy) to factor the classmethods into base classes (use the self parameter of your class method to write generic code). Probably the best way to manage broken-up views, etc is to replace each file you want to break up with its own package, and put whatever you need to (if anything) into that package's __init__.py module.
2
4
0
0
I have a Django project which is getting more and more complex. I started off with the traditional files: models, views, and forms.py. The issue I have right now is that those files are getting bigger and bigger and I'd like to break them into manageable parts. What are the best practices around that? In addition, I am wondering if it is best practice to add class method to a model in Django? For instance, I have a Vote class on which I would like to add methods to get the number of votes for a specific user, content, etc?
How to structure complex Django project?
0
0.066568
1
0
0
1,093
9,995,041
2012-04-03T14:10:00.000
2
0
0
0
0
python,django
0
9,997,876
0
3
0
true
1
0
I find refactoring can really help. Are there a lot of similar views that just have different templates or querysets? Make a more generic view that accepts multiple template names, records, etc. Anything that requires extensive calculations gets moved to a utils.py in the same directory. Class methods are for actions that affect a single record; managers are for dealing with filtering records or creating a record. If you're already taking the step of making separate models, views, etc. folders and breaking views and models into separate files, that suggests to me that you could separate them out into separate apps. I like that as an option much better.
2
4
0
0
I have a Django project which is getting more and more complex. I started off with the traditional files: models, views, and forms.py. The issue I have right now is that those files are getting bigger and bigger and I'd like to break them into manageable parts. What are the best practices around that? In addition, I am wondering if it is best practice to add class method to a model in Django? For instance, I have a Vote class on which I would like to add methods to get the number of votes for a specific user, content, etc?
How to structure complex Django project?
0
1.2
1
0
0
1,093
10,002,771
2012-04-03T23:09:00.000
2
1
0
0
0
python,django,ssh
0
10,003,264
0
1
0
false
1
0
You're close. The problem here is probably that your web server runs as a non-privileged user (NOT root), like www or www-data or nobody (depending on your operating system). While that user can probably run the SSH binary, when doing so as nobody, it probably doesn't have a home directory, can't find your .ssh directory, and can't find the key file (.ssh/id_rsa for example) that it needs to use for authentication. You have a number of options. Make your private key available to the web server software, then launch ssh with the -i option to select an identity file. Or do this in an SSH config file that you specify with the -F option. Or launch ssh using sudo, and give your web server software the ability to run ssh as some other (shell) user. I can't provide a more specific answer because you haven't provided specifics in your question. Operating system, sample code, etc. Hope this helps. Oh, and you should also consider NOT doing this, and finding some other solution. A web application, even an internal one, that has SSH access to your firewall? Sounds like a recipe for eventual disaster to me. :-)
1
0
0
0
I acquired a python script that will either telnet to some equipment, or if the equipment is in a lab, ssh to a firewall machine and then it will telnet to the equipment, and run a command, returning the output for more processing. I took this script and tied it into a Django web app so that I could, from a browser, fill out a form with the target system info and have it display the results. If I start up this web app from the command line, and then access it from the browser (python manage.py app), everything works fine. However, if I set this up to run in "production" mode, using a virtual host with Apache, the SSH fails. I suspect that this is running under root or some web account and cannot SSH to the firewall. Can someone suggest how I get this to work? I don't have any privileges on the firewall machine, so I can't setup SSH to run under some web account. Would I need to collect username and password from the user, in the case where SSH is used, and then pass it to ssh, or are there other ways to get the telnet info and command through to the equipment?
need to ssh to remote machine from web page with python/django
0
0.379949
1
0
0
2,644
10,003,232
2012-04-04T00:08:00.000
6
0
1
0
0
python,matrix,linear-algebra
0
10,003,296
0
2
0
false
0
0
The rule of Sarrus is only a mnemonic for solving 3x3 determinants, and won't be as helpful moving beyond that size. You should investigate the Leibniz formula for calculating the determinant of an arbitrarily large square matrix. The nice thing about this formula is that the determinant of an n*n matrix is that it can be determined in terms of a combination of the determinants of some of its (n-1)*(n-1) sub-matrices, which lends itself nicely to a recursive function solution. If you can understand the algorithm behind the Leibniz formula, and you have worked with recursive functions before, it will be straightforward to translate this in to code (Python, or otherwise), and then you can find the determinant of 4x4 matrices and beyond!
1
3
1
0
I'm making a small matrix operations library as a programming challenge to myself(and for the purpose of learning to code with Python), and I've come upon the task of calculating the determinant of 2x2, 3x3 and 4x4 matrices. As far as my understanding of linear algebra goes, I need to implement the Rule of Sarrus in order to do the first 2, but I don't know how to tackle this Pythonically or for matrices of larger size. Any hints, tips or guides would be much appreciated.
Python determinant calculation(without the use of external libraries)
0
1
1
0
0
3,244
10,006,017
2012-04-04T06:34:00.000
2
0
1
0
0
python,logging
0
10,023,080
0
2
0
false
0
0
I think there is no magic scanning here. Try to test it this way in a separate test directory: test/main.py: import logging logging.info('test') test/any.py: import logging logging.basicConfig(filename='test.log', level=logging.INFO) python main.py Result: NO test.log file. Now let's update the test: test/main.py: import logging import any logging.info('test') python main.py Result: new test.log file with INFO:root:test string inside. So I guess that any.py in your case is imported somehow, despite your expectations. You may find the way any.py is imported easily, just add few lines there: test/any.py: from traceback import print_stack print_stack() ... python main.py Result: File "main.py", line 2, in import any File "any.py", line 2, in print_stack() This stack shows that any.py is imported from main.py. I hope you will find where it is imported from in your case.
1
2
0
0
I used to Python logging, it works fine. The logging.basicConfig(...) set in one module (a some.py file), then we can use logging every where. Obviously, logging is global. The question is how logging find it's settings, when we not call the module where basicConfig(...) appeared (in some.py file )? Is logging scan all the packages? Even the logging.basicConfig(...) put into an any.py and the module (any.py) never get imported, or not used anywhere, the logging setting take effect!
How python logging get it's configuration
0
0.197375
1
0
0
727
10,009,660
2012-04-04T10:53:00.000
9
0
0
1
1
python,installation,py2exe
0
10,009,715
0
2
0
false
0
0
Py2exe has to run on Windows, you can not run it in Linux. (Maybe wine can help, but I'm not sure)
1
9
0
0
I downloaded the actual py2exe package. But I've no idea how to get it in my system. I mean I can follow the tutorial a 100% but I can't find anything how to install py2exe to my kubuntu 11.10. I also can't find a py2exe.py which I could include to my workingfolder. Could some please help me the project has to be finish till tomorrow? Thanks for your help cheers, Chris
How to install the py2exe modul in Linux
0
1
1
0
0
23,189
10,017,645
2012-04-04T19:06:00.000
1
1
0
0
0
python,database,django,apache,mod-wsgi
0
10,020,054
0
1
0
true
1
0
First up, look at daemon mode of mod_wsgi and don't use embedded mode as then you can control separate to Apache child processes the number of Python WSGI application processes. Secondly, you would be better off putting the memory hungry bits in a separate backend process. You might use XML-RPC or other message queueing system to communicate with the backend processes, or even perhaps see if you can use Celery in some way.
1
2
0
0
I'm writing a Oracle of Bacon type website that involves a breadth first search on a very large directed graph (>5 million nodes with an average of perhaps 30 outbound edges each). This is also essentially all the site will do, aside from display a few mostly text pages (how it works, contact info, etc.). I currently have a test implementation running in Python, but even using Python arrays to efficiently represent the data, it takes >1.5gb of RAM to hold the whole thing. Clearly Python is the wrong language for a low-level algorithmic problem like this, so I plan to rewrite most of it in C using the Python/C bindings. I estimate that this'll take about 300 mb of RAM. Based on my current configuration, this will run through mod_wsgi in apache 2.2.14, which is set to use mpm_worker_module. Each child apache server will then load up the whole python setup (which loads the C extension) thus using 300 mb, and I only have 4gb of RAM. This'll take time to load and it seems like it'd potentially keep the number of server instances lower than it could otherwise be. If I understand correctly, data-heavy (and not client-interaction-heavy) tasks like this would typically get divorced from the server by setting up an SQL database or something of the sort that all the server processes could then query. But I don't know of a database framework that'd fit my needs. So, how to proceed? Is it worth trying to set up a database divorced from the webserver, or in some other way move the application a step farther out than mod_wsgi, in order to maybe get a few more server instances running? If so, how could this be done? My first impression is that the database, and not the server, is always going to be the limiting factor. It looks like the typical Apache mpm_worker_module configuration has ServerLimit 16 anyways, so I'd probably only get a few more servers. And if I did divorce the database from the server I'd have to have some way to run multiple instances of the database as well (I already know that just one probably won't cut it for the traffic levels I want to support) and make them play nice with the server. So I've perhaps mostly answered my own question, but this is a kind of odd situation so I figured it'd be worth seeing if anyone's got a firmer handle on it. Anything I'm missing? Does this implementation make sense? Thanks in advance! Technical details: it's a Django website that I'm going to serve using Apache 2.2.14 on Ubuntu 10.4.
Maximizing apache server instances with large mod_wsgi application
0
1.2
1
1
0
214
10,018,767
2012-04-04T20:29:00.000
0
0
0
0
0
python,pygtk
0
10,057,082
0
1
0
false
0
1
If you want to display an image and allow the user to select and move parts of it, you best look for a ready-made image editing widget. GTK doesn't come with one. To roll your own you can use an image widget for display, but it doesn't care about the mouse, so you can place it inside an event box and connect to button and movement events. You'll have to handle all the drawing of rectangle, walking ants and floating cutout yourself in the pixbuf backing the image. It might be easier to start from scratch with an empty event box and draw even the image yourself.
1
0
0
0
What I'm wanting to do is create a selection tool (like what you see in most paint programs) using PyGtk. I've seen a previous question that asked something similar, but they already seemed to know what they were doing to make the selection itself. That user said he was using an eventbox, but I don't know how I would use that to accomplish what I am trying to do. How would the eventbox work with a selection? The algorithm for the rectangle isn't a problem at all, I just need to know what tools I should be using to actually select a part of a picture and be able to move it around. This is my first time using PyGtk, and I'm also fairly new to python itself, so any help would be great.
How do I create a canvas selection tool?
0
0
1
0
0
212
10,020,389
2012-04-04T22:52:00.000
-1
0
0
1
1
winapi,windows-7,python-3.x,block,pywin32
0
28,282,261
0
1
0
false
0
0
write a while loop Into the while loop write the command to taskkill dwm.exe It's a poor solution, but the only one I know. Regards!
1
0
0
0
This might be a more difficult question since I don't even know how to do it outside of Python... I want to write a terminal program that completely locks up my PC until a password is entered. In the locked state no one should be able to do anything outside the terminal. In it, the user may rampage and write silly commands, but he should not be able to switch windows, click outside of it, open the task manager, open the menu with Ctrl + Alt Gr + Del and so on. While searching for a way to accomplish this I've thought of two approaches that Python is also able to do: Modifying the registry -> can disable task manager and some other functions, but not the app switcher neither the menu Task-killing explorer.exe and dwm.exe -> killing explorer.exe just removed the taskbar, killing dwm.exe seems like the right way, but as it's the window manager it automatically boots up itself again as soon as it gets killed I know this is a kind of weird question and doesn't contain any code snippet, but the front-end is no problem and as said I don't even got a working approach for the back-end.
Completely locking down Windows 7 using Python 3.2?
0
-0.197375
1
0
0
545
10,031,427
2012-04-05T15:22:00.000
5
1
1
0
0
python,python-idle
1
10,031,501
0
1
0
true
0
0
The reason why this is sensible with LISP is that every LISP programs is just a bunch of macros and functions and the s-expressions can be formatted automatically into a nice representation. This isn't the case in Python, where you have more complex syntax (significant whitespace, decorators, lots of control structures, different types of string literals, ...) and more semantic elements (classes, functions, top-level code, ...), so this approach will not work very well here. The resulting code would get really messy for even the smallest of projects and the resulting code would still require a lot of "post-processing", somewhat annihilating the speed of development advantage. Instead, you can just write the code in a good text editor and Use built-in functionality to integrate it with the REPL (EMACS and Vim have good support for this kind of stuff) or load it into REPL using execfile, which will give you the comfort of good text editing and the interactivity of the prompt. along with the program, write a suite of unit tests. This is to be recommended for any non-trivial piece of software and automates the testing of your code, so you'll have to spend less time in an interactive prompt, manually checking if a function works correctly. You could also grab a more fully-featured IDE that supports code evaluation and full-blown debugging (PyDev is an example here, thanks to sr2222).
1
3
0
0
I'm not sure if I worded the subject correctly but essentially I'm curious if someone can develop code in the Python IDLE, or a similar tool, and then through some command spit out the current code in memory. I believe I did this previously when going through a Lisp book and recall it being a very different approach than the usual re-running of static files. Any suggestions as to how to do this or something similar? Thanks UPDATE I ended up using a combination of the IDLE using execfile and reload commands, while editing code in a separate editor (eclipse/pydev). I changed my "main" file so that nothing executes immediately when execfile is called on it. Code in the main file and modules imported are loaded into the current scope/stack so as I'm writing new code or an error occurs I can test directly in the IDLE command line. Once I have found the problem or way forward I then update code in editor, run reload(module) for updated modules, then execfile(path) on the main file.
Can a python IDLE be used for iterative/in-memory development?
0
1.2
1
0
0
199
10,033,953
2012-04-05T18:27:00.000
0
0
1
0
0
python,language-agnostic,duck-typing,dynamic-typing
1
10,034,420
0
4
0
false
0
0
If you are worried that the lack of static type checking will let some bugs get through, the answer isn't to bolt on type checking, it is to write tests. In the presence of unit tests, a type checking system becomes largely redundant as a means of catching bugs. While it is true that a type checking system can catch some bugs, it will only catch a small subset of potential bugs. To catch the rest you'll need tests. Those unit tests will necessarily catch most of the type errors that a type checking system would have caught, as well as bugs that the type checking system cannot catch.
1
4
0
0
I think understand the idea of duck typing, and would like to use it more often in my code. However, I am concerned about one potential problem: name collision. Suppose I want an object to do something. I know the appropriate method, so I simply call it and see what happens. In general, there are three possible outcomes: The method is not found and AttributeError exception is raised. This indicates that the object isn't what I think it is. That's fine, since with duck typing I'm either catching such an exception, or I am willing to let the outer scope deal with it (or let the program terminate). The method is found, it does precisely what I want, and everything is great. The method is found, but it's not the method that I want; it's a same-name method from an entirely unrelated class. The execution continues, until either inconsistent state is detected later, or, in the worst case, the program silently produces incorrect output. Now, I can see how good quality names can reduce the chances of outcome #3. But projects are combined, code is reused, libraries are swapped, and it's quite possible that at some point two methods have the same name and are completely unrelated (i.e., they are not intended to substitute for each other in a polymorphism). One solution I was thinking about is to add a registry of method names. Each registry record would contain: method name (unique; i.e., only one record per name) its generalized description (i.e., applicable to any instance it might be called on) the set of classes which it is intended to be used in If a method is added to a new class, the class needs to be added to the registry (by hand). At that time, the programmer would presumably notice if the method is not consistent with the meaning already attached to it, and if necessary, use another name. Whenever a method is called, the program would automatically verify that the name is in the registry and the class of the instance is one of the classes in the record. If not, an exception would be raised. I understand this is a very heavy approach, but in some cases where precision is critical, I can see it might be useful. Has it been tried (in Python or other dynamically typed languages)? Are there any tools that do something similar? Are there any other approaches worth considering? Note: I'm not referring to name clashes at the global level, where avoiding namespace pollution would be the right approach. I'm referring to clashes at the method names; these are not affected by namespaces.
Duck typing: how to avoid name collisions?
0
0
1
0
0
1,060
10,045,312
2012-04-06T15:03:00.000
1
0
1
0
0
python
0
10,045,462
0
1
0
false
0
1
You could consider the Scintilla text editing component, with bindings for Python (and other languages.) The Scintilla text editing widget is the basis for the SciTE text editor. SciTE supports code folding, so it is certainly doable - it may even be a built in part of Scintilla. From the SciTE website: Scintilla is a free source code editing component. It comes with complete source code and a license that permits use in any free project or commercial product. As well as features found in standard text editing components, Scintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips. The selection margin can contain markers like those used in debuggers to indicate breakpoints and the current line. Styling choices are more open than with many editors, allowing the use of proportional fonts, bold and italics, multiple foreground and background colours and multiple fonts. SciTE is a SCIntilla based Text Editor. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. It is best used for jobs with simple configurations - I use it for building test and demonstration programs as well as SciTE and Scintilla, themselves.
1
0
0
0
I'm learning Python and want to make a small text editor that would allow the code collapsing like when def a Function, how you can collapse that to a single line. I'm thinking of using Tkinter but would be open to other environments. I mainly want to know what widget I should use, I'd like to think that I'd be able to figure out how to do it. (Although an example is always welcome.) Thanks.
Python: How to program an IDE Code collapsing?
0
0.197375
1
0
0
200
10,047,020
2012-04-06T17:36:00.000
8
0
1
0
0
ipython
0
10,047,045
0
2
0
true
0
0
Doh, one has to click on the very slim divider line. The subframe then closes...
2
5
0
0
In an IPython notebook, when you look at some docs with ? or help(), a split frame is opened at the bottom of the screen where the documentation shows up. While I find this useful as a guide for continuing to play with some Python code, I would like to close this spit frame when I'm done reading the docs, so to get back the screen space. But I can't find instructions anywhere, not with Google and not in the IPython notebook docs how to do this? Anybody knows?
How to close the doc reading part of the IPython notebook?
0
1.2
1
0
0
613
10,047,020
2012-04-06T17:36:00.000
5
0
1
0
0
ipython
0
21,760,178
0
2
0
false
0
0
You have to press the q key. That works for me.
2
5
0
0
In an IPython notebook, when you look at some docs with ? or help(), a split frame is opened at the bottom of the screen where the documentation shows up. While I find this useful as a guide for continuing to play with some Python code, I would like to close this spit frame when I'm done reading the docs, so to get back the screen space. But I can't find instructions anywhere, not with Google and not in the IPython notebook docs how to do this? Anybody knows?
How to close the doc reading part of the IPython notebook?
0
0.462117
1
0
0
613
10,054,167
2012-04-07T11:45:00.000
2
0
0
0
0
python,opengl,freeglut
0
10,055,756
0
1
0
true
0
1
You don't. Remember: GLUT is primarily for test applications and demos. If your application is complex and platform-specific enough to need to change its icon, then you probably need to move beyond GLUT.
1
1
0
0
I am trying to learn OpenGL, and I'm using PyOpenGL and GLUT. What really bugs me, is that I can't figure out how to change the title bar icon. Has anyone had any success in changing this?
How do I replace the GLUT title bar icon when using pyopengl?
0
1.2
1
0
0
248
10,054,878
2012-04-07T13:24:00.000
1
0
0
0
0
python,active-directory,ldap
0
10,056,144
0
1
0
true
0
0
The search result contains: A list of search result entries. Each search result entry in the list contains the distinguished name of the entry and a (partial) attribute list or A list of search result references. Each search result reference contains a sequence of URIs After the entries or references comes a single search result done message. Therefore, if any entries matched, they are returned in the list of search result entries, each of which contains the distinguished name of the entry that was matched. Your python API documentation should contain information as to how to extract the distinguished name of the entry that matched.
1
0
0
0
I was able to get attributes about an user by doing queries on LDAP using Python ldap but I don't know how to obtain his DN. Remark: Doing CN=sAMAccount,base_dn) is not valid because the user can be somewhere in another sub-tree. Which is the proper way of getting the DN for an user for which I do have the sAMAccount?
How do I get the full DN, distinguishedName of an user with python ldap?
0
1.2
1
0
1
1,443
10,066,554
2012-04-08T21:11:00.000
0
0
0
1
1
python,windows,linux,isometric
1
10,067,738
0
3
0
false
0
0
This source code is over 5 years old and the build script for floyd looks to assume hard-coded python2.4. It seems pretty clear that your floyd module did not build. You will most likely have to go back to the build step and ensure that you are properly generating a _floyd.so. If you built it correctly, then this should not fail for you: python -c "import _floyd"
1
0
0
0
another question for all of you- So i am trying to get a program called Pysomap to work (its basically ISOMAP but for python[http://web.vscht.cz/spiwokv/pysomap/]), i follow the directions best as i can, building it on Ubuntu, Windows, and Fedora (prebuilt libraries), but cant seem to get it to work. On windows (which is the preferred implementation platform), every time i go to python and import pysomap, it gives me the above error. Anybody know how to solve this? Thanks -J
How to get program to not throw "Error: Can't load Floyd's algorithm library"
0
0
1
0
0
144
10,066,573
2012-04-08T21:14:00.000
5
0
0
0
0
python,sql,django
0
10,066,588
0
1
0
true
1
0
You really don't want to implement each question/answer as a separate DB field. Instead, make a table of questions and a table of answers, and have a field in the answers table (in general, a ForeignKey) to indicate which question a given answer is associated with.
1
0
0
0
I am developing an application designed for a secretary to use. She has a stack of hundreds of ballot forms which have a number of questions on them, and wishes to input this data into a program to show the total votes for each answer. Each question has a number of answers. For example: Q: "Re-elect current president of the board" A: Choice between "Yes" or "No" or "Neutral" Year on year the questions can change, as well as the answers, but the current application used in the company is hard coded with the questions and answers of last year. My aim is to create an app (in Django/Python) which allows the secretary to add/delete questions and answers as she wishes. I am relatively new to Django... I have created an app in University and know how to create basic models and implement the Twitter bootstrap for the GUI. But I'm a little confused about how to enable the secretary to add custom fields in (which are obviously defined in SQL). Does anyone have any small tips on how to get started? By the way, I recognize that this could be achievable using the admin part of website and would welcome any suggestions about that. Thank you.
Adding field to SQL table from Django Application
0
1.2
1
1
0
72
10,070,703
2012-04-09T08:26:00.000
2
0
0
0
0
python,python-2.7,web2py,web2py-modules
0
10,090,081
0
2
0
true
1
0
I would consider looking into webservices. If you could expose url from java, that will route to a method/function of java where logic is performed and it returns json object. While in web2py urllib2 you can make a request and decode that json into native python dictionary. The clue is that you would have to expose all the methods of objects and pass the object back and forth as json. Do not be scared in most programming lanugages objects are just hash_arrays/dictionaries with some special qualities. So if you can serialize and deserialize the object and expose apriopriate urls you will be fine. Also there is implementation of web2py in jython. But then the entire stack will be in JVM and i may be more complex to work with.
1
1
0
0
I have to implement one web2py application which has to access java code (which has code to connect to the remote machine) but not sure whether we can do it in web2py or not.My PC has Java 1.6, Python2.7 ,web2py ,eclipse installed. Use case is : I have created one button in web2py application and upon clicking the button, it should instantiate the java object and invoke particular method of that java object which will further connect to the remote machine. Doubts are: Can we deploy that particular java class to web2py server so web2py application can easily access it? Is it possible to import that class from python code? How to instantiate java object from python code? And how to invoke java method from python code? Regards, Piks
can we use java code in web2py application code?
1
1.2
1
0
0
632
10,084,379
2012-04-10T06:56:00.000
2
0
0
1
0
python,build,osx-lion,web2py
1
10,090,778
0
3
0
true
0
0
web2py works fine with Lion's stock Python 2.7. Unless you have a compelling reason to use 2.5, stick with 2.7.
2
1
0
0
Here is what I would like to do. Use web2py with MySQL. To do that, I need to use source web2py rather than web2py.app To use web2py, I need Python 2.5 I am having trouble building and installing Python 2.5 I downloaded Python-2.5.6.tgz from Python release page. Now, I did ./configure and then make Then, I get the following error. gcc -c -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c cc1: error: unrecognized command line option "-Wno-long-double" make: * [Modules/python.o] Error 1 Can anybody help me how to get rid of this error and install Python 2.5? Here is gcc I am using gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) Your help would be greatly appreciated. Thanks.
Python 2.5.6 build error on Mac Lion
0
1.2
1
0
0
483
10,084,379
2012-04-10T06:56:00.000
0
0
0
1
0
python,build,osx-lion,web2py
1
10,114,744
0
3
0
false
0
0
I have web2py on my iMac OSX Lion using the web2py app and MySQL. I haven't run into any reason why you can't use the app with MySQL.
2
1
0
0
Here is what I would like to do. Use web2py with MySQL. To do that, I need to use source web2py rather than web2py.app To use web2py, I need Python 2.5 I am having trouble building and installing Python 2.5 I downloaded Python-2.5.6.tgz from Python release page. Now, I did ./configure and then make Then, I get the following error. gcc -c -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c cc1: error: unrecognized command line option "-Wno-long-double" make: * [Modules/python.o] Error 1 Can anybody help me how to get rid of this error and install Python 2.5? Here is gcc I am using gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00) Your help would be greatly appreciated. Thanks.
Python 2.5.6 build error on Mac Lion
0
0
1
0
0
483
10,090,645
2012-04-10T14:27:00.000
1
0
1
0
0
python,sum
0
10,090,752
0
3
0
false
0
0
Open the files and use readline to open the files line by line. Check whether it is string or not. By looking at your file format, I assume everything in between two strings (Name1 and Name2 or else) are numbers so store those on list. Finally use sum(list) to get the output. I am not writing the code since this is "HOMEWORK".
1
0
0
0
I have to write a script that does this: Inputfile: Name 10 -43 54 Name2 654 43 2 -5467 Name3 65 65 Outputfile: Name 21 Name2 -4768 Name3 130 I came to the conclusion that I am supposed to split the input into arrays at the names and then print the first element and the sum of the rest, but I do not know how to do it and I haven't really found anything about this on the web.
Summing numbers with header in Python
0
0.066568
1
0
0
193
10,091,108
2012-04-10T14:55:00.000
0
0
0
0
0
python,mysql,notifications
0
10,091,535
0
1
0
false
0
0
As I understand this is not a client-server application, but rather an application that has a common remote storage. One idea would be to change to web services (this would solve most of your problems on the long run). Another idea (if you don't want to switch to web) is to refresh periodically the data in your interface by using a timer. Another way (and more complicated) would be to have a server that receives all the updates, stores them in the database and then pushes the changes to the other connected clients. The first 2 ideas you mentioned will have maintenance, scalability and design uglyness issues. The last 2 are a lot better in my opinion, but I still stick to web services as being the best.
1
0
0
0
I have a desktop python application whose data backend is a MySQL database, but whose previous database was a network-accessed xml file(s). When it was xml-powered, I had a thread spawned at the launch of the application that would simply check the xml file for changes and whenever the date modified changed (due to any user updating it), the app would refresh itself so multiple users could use and see the changes of the app as they went about their business. Now that the program has matured and is venturing toward an online presence so it can be used anywhere. Xml is out the window and I'm using MySQL with SQLAlchemy as the database access method. The plot thickens, however, because the information is no longer stored in one xml file but rather it is split into multiple tables in the SQL database. This complicates the idea of some sort of 'last modified' table value or structure. Thus the question, how do you inform the users that the data has changed and the app needs to refresh? Here are some of my thoughts: Each table needs a last-modified column (this seems like the worst option ever) A separate table that holds some last modified column? Some sort of push notification through a server? It should be mentioned that I have the capability of running perhaps a very small python script on the same server hosting the SQL db that perhaps the app could connect to and (through sockets?) it could pass information to and from all connected clients? Some extra information: The information passed back and forth would be pretty low-bandwidth. Mostly text with the potential of some images (rarely over 50k). Number of clients at present is very small, in the tens. But the project could be picked up by some bigger companies with client numbers possibly getting into the hundreds. Even still the bandwidth shouldn't be a problem for the foreseeable future. Anyway, somewhat new territory for me, so what would you do? Thanks in advance!
Best way to inform user of an SQL Table Update?
0
0
1
1
0
450
10,098,963
2012-04-11T02:09:00.000
2
0
0
0
1
java,javascript,python,html,navigation
0
10,099,151
0
2
0
false
1
0
You can use a tool like Selenium to emulate a user clicking things in a web browser (I believe it actually "drives" a real instance of whatever browser you choose.) Selenium has a domain-specific language for specifying what actions you want to perform, and Python bindings for controlling it programmatically. I haven't actually used it, so I can't say much more about it, but you should go check it out.
1
2
0
0
I need to navigate though a website that is written mostly in Javascript. There are no hard links at all, as the page is simply modified through the script. I can do what I need to using Javascript injections one after another, but chrome starts searching for my input instead of injecting it after a certain string length. I've tried to use frames to do this in HTML, but chrome won't let me use Javascript inside the frame since the source is from a different domain. Is there a good way that I can do this? I've looked into using Java or Python, but I don't see anything that lets you work with Javascript. EDIT: Thanks for telling me about different software, but I don't want to use other third-party software. I would really like to know how to execute Javascript injections in a systematic manner from a HTML page. I can do it from the browser, so why can't I do it from an HTML document?
How do I navigate a website through software?
0
0.197375
1
0
1
343
10,099,619
2012-04-11T04:01:00.000
0
0
1
0
0
python,arrays
0
10,101,163
0
4
0
false
0
0
Using the construct [[0,0]]*3 works just fine and returns the following: [[0, 0], [0, 0], [0, 0]]
2
2
1
0
I want to initialize an array that has X two-dimensional elements. For example, if X = 3, I want it to be [[0,0], [0,0], [0,0]]. I know that [0]*3 gives [0, 0, 0], but how do I do this for two-dimensional elements?
How do I initialize a one-dimensional array of two-dimensional elements in Python?
0
0
1
0
0
1,407
10,099,619
2012-04-11T04:01:00.000
0
0
1
0
0
python,arrays
0
10,099,628
0
4
0
false
0
0
I believe that it's [[0,0],]*3
2
2
1
0
I want to initialize an array that has X two-dimensional elements. For example, if X = 3, I want it to be [[0,0], [0,0], [0,0]]. I know that [0]*3 gives [0, 0, 0], but how do I do this for two-dimensional elements?
How do I initialize a one-dimensional array of two-dimensional elements in Python?
0
0
1
0
0
1,407
10,105,610
2012-04-11T12:09:00.000
3
0
0
0
0
python,django,facebook,fandjango
0
10,105,994
0
1
0
true
1
0
There's no need to wrap the context processor. If you've wrapped the view in the first place, then the request will already be annotated with the facebook.user attribute. Since the request is passed to the context processor anyway, you have access to that attribute. You should probably do a quick check - if hasattr(request, 'facebook') - within the context processor, just to make sure it's being called from a wrapped view.
1
0
0
0
I'm using Fandjango for a Django Facebook Canvas app. To use fandjango, you need to wrap all view functions with @facebook_authorization_required, which makes sure you're authorized, then gives you the variable request.facebook.user. What I want is to make a context processor which defines a few more variables based on this, i.e., I want all my templates to be able to use fb_user as a shortcut for request.facebook.user. The problem is, I don't know how to use the decorator on the context processor. Any ideas how I can do this?
Apply decorator to context processor
0
1.2
1
0
0
280
10,130,367
2012-04-12T19:25:00.000
0
0
0
0
1
python,scrapy,scrapyd
0
10,136,943
0
1
0
false
1
0
I think i had a similar situation. The reason that processes were dying was that spiders were generating an exception making the process to stop. To find out the exception look at the log files somewhere in .scrapy folder. For each started crawler process scrapy creates a log file with job id in its name.
1
2
0
0
I am facing a problem with crawler processes dying unexpectedly. I am using scrapy 0.14, the problem existed in 0.12 as well . The scrapyd log shows entries like: Process died: exitstatus=None The spider logs dont show spider closed information as depicted by my database status also. Has anybody else faced similar situation? How can i trace the reason for these processes vanishing, any ideas, suggestions?
Crawler processes dying unexpectedly
0
0
1
0
0
493
10,137,594
2012-04-13T08:30:00.000
0
0
0
0
0
python,networking,ethernet
0
16,929,947
0
6
0
false
0
0
Another roundabout way to get a systems mac id is to use the ping command to ping the system's name then performing an arp -a request against the ip address that was pinged. the downfall to doing it that way thou is you need to write the ping response into the memory of python and performing a readline operation to retrieve the ip address and then writing the corresponding arp data into memory while writing the system name, ip address, and mac id to the machine in question to either the display or to a test file. Im trying to do something similar as a system verification check to improve the automation of a test procedure and the script is in python for the time being.
1
1
0
0
The goal is to collect the MAC address of the connected local NIC, not a list of all local NICs :) By using socket and connect (to_a_website), I can just use getsockname() to get the IP, that is being used to connect to the Internet. But from the IP how can I then get the MAC address of the local NIC ? Main reason for the question is if there are multiple NICs.
Python - Get MAC address of only the connected local NIC
0
0
1
0
1
8,993
10,151,806
2012-04-14T07:16:00.000
5
0
0
0
0
python,python-c-api
0
10,152,614
0
1
0
true
0
1
Yes, use tp_as_mapping instead. Its mp_subscript takes a PyObject * so you can use anything as index/key. To understand how they relate, you could have a look at the source of PyObject_GetItem() which (as the doc says) is the equivalent of Python o[key] expression. You will see that it first tries tp_as_mapping and if that's not there and key is int, it tries tp_as_sequence.
1
3
0
0
Is it possible to define a class with a __getitem__ that takes a tuple argument using the Python C-API? The sq_item member of the tp_as_sequence member of a PyTypeObject must be a ssizeargfunc, so I don't see how to do it. (But I assume that the NumPy ndarray does it.)
__getitem__ method with tuple argument using Python C-API
1
1.2
1
0
0
853
10,152,055
2012-04-14T08:01:00.000
3
0
0
1
1
python,google-app-engine
0
10,152,181
0
1
1
true
1
0
How about writing the XML data to the blobstore and then write a handler that uses send_blob to download to your local file system? You can use the files API to write to the blobstore from you application.
1
0
0
0
I have an application I am developing on top of GAE, using Python APIs. I am using the local development server right now. The application involves parsing large block of XML data received from outside service. So the question is - is there an easy way to get this XML data exported out of the GAE application - e.g., in regular app I would just write it to a temp file, but in GAE app I can not do that. So what could I do instead? I can not easily run all the code that produces the service call outside of GAE since it uses some GAE functions to create the call, but it would be much easier if I could take the XML result out and develop/test the parser part outside and then put it back to GAE app. I tried to log it using logging and then extract it from the console, but when XML is getting big it doesn't work well. I know there's bulk data import/export APIs but seems to be an overkill for extracting just this one piece of information to write it to data store and then export the whole store. So how to do it in the best way?
Getting a piece of information from development GAE server to local filesystem
1
1.2
1
0
1
66
10,163,877
2012-04-15T16:35:00.000
1
1
0
1
0
python,bash,ubuntu,file-monitoring
0
10,176,476
0
3
0
true
0
0
One technique I use works with FTP. You issue a command to the FTP server to transfer the file to an auxiliary directory. Once the command completes, you send a second command to the server, this time telling it to rename the file from from the aux directory to the final destination directory.If you're using inotify or polling the directory, the filename won't appear until the rename has completed, thus, you're guaranteed that the file is complete. I'm not familar with rsync so I don't know if it has a similar rename capability.
1
6
0
0
I have a video encoding script that I would like to run as soon as a file is moved into a specific directory. If I use something like inotify, how do I ensure that the file isn't encoded until it is done moving? I've considered doing something like: Copy (rsync) file into a temporary directory. Once finished, move (simple 'mv') into the encode directory. Have my script monitor the encode directory. However, how do I get step #2 to work properly and only run once #1 is complete? I am using Ubuntu Server 11.10 and I'd like to use bash, but I could be persuaded to use Python if that'd simplify issues. I am not "downloading" files into this directory, per se; rather I will be using rsync the vast majority of the time. Additionally, this Ubuntu Server is running on a VM. I have my main file storage mounted via NFS from a FreeBSD server.
Move file to another directory once it is done transferring
0
1.2
1
0
0
1,292
10,165,342
2012-04-15T19:34:00.000
0
1
0
0
0
python,buildout
0
10,168,036
0
2
0
false
0
0
Putting it in find-links should work. I've done that in the past. You have to make sure the link is of the correct format as any python egg.
1
0
0
0
zc.recipe.egg allows you to install any egg and its script with buildout. However, zc.recipe.egg relies on find-links and index behavior, inherit from setuptools I guess. It would like to take an egg server / HTML for scanning. What if I just want to point zc.recipe.egg to a egg direct download URL how would I do that? Looks like putting it to find-links is no go.
Buildout and zc.recipe.egg - specifying egg download URL directly?
0
0
1
0
0
748
10,169,500
2012-04-16T06:19:00.000
1
0
0
0
1
python,url,web,siteminder
0
19,700,519
0
3
0
false
0
0
Agree with Martin - you need to just replicate what the browser does. Siteminder will pass you a token once successfully authenticated. I have to do this as well, will post once I find a good way.
1
3
0
0
I am trying to access and parse a website at work using Python. The sites authorization is done via siteminder, so the usual urllib/urllib2 user password does not work. Does anyone have an idea how to do that? Thanks NoamM
Use Python/urllib to access web sites with "siteminder" authentication?
0
0.066568
1
0
1
2,741
10,196,716
2012-04-17T18:16:00.000
0
0
0
0
0
python,pyqt4
0
10,201,627
0
1
0
false
0
1
After inserting the row, call QTableWidget.scrollToBottom() to show that last row.
1
0
0
0
I am inserting some data in qtablewidget after some time interval. For this i am clearing all content of qtable and then inserting data. But the table showing data from first row, I want that the table always show last row. This will feel like real updation of table. how to do this?
Pyqt table widget updation
0
0
1
0
0
303
10,199,697
2012-04-17T21:49:00.000
1
0
0
0
1
python,web-services,api
0
10,332,534
0
1
0
true
1
0
Well, your question is a little bit generic, but here are a few pointers/tips: Webfaction allows you to install pretty much anything you want (you need to compile it / or ask the admins to install some CentOS package for you). They provide some default Apache server with mod_wsgi, so you can run web2py, Django or any other wsgi frameworks. Most popular Python web frameworks have available installers in Webfaction (web2py, django...), so I would recommend you to go with one of them. I would also install supervisord to keep your service running after some reboot/crash/problem. I would be glad to help you if you have any specific question...
1
1
0
0
I have developed a few python programs that I want to make available online. I am new to web services, and I am not sure what I need to do in order to create a service where somebody makes a request to an URL (for example), and the URL triggers a Python program that displays something in the user's browser, or a set of inputs are given to the program via browser, and then python does whatver it is supposed to do. I was playing with the google app engine, which runs fine with the tutorial, and was planning to use it becuase it looks easy, but the problem with GAE is that it does not work well (or does not work at all) with some libraries that I plan to use. I guess what I am trying to do is some sort of API using my WebFaction account. Can anybody point me in the right directions? What choices do I have in WebFaction? What are the easiest tools available? Thank you very much for your help in advance. Cheers
RESTful Web service or API for a Python program in WebFaction
0
1.2
1
0
1
597
10,199,963
2012-04-17T22:12:00.000
7
0
0
1
0
python,google-app-engine,memory-management,python-2.7,task-queue
1
10,200,635
0
1
0
false
1
0
There's not currently any way to advise the App Engine infrastructure about this. You could have your tasks return a non-200 status code if they shouldn't run now, in which case they'll be automatically retried (possibly on another instance), but that could lead to a lot of churn. Backends are probably your best option. If you set up dynamic backends, they'll only be spun up as required for task queue traffic. You can send tasks to a backend by specifying the URL of the backend as the 'target' argument. You can gain even more control over task execution by using pull queues. Then, you can spin up backends as you choose (or use push queue tasks, for that matter), and have the instances pull tasks off the pull queue in whatever manner suits.
1
1
0
0
I have a Google App Engine app that periodically processes bursts of memory-intensive long-running tasks. I'm using the taskqueue API on the Python2.7 run-time in thread-safe mode, so each of my instances is handling multiple tasks concurrently. As a result, I frequently get these errors: Exceeded soft private memory limit with 137.496 MB after servicing 8 requests total After handling this request, the process that handled this request was found to be using too much memory and was terminated. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you may have a memory leak in your application. As far as I can tell, each instance is taking on 8 tasks each and eventually hitting the soft memory limit. The tasks start off using very low amounts of memory but eventually grow to about 15-20MB. Is there any way to restrict tell App Engine to assign no more than 5 requests to an instance? Or tell App Engine that the task is expected to use 20MB of memory over 10 minutes and to adjust accordingly? I'd prefer not to use the backend APIs since I want the number of instances handling tasks to automatically scale, but if that's the only way, I'd like to know how to structure that.
Restricting the number of task requests per App Engine instance
1
1
1
0
0
228
10,200,594
2012-04-17T23:19:00.000
1
0
1
0
0
python,plugins,pyqt,contextmenu,pyqt4
0
10,543,269
0
2
0
true
0
0
Avaris' comments basically answered this question the best. I can't select it, though, because it's comments, rather than an answer. So I'm summarizing that answer here, so this Q can be answered: "If you are given a context menu (QMenu to be specific) you can access it." - Avaris "You can't do this without modifying that file [the one containing the context menu creation code]. It assumes it has given a list of QActions (see line 301) and it wouldn't be expecting QMenu. Though, if you can get to the plugin_menu reference in your plugin, that's a different story." - Avaris So either you can access to manipulate the menu in the same file (and same place in that file) where the menu creation/definition code is, or you can gain access to do so via that file (in the same place) exposing the menu via an API. On the flip side, if you don't have such API access, and/or modify that file/function, then there's no way to do this.
1
3
0
0
Note: I have very little python and PyQt experience... Given a context menu already created, I'm looking for a functional example of how I would gain access to that context menu, so it can be extended for a plugin which is doing the python equivalent of a javascript greasemonkey script. Then I'm also looking for a functional example of how I could add a submenu to that context menu. Thanks!
PyQt: Basic example of accessing and adding a submenu to an existing context menu?
0
1.2
1
0
0
3,646
10,208,147
2012-04-18T11:10:00.000
0
0
0
0
0
python,postgresql,openerp
0
10,208,766
0
3
0
false
1
0
OpenERP works with PostgreSQl as the Back-end Structure. Postgresql is managed by pgadmin3 (Postgres GUI),you can write sql queries there and can add/delete records from there. It is not advisable to insert/remove data directly into Database!!!!
2
2
0
0
I am new in OpenERP, I have installed OpenERP v6. I want to know how can I insert data in database? Which files I have to modify to do the job? (files for the SQL code)
OpenERP: insert Data code
0
0
1
1
0
794
10,208,147
2012-04-18T11:10:00.000
0
0
0
0
0
python,postgresql,openerp
0
10,225,346
0
3
0
false
1
0
The addition of columns in the .py files of the corresponding modules you want to chnage will insert coumns to the pgadmin3 also defenition of classes will create tables...when the fields are displayed in xml file and values are entered to the fields through the interface the values get stored to the table values to the database...
2
2
0
0
I am new in OpenERP, I have installed OpenERP v6. I want to know how can I insert data in database? Which files I have to modify to do the job? (files for the SQL code)
OpenERP: insert Data code
0
0
1
1
0
794
10,217,948
2012-04-18T21:02:00.000
1
0
0
1
0
python,google-app-engine,analytics,visitors
0
10,221,347
0
3
0
false
1
0
There is no way to tell when someone stops viewing a page unless you use Javascript to inform the server when that happens. Forums etc typically assume that someone has stopped viewing a page after n minutes of inactivity, and base their figures on that. For minimal resource use, I would suggest using memcache exclusively here. If the value gets evicted, the count will be incorrect, but the consequences of that are minimal, and other solutions will use a lot more resources.
1
2
0
0
I need to get the number of unique visitors(say, for the last 5 minutes) that are currently looking at an article, so I can display that number, and sort the articles by most popular. ex. Similar to how most forums display 'There are n people viewing this thread' How can I achieve this on Google App Engine? I am using Python 2.7. Please try to explain in a simple way because I recently started learning programming and I am working on my first project. I don't have lots of experience. Thank you!
How to get number of visitors of a page on GAE?
0
0.066568
1
0
0
1,919
10,218,679
2012-04-18T21:59:00.000
1
1
0
0
0
python,selenium
0
10,218,792
0
6
0
false
1
0
My experience has been that any sufficiently useful test framework will end up needing a customized logging solution. You are going to end up wanting domain specific and context relevant information, and the pre-baked solutions never really fit the bill by virtue of being specifically designed to be generic and broadly applicable. If you are already using Python, I'd suggest looking in to the logging module and learning how to write Handlers and Formatters. It's actually pretty straight forward, and you will end up getting better results than trying to shoehorn the logging you need in to some selenium-centric module.
1
7
0
0
I am doing some R&D on selenium+python. I wrote some test cases in python using selenium webdriver and unittest module. I want to know how can I create report of the test cases. Is there inbuilt solution available in selenium or I need to code to generate file. Or is there any other web testing framework with javascript support available in python which have reporting functionality. I am basically new to python as well as selenium. Just trying to explore.
Selenium+python Reporting
1
0.033321
1
0
1
24,481
10,220,943
2012-04-19T02:41:00.000
0
1
0
0
0
python,windows
0
10,220,978
0
4
1
false
0
0
raw_input('Please fill in questionnaire 1 and press [ENTER] when you are done.') will wait for someone to hit [enter]. Clearing the screen may be OS/environment dependent, I am not sure.
1
0
0
0
'lo, I am currently trying to code a simple routine for an experiment we are planning to run. The experiment starts by entering a subject number and creating a bunch of files. I got that part working. Next, we want the screen to go blank and display a message. Something like 'Please fill in questionnaire 1 and press [ENTER] when you are done.' My question is, how do you recommend I present a blank screen with a message like that that waits for a certain key to be pressed? I have quite some programming experience but haven't worked with Python before so any hints are greatly appreciated. Thanks a lot in advance for your time! ~~~~~~~~~~~~~~~~~~ Some extra info that might be relevant: We are running this on Windows XP (Service Pack 2) computers. The whole point of this is that the participant does not have access to the desktop or anything on the computer basically. We want the experiment to start and display a bunch of instructions on the screen that the subject has to follow without them being able to abort etc. Hope this makes sense.
Present blank screen, wait for key press -- how?
0
0
1
0
0
5,401
10,221,441
2012-04-19T03:55:00.000
2
0
1
0
0
python,function
0
10,221,621
0
2
0
false
0
0
In general import multiprocessing multiprocessing.__path__ multiprocessing.__file__ __path__ yields location of the library __file__ yields complete path of the file. If above didn't work, you need to look into python development source code. Regarding type source code, Raymond Hettinger's answer is correct.
1
2
0
0
I have used type() function in my program... I just want to know how does Python implement this? Or where could I find the source code file that implement this function?
source code of python inbuilt functions
0
0.197375
1
0
0
2,787
10,241,279
2012-04-20T06:27:00.000
0
0
1
1
0
python,emacs,interpreter
0
15,099,767
0
8
0
false
0
0
In emacs 24.2 there is python-switch-to-python
2
32
0
0
I just downloaded GNU emacs23.4, and I already have python3.2 installed in Windows7. I have been using Python IDLE to edit python files. The problem is that I can edit python files with Emacs but I do not know how to run python interpreter in Emacs. When i click on "switch to interpreter", then it says "Searching for program: no such file or directory, python" Someone says i need to make some change on .emacs file, but i do not know where to look for. And I am very unexperienced and just started to learn programming. I am not familiar with commonly used terminologies. I have been searching for solutions but most of the articles i find on the Internet only confuse me. so the questions are: how do i run python interpreter in Emacs? are there different kind of python interpreter? if so, why do they have different interpreters for one language?
How do I run a python interpreter in Emacs?
1
0
1
0
0
37,056
10,241,279
2012-04-20T06:27:00.000
14
0
1
1
0
python,emacs,interpreter
0
20,375,113
0
8
0
false
0
0
C-c C-z can do this. It is the key-binding for the command python-switch-to-python
2
32
0
0
I just downloaded GNU emacs23.4, and I already have python3.2 installed in Windows7. I have been using Python IDLE to edit python files. The problem is that I can edit python files with Emacs but I do not know how to run python interpreter in Emacs. When i click on "switch to interpreter", then it says "Searching for program: no such file or directory, python" Someone says i need to make some change on .emacs file, but i do not know where to look for. And I am very unexperienced and just started to learn programming. I am not familiar with commonly used terminologies. I have been searching for solutions but most of the articles i find on the Internet only confuse me. so the questions are: how do i run python interpreter in Emacs? are there different kind of python interpreter? if so, why do they have different interpreters for one language?
How do I run a python interpreter in Emacs?
1
1
1
0
0
37,056
10,249,121
2012-04-20T15:31:00.000
0
0
0
0
1
python
0
10,249,180
0
3
0
false
0
0
Get the functional module from pypi. It has a compose function to compose two callables. With that, you can chain functions together. Both that module, and functool provide a partial function, for partial-application. You can use the composed functions in a generator expression just like any other.
1
3
0
0
here is the problem: 1) suppose that I have some measure data (like 1Msample read from my electronics) and I need to process them by a processing chain. 2) this processing chain consists of different operations, which can be swapped/omitted/have different parameters. A typical example would be to take this data, first pass them via a lookup table, then do exponential fit, then multiply by some calibration factors 3) now, as I do not know what algorithm the the best, I'd like to evaluate at each stage best possible implementation (as an example, the LUTs can be produced by 5 ways and I want to see which one is the best) 4) i'd like to daisychain those functions such, that I would construct a 'class' containing top-level algorithm and owning (i.e. pointing) to child class, containing lower-level algorithm. I was thinking to use double-linked-list and generate sequence like: myCaptureClass.addDataTreatment(pmCalibrationFactor(opt, pmExponentialFit (opt, pmLUT (opt)))) where myCaptureClass is the class responsible for datataking and it should as well (after the data being taken) trigger the top-level data processing module (pm). This processing would first go deep into the bottom-child (lut), treat data there, then middle (expofit), then top (califactors) and return the data to the capture, which would return the data to the requestor. Now this has several issues: 1) everywhere on the net is said that in python one should not use double-linked-lists 2) this seems to me highly inefficient because the data vectors are huge, hence i would prefer solution using generator function, but i'm not sure how to provide the 'plugin-like' mechanism. could someone give me a hint how to solve this using 'plugin-style' and generator so I do not need to process vector of X megabytes of data and process them 'on-request' as is correct when using generator function? thanks a lot david An addendum to the problem: it seems that I did not express myself exactly. Hence: the data are generated by an external HW card plugged into VME crate. They are 'fetched' in a single block transfer to the python tuple, which is stored in myCaptureClass. The set of operation to be applied is in fact on a stream data, represented by this tuple. Even exponential fit is stream operation (it is a set of variable state filters applied on each sample). The parameter 'opt' i've mistakenly shown was to express, that each of those data processing classes has some configuration data which come with, and modify behaviour of the method used to operate on data. The goal is to introduce into myCaptureClass a daisychained class (rather than function), which - when user asks for data - us used to process 'raw' data into final form. In order to 'save' memory resources i thought it might be a good idea to use generator function to provide the data. from this perspective it seems that the closest match to what i want to do is shown in code of bukzor. I'd prefer to have a class implementation instead of function, but i guess this is just a cosmetic stuff of implementing call operator in particular class, which realizes the data operation....
how to implement 'daisychaining' of pluggable function in python?
0
0
1
0
0
987
10,249,240
2012-04-20T15:38:00.000
1
1
1
0
1
python,character-encoding
0
10,250,521
0
1
0
true
0
0
If it is None, simply output your data as utf-8, and document it. If it happens that there are use cases for other encodings, make that an option through the command line or other means.
1
2
0
0
I am trying to handle the different encodings in a Python script the more user-friendly and auto-magic way possible (there are APIs for utf8). It is a cross-platform console script. For printing to stdout I use sys.stdout.encoding and it seems to do the right thing almost always when printing to the console. However when stdout is piped it becomes None. So in that case I assume I am piping to a file and use locale.getpreferredencoding() but: I am not sure this is the right encoding for printing to a file, but it works quite cross-platform. That doesn't work when piping to a program |. I don't know how to detect that this is the case neither if there is a standard or an expected behavior for encoding in that case.
What should I do when sys.stdout.encoding is None?
0
1.2
1
0
0
643
10,252,304
2012-04-20T19:22:00.000
1
0
1
1
1
python,gcc,cygwin,pypy
0
10,252,762
0
3
0
false
0
0
Windows needs the ".exe" extension to know that it's executable. You'll need to modify the build to look for Windows and use the .exe extension.
1
2
0
0
I'm trying to compile PyPy on cygwin, and the compilation stops when python tries to open the file "externmod", which was just compiled with gcc. The problem with gcc on cygwin is that it automatically appends a '.exe' to whatever you're compiling, so even though gcc is called as gcc -shared -Wl,--enable-auto-image-base -pthread -o /tmp/usession-release-1.8/shared_cache/externmod, the output file ends up being externmod.exe regardless. So python tries to open /tmp/usession-release-1.8/shared_cache/externmod and can't find it--thus the compilation stops. Anyone know how to solve this, short of recompiling gcc? I don't want to do that.
Compiling PyPy on cygwin
0
0.066568
1
0
0
1,101
10,255,185
2012-04-21T00:44:00.000
2
0
0
0
0
python,excel,web-scraping
0
10,255,232
0
2
0
false
0
0
if you don't want to introduce a full excel library, you can write an HTML table or CSV and Excel will happily import those. The downside with this is that you're limited to one worksheet and no formulaes.
1
2
0
0
I would like to know how I would have a python web scrape dump all of it's results into excel. It's not that I don't know how to webscrape, it's just I do not know how to scrape into excel.
How to scrape in python into excel
0
0.197375
1
0
1
4,830
10,260,925
2012-04-21T16:36:00.000
2
0
0
1
1
python,celery
0
43,633,216
0
2
0
false
1
0
The way I deployed it is like this: clone your django project on a heroku instance (this will run the frontend) add RabitMQ as an add on and configure it clone your django project into another heroku instance (call it like worker) where you will run the celery tasks
2
58
0
0
I am new to celery.I know how to install and run one server but I need to distribute the task to multiple machines. My project uses celery to assign user requests passing to a web framework to different machines and then returns the result. I read the documentation but there it doesn't mention how to set up multiple machines. What am I missing?
How to set up celery workers on separate machines?
0
0.197375
1
0
0
26,305
10,260,925
2012-04-21T16:36:00.000
60
0
0
1
1
python,celery
0
10,261,277
0
2
0
true
1
0
My understanding is that your app will push requests into a queueing system (e.g. rabbitMQ) and then you can start any number of workers on different machines (with access to the same code as the app which submitted the task). They will pick out tasks from the message queue and then get to work on them. Once they're done, they will update the tombstone database. The upshot of this is that you don't have to do anything special to start multiple workers. Just start them on separate identical (same source tree) machines. The server which has the message queue need not be the same as the one with the workers and needn't be the same as the machines which submit jobs. You just need to put the location of the message queue in your celeryconfig.py and all the workers on all the machines can pick up jobs from the queue to perform tasks.
2
58
0
0
I am new to celery.I know how to install and run one server but I need to distribute the task to multiple machines. My project uses celery to assign user requests passing to a web framework to different machines and then returns the result. I read the documentation but there it doesn't mention how to set up multiple machines. What am I missing?
How to set up celery workers on separate machines?
0
1.2
1
0
0
26,305
10,270,331
2012-04-22T17:35:00.000
-1
0
1
0
0
python,html,regex,markdown,markup
0
10,270,412
0
2
1
false
0
0
Regular expressions, of course! If still haven't done so, learn it. After you are done, you will find it hard to imagine how you got along without it. The samples you show are simple with regular expressions. For example, an asterisk, then a space then a word is expressed as: \*\s\w+ Nothing else but regular expressions.
1
1
0
0
This question may have been asked in a different way, if so please point it to me. I just couldn't find it among my search results. I would like to parse text for mark-ups, like those here on SO. eg. * some string for bullet list eg. *some string* for italic text eg. &some string& for a URL eg. &some string&specific url& for URL different from string etc. I can think of two ways to go about processing a string to find out special mark-up sequences: a. I could proceed in a character-centric way, i.e. parsing the string looking for sequences 1, then 2 etc. That however seems to be inefficient as it would have to parse the string multiple times. b. It seems better to process the string character by character and keep a memory of special characters and their position. If the memory matches a special sequence as above, then the special characters are replaced by HTML in the string. I'm not really sure whether that's a better idea however, nor am I sure as to how one should implement it. What is the best way to go about this? How about Regular Expressions? Does it follow pattern a or b? Is there a third option? P.S. I am using Python. Python example most appreciated.
What is the most efficient way to trace markups in a string?
0
-0.099668
1
0
0
102
10,284,847
2012-04-23T16:55:00.000
6
0
1
0
1
python,latex,matplotlib
0
44,506,534
0
4
0
false
0
0
Quick solutions plt.annotate("I am \n"+r"$\frac{1}{2}$"+"\n in latex math environment", xy=(0.5, 0.5))
1
24
0
0
I have a very basic question : how to do a line break with matplotlib in python with an "annotate" command. I tried "\" and "\n" but it does not work. And how to do this for a "Latex" annotation and for a normal text annotation ? Thank you very much.
Python : Matplotlib annotate line break (with and without latex)
0
1
1
0
0
40,716
10,295,384
2012-04-24T09:41:00.000
1
0
0
0
0
python,checkbox,tkinter,message
0
10,296,668
0
1
0
true
0
1
No, the standard dialogs don't support that. If you want such a feature you'll have to build your own dialog out of a Toplevel window and other widgets.
1
2
0
0
I'm creating message boxes in Tkinter using tkMessageBox.showwarning. Does Tkinter let you insert a sort of checkbox with the message that says, for example, "do not show again" so when selected the message won't appear the next time?
"do not show message again" checkbox in Tkinter warning message
0
1.2
1
0
0
410
10,298,104
2012-04-24T12:46:00.000
4
0
1
0
0
python,windows-installer,pywinauto
1
10,298,383
0
1
0
false
0
0
You need to launch "msiexec.exe" and pass the MSI as a command line parameter for it to be installed. You cannot launch directly an MSI as you would launch an EXE file. Example: msiexec.exe /i [MSI_path]
1
2
0
0
I am looking at using pywinauto in python to automate the installation of a Windows MSI installer for testing purposes. When I try to launch the MSI through the application.start I get the following error: "Error returned by CreateProcess: [Error 193] " Is it possible to even do this, or do I need to launch the MSI first and then connect to it, and if so, how do I achieve this? Thanks.
Using pywinauto to automate an MSI installer
1
0.664037
1
0
0
1,186
10,301,589
2012-04-24T15:58:00.000
4
0
1
0
0
python,list,dictionary,tuples
0
10,301,663
0
6
0
false
0
0
A dictionary value can't contain two tuples just by themselves. Each dictionary key maps to a single value, so the only way you can have two separate tuples associated with that key is for them to be themselves contained within a tuple or list: {'Key1':[(1.000,2.003,3.0029),(2.3232,13.5232,1325.123)]} - note the extra pair of square brackets. One way of doing this would be to get the current value associated with your key, and append it to a list before setting the new list back to that key. But if there's a possibility you'll need that for any key, you should do it for all keys right at the start, otherwise you'll get into all sorts of difficulties working out what level you're at.
1
4
0
0
I've been trying to figure out how to add multiple tuples that contain multiple values to to a single key in a dictionary. But with no success so far. I can add the values to a tuple or list, but I can't figure out how to add a tuple so that the key will now have 2 tuples containing values, as opposed to one tuple with all of them. For instance say the dictionary = {'Key1':(1.000,2.003,3.0029)} and I want to add (2.3232,13.5232,1325.123) so that I end up with: dictionary = {'Key1':((1.000,2.003,3.0029),(2.3232,13.5232,1325.123))} (forgot a set of brackets!) If someone knows how this can be done I'd appreciate the help as it's really starting to annoy me now. Thanks! Edit: Thanks everyone! Ironic that I tried that except at the time I was trying to make the value multiple lists instead of multiple tuples; when the solution was to just enclose the tuples in a list. Ah the irony.
How do you add multiple tuples(lists, whatever) to a single dictionary key without merging them?
0
0.132549
1
0
0
48,959
10,315,232
2012-04-25T12:05:00.000
0
1
0
1
1
python,linux,eclipse,pydev
0
10,343,117
0
1
0
true
1
0
I don't really think there's anything that can be done on the PyDev side... it seems @sys is resolved based on the kind of process you're running (not your system), so, if you use a 64 bit vm (I think) it should work... Other than that, you may have to provide the actual path instead of using @sys...
1
2
0
0
I'm working in a multiuser environment with the following setup: Linux 64bits environment (users can login in to different servers). Eclipse (IBM Eclipse RSA-RTE) 32bits. So Java VM, Eclipse and PyDev is 32bits. Python 3 interpreter is only available for 64bits at this moment. In the preferences for PyDev, I want to set the path to the Python interpreter like this: /app/python/@sys/3.2.2/bin/python In Eclipse/PyDev, @sys points to i386_linux26 even if the system actually is amd64_linux26. So if I do not explicitly write amd64_linux26 instead of @sys, PyDev will not be able to find the Python 3 interpreter which is only available for 64bits. The link works as expected outside Eclipse/PyDev, e.g. in the terminal. Any ideas how to force Eclipse/PyDev to use the real value of @sys? Thanks in advance!
Eclipse / PyDev overrides @sys, cannot find Python 64bits interpreter
0
1.2
1
0
0
321
10,315,257
2012-04-25T12:07:00.000
0
0
0
0
0
python,openerp
0
10,324,086
0
2
0
false
1
0
If your purpose is to debug, the simplest solution is to add print statements in your code and then run the server in a console.
1
1
0
0
In openerp, im working on a dummy function that (for example) returns the sum of a certain field on selected records. for instance, u select 3 invoices and it returns the sum of the quantity in the invoice lines. i think the function to perform the sum is correct, and even if it wasnt, i just need help in displaying the result of the function when called in a popup box. for that, i've added an action similar to "Confirm Invoices" found in the invoice object. to make myself clearer, when the confirm invoice is pressed, its function is called and the popup previously opened is of course closed because of this line found in the function: return {'type': 'ir.actions.act_window_close'} how can i tell it in my function instead (of closing) to display the result stored after executing the function?
openerp echo the return result of a function
0
0
1
0
0
517
10,322,938
2012-04-25T20:05:00.000
3
0
1
0
0
python
0
10,322,992
0
4
0
true
0
0
If it's exactly that format, you could just print out line[3:7]
2
0
0
0
I have long a text file where each line looks something like /MM0001 (Table(12,)) or /MM0015 (Table(11,)). I want to keep only the four-digit number next to /MM. If it weren't for the "table(12,)" part I could just strip all the non-numeric characters, but I don't know how to extract the four-digit numbers only. Any advice on getting started?
Removing selected characters from text file
0
1.2
1
0
0
460
10,322,938
2012-04-25T20:05:00.000
2
0
1
0
0
python
0
10,322,983
0
4
0
false
0
0
You could parse text line by line and then use 4th to 7th char of every line. ln[3:7]
2
0
0
0
I have long a text file where each line looks something like /MM0001 (Table(12,)) or /MM0015 (Table(11,)). I want to keep only the four-digit number next to /MM. If it weren't for the "table(12,)" part I could just strip all the non-numeric characters, but I don't know how to extract the four-digit numbers only. Any advice on getting started?
Removing selected characters from text file
0
0.099668
1
0
0
460
10,325,418
2012-04-25T23:52:00.000
1
0
1
0
0
python,collision-detection,pygame
0
11,217,539
0
1
0
false
0
1
you could make it so that when your character hits a block, they move up at the current speed until they are no longer colliding with the polygon. That way, when you hit the ground from above,you don't go downward through it, but when you hit the bottom, you do. I would recommend a while loop set to the collide function.
1
0
0
0
I am trying to implement a Mario type plat-former in pyGame. I have Collision detection working with Polygons no problem. I am curious how I can get the player to be able to jump through the floor above him, which is a polygon floating in air. What is the theory on how to handle that?
Jump Through Polygon/Floor Collision Detection
0
0.197375
1
0
0
228