Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
23,551,808 | 2014-05-08T20:24:00.000 | 4 | 0 | 0 | 1 | python,django,architecture,celery | 23,552,055 | 2 | false | 1 | 0 | What will strongly simplify your processing is some shared storage, accessible from all cooperating servers. With such design, you may distribute the work among more servers without worrying on which server will be next processing step done.
Using AWS S3 (or similar) cloud storage
If you can use some cloud storage, lik... | 2 | 1 | 0 | Currently we have everything setup on single cloud server, that includes:
Database server
Apache
Celery
redis to serve as a broker for celery and for some other tasks
etc
Now we are thinking to break apart the main components to separate servers e.g. separate database server, separate storage for media files, web ser... | django-celery infrastructure over multiple servers, broker is redis | 0.379949 | 0 | 0 | 2,804 |
23,552,613 | 2014-05-08T21:11:00.000 | 3 | 1 | 1 | 0 | python | 23,552,656 | 1 | true | 0 | 0 | Yes, all values in Python are objects, including integers, floats, functions, classes, and None. I've never heard it described as a "Pure" Object-oriented language, but it seems to meet your description of one. | 1 | 0 | 0 | I use Ruby on a daily basis and know it is a purely object oriented language. As far as I know, pure object oriented languages' distinguishable characteristic is that all variables are objects, even ints, floats, chars, etc that would be found as primitive types in other languages like Java.
Is Python the same way? I ... | Is Python a pure object-oriented language | 1.2 | 0 | 0 | 5,949 |
23,556,119 | 2014-05-09T03:26:00.000 | 0 | 0 | 1 | 0 | python,multithreading | 27,574,636 | 2 | false | 0 | 0 | Looking back at this, I feel like an absolute idiot.
The proper way to handle this would be calling a function that accepts input and checks it against different expected strings or numerical values.
I just thought I'd answer this in a little more clear way than Stu did. | 1 | 0 | 0 | I'm writing a text based RPG, and I am using Python 3.3.4. It will be played through the Python command line, with no graphics. I'm wanting to make it so that no matter what options the user is presented with, they have the capability of typing "exit" or "help" and exiting (or getting help information) respectively at ... | Python Multithreading to allow user to exit at anytime | 0 | 0 | 0 | 837 |
23,556,597 | 2014-05-09T04:25:00.000 | 1 | 0 | 0 | 0 | python,django,google-app-engine,google-drive-api | 23,559,388 | 1 | false | 1 | 0 | You can insert/upload files using the Drive API and set the "restricted" label to prevent downloading of the file. You would then set the appropriate permissions to this file to allow anyone or a specified set of users to access the file.
Download restrictions may or may not apply for files that are converted to one of... | 1 | 1 | 0 | I'm working on an app in django that allows users to upload documents to google drive and share them with friends. The problem is I want to restrict the shared documents to view only (no download option). How can I go about doing this? | Uploading and serving media files from google drive on django | 0.197375 | 0 | 0 | 909 |
23,556,752 | 2014-05-09T04:41:00.000 | 2 | 0 | 0 | 0 | python,regex,django | 23,557,031 | 2 | true | 1 | 0 | Part after the ? not used in the url dispatching process because it contains GET parameters. Otherwise you will not be able to use a GET request with parameters on patterns like r'^foo/&' (ampersand at the end means the end of the string, and without it it would be harder to use patterns like r'^foo/' and r'^foo/bar/' ... | 1 | 0 | 0 | I have the following URL:
http://127.0.0.1:8000/databaseadd/q=DQ-TDOXRTA?recipe=&recipe=&recipe=&recipe=&recipe=
I'd like to match if the keyword "recipe=" is found in the url.
I have the following line in django url.py but it's not working:
url(r'recipe=', 'plots.views.add_recipe'),
Are the "&" and the "?" throwing ... | Django: Search URL for keyword RegExp | 1.2 | 0 | 0 | 157 |
23,567,368 | 2014-05-09T14:38:00.000 | 1 | 0 | 0 | 1 | python,websocket,tornado,uwsgi | 23,577,862 | 1 | true | 1 | 0 | The uWSGI tornado loop engine is no more than a proof of concept, you could try to use it but native uWSGI websockets support or having nginx routing requests to both uWSGI and tornado are better (and more solid) choices for sure. | 1 | 0 | 0 | I'm work in a little message chat project and i use tornado websocket for the communication between web browser and the server here all work fine but i was working with tornado integrate web framework and i want to configurate my app for run on web server nginx -uwsgi , i read for integrate tornado and uwsgi i have to ... | How integrate a websocket between tornado and uwsgi? | 1.2 | 0 | 0 | 728 |
23,567,726 | 2014-05-09T14:53:00.000 | 2 | 0 | 0 | 0 | python,qt,pyqt,pyqtgraph | 23,572,444 | 1 | false | 0 | 1 | It's likely you have items in the scene that accept their own mouse input, but it's difficult to say without seeing code. In particular, be wary of complex plot lines that are made clickable--it is very expensive to compute the intersection of the mouse cursor with such complex shapes.
The best (some would say only) w... | 1 | 0 | 0 | I have a multi-threaded (via pyqt) application which plots realtime data (data is processed in the second thread and passed to the gui thread to plot via a pyqt-signal). If I place the mouse over the application it continues to run at full speed (as measured by the time difference between calls to app.processEvents()).... | PYQTGraph application slows down when mouse moves over application | 0.379949 | 0 | 0 | 742 |
23,568,682 | 2014-05-09T15:39:00.000 | 0 | 0 | 1 | 1 | python,multithreading,events,twisted | 23,571,618 | 3 | false | 0 | 0 | The connection scheme is also important in the choice. How many concurrent connections do you expect ? How long will a client stay connected ?
If each connection is tied to a thread, many concurrent connections or very long lasting connections ( as with websockets ) will choke the system. For these scenarios an event l... | 1 | 4 | 0 | I am writing a simple daemon to receive data from N many mobile devices. The device will poll the server and send the data it needs as simple JSON. In generic terms the server will receive the data and then "do stuff" with it.
I know this topic has been beaten a bunch of times but I am having a hard time understandin... | Thread vs Event Loop - network programming (language agnostic) | 0 | 0 | 0 | 1,730 |
23,571,451 | 2014-05-09T18:16:00.000 | 1 | 0 | 0 | 0 | python,google-app-engine,reportlab | 23,571,695 | 1 | true | 1 | 0 | If you want to access files from your application code that are covered by a static-file route in your app config, you need to set application_readable to true. Or, you can move/copy the file somewhere else in your project. | 1 | 0 | 0 | I have an app running on GAE, using reportlab to email generated PDF's.
When I run my reportlab app on localhost everything works perfectly. But when I run it after deploying, it throws out an error.
Error
IOError: Cannot open resource
"/base/data/home/apps/myapp/1.375717494064852868/static/img/__.jpg"
Line
img=[... | Reportlab error after deploying | 1.2 | 0 | 0 | 127 |
23,572,471 | 2014-05-09T19:27:00.000 | 1 | 0 | 1 | 1 | python,nltk,python-idle | 23,572,642 | 2 | false | 0 | 0 | Supplementing the answer above, when you install python packages they will install under the default version of python you are using. Since the module imports in python 2.7.6 make sure that you aren't using the Python 3 version of IDLE. | 1 | 1 | 0 | Programming noob here. I'm on Mac OS 10.5.8. I have Python 2.7.6 and have installed NLTK. If I run Python from Terminal, I can "import nltk" with no problem. But if I open IDLE (either from Terminal or by double-clicking on the application) and try the same thing there, I get an error message, "ImportError: No module n... | How do I get IDLE to find NLTK? | 0.099668 | 0 | 0 | 2,634 |
23,574,720 | 2014-05-09T22:11:00.000 | 3 | 0 | 1 | 0 | python,numpy,fortran,fortran90,f2py | 24,146,620 | 2 | false | 0 | 0 | I'm doing something depressingly similar. Instead of dynamic memory allocation via C we have a single global array with integer indices (also at global scope), but otherwise it's much the same. Weird, inconsistent input file and all.
I'd advise against trying to rewrite the majority of the program, whether in python o... | 1 | 6 | 0 | I am supposed to be doing research with this huge Fortran 77 program (which I recently ported to Fortran 90 superficially). It is a very old piece of software used for modeling using finite element methods.
It is a monstrosity. It is roughly 240,000 lines.
Since it began its life in Fortran 77, it uses some really dir... | Porting an old fortran program to work with python+numpy | 0.291313 | 0 | 0 | 1,394 |
23,576,603 | 2014-05-10T02:49:00.000 | 0 | 0 | 1 | 0 | python,tuples | 23,576,631 | 2 | false | 0 | 0 | Yes, collections.namedtuple does this, although you'll access the color with x.color rather than x['color'] | 1 | 0 | 0 | Is it possible to create a tuple in Python with indices that are string-based, not number based? That is, if I have a tuple of ("yellow", "fish", "10), I would be able to access by [color] instead of [0]. This is really only for the sake of convenience. | String-based indices in tuple Python | 0 | 0 | 0 | 117 |
23,577,208 | 2014-05-10T04:49:00.000 | 0 | 0 | 1 | 0 | javascript,ipython,ipython-notebook | 61,441,244 | 3 | false | 0 | 0 | as now in 5.7.4 version shortcut to create cell above is esc + a | 1 | 1 | 0 | I upgraded to IPython 2.0 today.
Alot of changes seem good, but the button to insert a new cell, above/below seems to be gone.
The option is still in the menu, and I believe the keyboard short cut works.
But the button is gone.
I'm sure there is a way to turn it back on, but the documentation for the new version doesn'... | IPython 2.0 Notebook: where has the "Add Cell Above" button gone, and how do I get it back? | 0 | 0 | 0 | 826 |
23,579,631 | 2014-05-10T09:57:00.000 | 0 | 0 | 1 | 0 | python,turtle-graphics | 51,011,317 | 2 | false | 0 | 1 | I would use an array keep all x and y that is used for the maze in an array like stated above. Then have a size of a box around the turtle defined for detecting purposes. | 1 | 3 | 0 | I'm preparing exercises for school classes involving Python's turtle library.
The students are already drawing terrific pictures, but I want them to be able to detect existing pictures and colours in order to modify the behaviour of their program.
For example I would like to provide them with code which draws a maze us... | How to read pixel colours using Python turtle.py | 0 | 0 | 0 | 3,154 |
23,583,017 | 2014-05-10T15:40:00.000 | 0 | 0 | 1 | 0 | python,debugging,exception,web2py,pycharm | 23,634,516 | 1 | true | 1 | 0 | I figured this out by looking through the web2py source code. Apparently, web2py is set up to do what I want to do for a particular debugger, seemingly called Wing Db. There's a constant env var ref in the code named WINGDB_ACTIVE that, if set, redirects exceptions to an external debugger.
All I had do to was define ... | 1 | 0 | 0 | I'm just starting to build a web app with web2py for the first time. It's great how well PyCharm integrates with web2py.
One thing I'd like to do, however, is avoid the web2py ticketing system and just allow exceptions to be caught in the normal way in PyCharm. Currently, any attempt to catch exceptions, even via an ... | Can web2py be made to allow exceptions to be caught in my PyCharm debugger? | 1.2 | 0 | 0 | 95 |
23,586,090 | 2014-05-10T20:41:00.000 | 1 | 0 | 0 | 0 | python,angularjs,single-page-application,custom-headers | 23,587,708 | 1 | true | 1 | 0 | Store the token in sessionStorage or localStorage. In your application startup (config or run) look for this information and set your header.
Perhaps if your user selects "remember me" when they log-in; save the token in local storage otherwise keep it in session storage. | 1 | 0 | 0 | I am building a single page web application (angularjs + python) where a user first needs to login with a username and password. After the user gets authenticated, a new custom header with a token is created and sent everytime this application makes calls to the python api.
One thing I noticed though, is that if I refr... | Single page application losing custom headers after a refresh | 1.2 | 0 | 0 | 597 |
23,587,542 | 2014-05-10T23:54:00.000 | 0 | 1 | 1 | 0 | python,configuration-files | 23,587,747 | 5 | false | 0 | 0 | I've done this frequently in company internal tools and games. Primary reason being simplicity: you just import the file and don't need to care about formats or parsers. Usually it has been exactly what @zmo said, constants meant for non programmers in the team to modify (say the size of the grid of the game level. or ... | 2 | 7 | 0 | I've noticed a few Python packages that use config files written in Python. Apart from the obvious privilege escalation, what are the pros and cons of this approach?
Is there much of a precedence for this? Are there any guides as to the best way to implement this?
Just to clarify: In my particular use case, this will o... | Using config files written in Python | 0 | 0 | 0 | 1,283 |
23,587,542 | 2014-05-10T23:54:00.000 | 0 | 1 | 1 | 0 | python,configuration-files | 23,587,749 | 5 | false | 0 | 0 | This is yet another config file option. There are several quite adequate config file formats available.
Please take a moment to understand the system administrator's viewpoint or some 3rd party vendor supporting your product. If there is yet another config file format they might drop your product. If you have a pr... | 2 | 7 | 0 | I've noticed a few Python packages that use config files written in Python. Apart from the obvious privilege escalation, what are the pros and cons of this approach?
Is there much of a precedence for this? Are there any guides as to the best way to implement this?
Just to clarify: In my particular use case, this will o... | Using config files written in Python | 0 | 0 | 0 | 1,283 |
23,587,568 | 2014-05-10T23:57:00.000 | 5 | 0 | 1 | 0 | python,algorithm,list,frequency | 23,587,628 | 5 | false | 0 | 0 | Why not have two lists, one for questions not yet picked and one for questions that have been picked. Initially, the not-yet-picked list will be full, and you will pick elements from it which will be removed and added to the picked list. Once the not-yet-picked list is empty, repeat the same process as above, this time... | 2 | 4 | 0 | I am building a quiz application which pulls questions randomly from a pool of questions. However, there is a requirement that the pool of questions be limited to questions that the user has not already seen. If, however, the user has seen all the questions, then the algorithm should "reset" and only show questions t... | Efficient algorithm for determining values not as frequent in a list | 0.197375 | 0 | 0 | 314 |
23,587,568 | 2014-05-10T23:57:00.000 | 0 | 0 | 1 | 0 | python,algorithm,list,frequency | 23,587,653 | 5 | false | 0 | 0 | Let's define a "pivot" that separates a list into two sections. The pivot partitions the array such that all numbers before the pivot has been picked one more than the numbers after the pivot (or more generally, all numbers before pivot are ineligible for picking, while all numbers after the pivot are eligible for pick... | 2 | 4 | 0 | I am building a quiz application which pulls questions randomly from a pool of questions. However, there is a requirement that the pool of questions be limited to questions that the user has not already seen. If, however, the user has seen all the questions, then the algorithm should "reset" and only show questions t... | Efficient algorithm for determining values not as frequent in a list | 0 | 0 | 0 | 314 |
23,590,683 | 2014-05-11T08:48:00.000 | 1 | 0 | 0 | 0 | javascript,jquery,python,perl | 23,590,735 | 1 | true | 0 | 0 | Short answer: In Python, you can use mechanize together with BeautifulSoup to achieve what you want. Try it and figure out from the docs of these packages how to use them, then come back here with specific questions when things don't work. | 1 | 1 | 0 | Basically I need a tool (preferably for linux) for getting some data from webpage, opening some others, filling form on them, closing windows and clicking on some buttons.
What would be the tool for doing this in whole? Some scripting language like Perl or Python can do it for me?
This is maybe difficult so give me the... | Some scriping language for my task? | 1.2 | 0 | 1 | 135 |
23,590,741 | 2014-05-11T08:56:00.000 | 1 | 0 | 0 | 1 | python,django,apache,virtualhost,mezzanine | 23,596,414 | 1 | true | 1 | 0 | It sounds like you've misconfigured the "sites" section.
Under "sites" in the admin interface, you'll find each configured site. Each of the pages in a site is related to one of these, and matched to the host name you use in the browser.
You'll probably find there's only one site record configured, and its domain does... | 1 | 0 | 0 | I developed my first shop using mezzanine.
If I run it with python manage runserver 0.0.0.0:8000 it works well, but if I try to put an apache virtualhost in front of it, the result I get is awful, because I only see the home page, but not the other ones.
I checked the generated HTML, and it looks very different.
I thin... | mezzanine shop is not shown if behind a virtualhost | 1.2 | 0 | 0 | 66 |
23,591,711 | 2014-05-11T10:54:00.000 | 1 | 0 | 1 | 0 | python,django,django-models | 23,591,861 | 1 | false | 1 | 0 | The GMT offset for Pacific/Auckland is UTC+12 (hours).
datetime.datetime(2014, 5, 4, 12, 0, tzinfo=UTC) represents noon UTC on the 4th. But due to the offet, this is midnight in Auckland. However, midnight in Auckland is in fact "hour 0" on the 5th.
So, yes, the issue does have to do with timezones, but it's in fact n... | 1 | 2 | 0 | I'm just wondering where/what did I do wrong. So here's the scenario.
I have a field date = DateField() then I want to change it to date = DateTimeField() without losing the data stored from it.
What I did:
Add temporary field temp = DatetimeField() then transfer the value from date = DateField() to temp by datamigrat... | datamigration from datefield to datetimefield | 0.197375 | 0 | 0 | 56 |
23,593,173 | 2014-05-11T13:27:00.000 | -1 | 0 | 1 | 0 | python | 23,593,743 | 2 | true | 0 | 0 | well, there's no such thing as a private option. You should just avoid doing python setup.py register by mistake. Aren't you afraid of doing rm -rf / by mistake? or rm /boot/linux*? ;-)
In case you do run python setup.py register by mistake, you can always log on pypi and delete manually your package from the index. | 1 | 7 | 0 | Is there a way to prevent accidental publication of private package such as "private": true in NPM? | How to prevent accidental publish Python pacakge using setup.py | 1.2 | 0 | 0 | 460 |
23,593,618 | 2014-05-11T14:11:00.000 | 0 | 0 | 1 | 0 | python,sql,rdbms | 23,593,850 | 2 | false | 0 | 0 | People usually make use of a Web framework, instead of implementing the basic machinery themselves as you are doing.
That is: Python i s a great language that easily allows one to translate "json into sql" with a small amount of code - and it is great for learning. If you are doing this for educational purposes, it is... | 2 | 0 | 0 | I have a server with a database, the server will listen for http requests, and using JSONs for
data transferring.
Currently, what my server code(python) mainly do is read the JSON file, convert it to SQL and make some modifications to the database. And the function of the server, as I see, is only like a converter bet... | How do people usually operate information on server database? | 0 | 1 | 0 | 46 |
23,593,618 | 2014-05-11T14:11:00.000 | 0 | 0 | 1 | 0 | python,sql,rdbms | 23,593,774 | 2 | false | 0 | 0 | The answer is: people do usually that, what they need to do. The layer between database and client normally provides a higher level api, to make the request independent from the actual database. But how this higher level looks like depends on the application you have. | 2 | 0 | 0 | I have a server with a database, the server will listen for http requests, and using JSONs for
data transferring.
Currently, what my server code(python) mainly do is read the JSON file, convert it to SQL and make some modifications to the database. And the function of the server, as I see, is only like a converter bet... | How do people usually operate information on server database? | 0 | 1 | 0 | 46 |
23,594,048 | 2014-05-11T14:52:00.000 | 6 | 0 | 1 | 0 | python,compilation,pyinstaller | 64,578,211 | 2 | false | 0 | 0 | PyInstaller will generate a .spec file. You can run it first against your one file app and then for future runs reference your edited .spec file
Use one file app:
pyinstaller main.py
Note: this will overwrite main.spec so don't use this on future runs
Use .spec file:
pyinstaller main.spec | 1 | 6 | 0 | How can I specifiy the .spec file while compiling my .py file with PyInstaller using the --onefile and --noconsole options? | How can I specifiy the .spec file in PyInstaller | 1 | 0 | 0 | 11,918 |
23,595,346 | 2014-05-11T16:53:00.000 | 1 | 0 | 1 | 0 | python | 23,595,617 | 2 | false | 0 | 0 | Both python 2.7 and python 3 coexist on one machine happily.
If you name the scripts .py for those you would like to run with python 2.3 and .py3 for those that you would like to run with python3 then you can just invoke the scripts by typing their names or by double clicking. These associations are set up by default ... | 1 | 0 | 0 | I have two versions of Python installed in my computer, Python 3.4 and Python 2.7, and I use both of these installations. When I run a script, how do I choose which versions I want to use? May I rename the names of the executables for that (Python.exe -> Python27.exe)?
Thanks. | Multiple Python versions in one computer (windows 7) | 0.099668 | 0 | 0 | 327 |
23,597,816 | 2014-05-11T20:54:00.000 | 0 | 0 | 0 | 1 | python,git,kivy | 23,609,691 | 1 | false | 0 | 0 | This value is not typically something you would include in a git repo because it is specific to your system. Other people using your repo may have Kivy installed somewhere else, or be on an entirely different OS where that path does not exist. | 1 | 1 | 0 | Create a file named 'py.ini' and place it either in your users application data directory, or in 'C:\Windows'. It will contain the path used to start Kivy.
I put my Kivy installation at 'C:\utils\kivy'
so my copy says:
[commands]
kivy="c:\utils\kivy\kivy.bat"
(You could also add commands to start other script interpret... | Adding Path in GIT for KIVY | 0 | 0 | 0 | 256 |
23,598,452 | 2014-05-11T22:05:00.000 | 2 | 0 | 1 | 0 | python,data-structures | 23,598,489 | 1 | true | 0 | 0 | Currently, GameServer has a set of GameInstances, and GameInstance has a set of players. This requires me to iterate through every game and player to find the correct game, and I don't think this is the best way to do it, because it will have to be run hundreds of times per second.
You're right! And while I will answe... | 1 | 1 | 0 | I am implementing a game server in python. The GameServer class holds multiple game instances, which each hold multiple players. I am trying to figure out the most optimal data structures to use. There is a single function that receives all incoming data, and it needs to find the player within the games, and update the... | How to structure game instance data in Python | 1.2 | 0 | 0 | 111 |
23,599,345 | 2014-05-12T00:16:00.000 | 0 | 0 | 1 | 0 | python | 42,448,823 | 4 | false | 0 | 0 | This line:
self._file = open(self._format_filename())
Should be:
self._file = open(self._format_filename(), self_mode)
This will create a new file and write to it. Without adding 'self_mode' the file is created but there will not open for writing. | 2 | 2 | 0 | I would like to write a script in python which will logging a file, one per day.
It will log gps records and the log file will be a gpx(I have the script for that).
So for today it will create a file named 12-05-2014.gpx and will keep all the gps records until it turns 13-05-2014. Then it will create a new file 13-05-2... | Create log file one every day in python | 0 | 0 | 0 | 5,664 |
23,599,345 | 2014-05-12T00:16:00.000 | 0 | 0 | 1 | 0 | python | 37,257,150 | 4 | false | 0 | 0 | Addition to the presented code:
File needs to be opened in append mode. On Windows and Rapsbian this did not function and I had to change this line:
self._file = open(self._filename)
into:
self._file = open(self._filename, self._mode)
Hope this will help someone to make full use of this.
GWS | 2 | 2 | 0 | I would like to write a script in python which will logging a file, one per day.
It will log gps records and the log file will be a gpx(I have the script for that).
So for today it will create a file named 12-05-2014.gpx and will keep all the gps records until it turns 13-05-2014. Then it will create a new file 13-05-2... | Create log file one every day in python | 0 | 0 | 0 | 5,664 |
23,603,414 | 2014-05-12T07:35:00.000 | 0 | 0 | 0 | 0 | django,python-2.7,apache2,wsgi | 23,625,565 | 1 | false | 1 | 0 | Solved: Changed the django settings. Apparently Debug was False, should be True | 1 | 0 | 0 | When I run 127.0.0.1 on the web (company LAN) I get an 500 page, but the costume one I wrote to my specific django application.
I'm using apache 2.2 with mod_wsgi and django 1.5.1 (Python 2.7). I checked all of my settings so it should work fine but I can't understand why it's still returning a 500.
Appreciate any hel... | Django using mod_wsgi returns my 500 page | 0 | 0 | 0 | 23 |
23,603,762 | 2014-05-12T07:57:00.000 | 0 | 0 | 0 | 0 | python,algorithm | 23,613,409 | 3 | false | 0 | 0 | So the problem is: how many ways can you roll with attributes 12, 13 and 12 and a talent of 7. Lets assume you know the outcome of the first dice, lets say its 11. Then the problem is reduced to how many ways can you roll with attributes 13 and 12 and with a talent of 7. Now try it with a different first roll, lets say... | 1 | 1 | 1 | The Dark Eye is a popular fantasy role-playing game, the German equivalent of Dungeons and Dragons. In this system a character has a number of attributes and talents. Each talent has several attributes associated with it, and to make a talent check the player rolls a d20 (a 20-sided die) for each associated attribute. ... | Dynamic Programming for Dice probability in a Role Playing Pen & Paper game | 0 | 0 | 0 | 1,791 |
23,606,102 | 2014-05-12T10:02:00.000 | 5 | 0 | 0 | 0 | python,postgresql,psycopg2 | 23,606,436 | 1 | true | 0 | 0 | psycopg2 will never prompt for a password - that's a feature of psql, not of the underlying libpq that both psql and psycopg2 use. There's no equvialent of -w / -W because there's no password prompt feature to turn on/off.
If you want to prompt for a password you must do it yourself in your code: trap the exception thr... | 1 | 2 | 0 | Is there an option in psycopg2 (in the connect() method) similar to psql -w (never issue a password prompt) and -W (force psql to prompt for a password before connecting to a database)? | Is there a way to ask the user for a password or not with psycopg2? | 1.2 | 1 | 0 | 1,041 |
23,610,748 | 2014-05-12T13:44:00.000 | 4 | 0 | 0 | 1 | python,google-app-engine | 23,612,408 | 1 | true | 1 | 0 | There's no 100% sure way to assess the number of frontend instance hours. An instance can serve more than one request at a time. In addition, the algorithm of the scheduler (the system that starts the instances) is not documented by Google.
Depending on how demanding your code is, I think you can expect a standard F1 i... | 1 | 0 | 0 | We are developing a Python server on Google App Engine that should be capable of handling incoming HTTP POST requests (around 1,000 to 3,000 per minute in total). Each of the requests will trigger some datastore writing operations. In addition we will write a web-client as a human-usable interface for displaying and an... | GAE: how to quantify Frontend Instance Hours usage? | 1.2 | 0 | 0 | 1,362 |
23,611,310 | 2014-05-12T14:09:00.000 | 3 | 0 | 1 | 0 | python,exception | 23,611,442 | 2 | true | 0 | 0 | Exceptions can model any exception to the normal flow of the code. Errors are the most common use-case, but anything where the normal return type doesn't really make sense can be seen as an opportunity to raise an exception instead.
Raising an exception for non-error use-cases is perfectly fine, if it simplifies your f... | 1 | 2 | 0 | Is it good Python practice to have a function return None most of the time, while exceptionally returning useful values by raising an exception where the values are stored?
I am a little uneasy with this because exceptions are most often used to signal some kind of problem, with some attributes of the exception giving ... | Using exceptions to return exceptional values: is this good practice? | 1.2 | 0 | 0 | 128 |
23,613,260 | 2014-05-12T15:37:00.000 | 1 | 0 | 0 | 0 | javascript,python,css,selenium | 23,649,576 | 1 | true | 0 | 0 | Overflow takes only one of five values (overflow: auto | hidden | scroll | visible | inherit). Use visible | 1 | 1 | 0 | I am trying to use Python Selenium to click a button on a webpage, but Selenium is giving exception "Element is not currently visible and so may not be interacted with".
The DOM structure is quite simple:
<body style="overflow: hidden;">
...
<div aria-hidden="false" style="display: block; ...">
...
... | How to check what is causing a web element to be invisible to Python Selenium? | 1.2 | 0 | 1 | 1,022 |
23,620,930 | 2014-05-13T00:16:00.000 | 4 | 1 | 0 | 0 | php,python,ruby,perl,pointers | 23,620,955 | 3 | true | 0 | 0 | Because pointers, while very versatile, are a pain-in-the-ass source of bugs. The whole point of higher-order languages is abstraction of dangerous or verbose constructs into safer and shorter ones: you trade power for ease of development. Thus, for example, arrays in dynamic languages all know how to allocate themselv... | 3 | 0 | 0 | I was wondering why scripting languages (python,php,ruby,perl) don't have pointers such as C/C++,Objective-C so on? | Why Scripting (Dynamic) Languages Don't Have Pointers? | 1.2 | 0 | 0 | 370 |
23,620,930 | 2014-05-13T00:16:00.000 | 0 | 1 | 0 | 0 | php,python,ruby,perl,pointers | 23,620,990 | 3 | false | 0 | 0 | A major difference between the two categories is that scripting languages don't necessarily deal with things like, say, memory in a direct manner. In your C languages you have memory and have to allocate and manage it. In PHP, however, you don't generally manage your memory directly (and in most cases, the memory usage... | 3 | 0 | 0 | I was wondering why scripting languages (python,php,ruby,perl) don't have pointers such as C/C++,Objective-C so on? | Why Scripting (Dynamic) Languages Don't Have Pointers? | 0 | 0 | 0 | 370 |
23,620,930 | 2014-05-13T00:16:00.000 | 0 | 1 | 0 | 0 | php,python,ruby,perl,pointers | 23,620,951 | 3 | false | 0 | 0 | Question is too general too be answered on Stackoverflow.
But the answer is - scripting languages try to be as hardware independent as they can. And that includes no knowledge of RAM structure and content. | 3 | 0 | 0 | I was wondering why scripting languages (python,php,ruby,perl) don't have pointers such as C/C++,Objective-C so on? | Why Scripting (Dynamic) Languages Don't Have Pointers? | 0 | 0 | 0 | 370 |
23,621,423 | 2014-05-13T01:23:00.000 | 1 | 0 | 1 | 0 | python,arrays,memory-management,anaconda,cellular-automata | 23,622,236 | 2 | false | 0 | 0 | If the grid is sparsely populated, you might be better off tracking just the populated parts, using a different data structure, rather than a giant python list (array). | 2 | 3 | 1 | I have a high intensity model that is written in python, with array calculations involving over 200,000 cells for over 4000 time steps. There are two arrays, one a fine grid array, one a coarser grid mesh, Information from the fine grid array is used to inform the characteristics of the coarse grid mesh. When the progr... | All of Ram being used in a Cellular Automata Python Script | 0.099668 | 0 | 0 | 151 |
23,621,423 | 2014-05-13T01:23:00.000 | 1 | 0 | 1 | 0 | python,arrays,memory-management,anaconda,cellular-automata | 23,622,159 | 2 | false | 0 | 0 | Sounds like your problem is memory management. You're likely writing to your swap file, which would drastically slow down your processing. GPU wouldn't help you with this, as you said you're maxing out your RAM, not your processing (CPU). You probably need to rewrite your algorithm or use different datatypes, but you h... | 2 | 3 | 1 | I have a high intensity model that is written in python, with array calculations involving over 200,000 cells for over 4000 time steps. There are two arrays, one a fine grid array, one a coarser grid mesh, Information from the fine grid array is used to inform the characteristics of the coarse grid mesh. When the progr... | All of Ram being used in a Cellular Automata Python Script | 0.099668 | 0 | 0 | 151 |
23,622,285 | 2014-05-13T03:22:00.000 | 1 | 0 | 0 | 1 | python,path,directory,delete-directory | 23,622,356 | 2 | true | 0 | 0 | Yes, you can do this. The script will be loaded into memory when it runs, so it can delete its parent directory (and therefore itself) directly from the script without any issues. Just use shutil.rmtree rather than os.rmdir, because os.rmdir can't remove a directory that isn't empty.
Here's a one-liner that will do it ... | 2 | 0 | 0 | Is it possible to make a script delete its own folder? clearly there are some issues here but I feel like it might be possible.
Essentially what i'm trying to create is a script that once it's finished doing it's thing that will delete it's own folder and a few other files. But I'm mainly having an issue with trying to... | Making a Script that deletes its own folder when it finishes | 1.2 | 0 | 0 | 123 |
23,622,285 | 2014-05-13T03:22:00.000 | 1 | 0 | 0 | 1 | python,path,directory,delete-directory | 23,622,353 | 2 | false | 0 | 0 | You mean it would delete the entire folder, including the script itself?
Why not invoke the script with a cmd or batch file (on Windows; bash script on *nix) that would first execute the script, and then do whatever cleanup you want to do afterwards? The wrapper file could live in another directory so it would not also... | 2 | 0 | 0 | Is it possible to make a script delete its own folder? clearly there are some issues here but I feel like it might be possible.
Essentially what i'm trying to create is a script that once it's finished doing it's thing that will delete it's own folder and a few other files. But I'm mainly having an issue with trying to... | Making a Script that deletes its own folder when it finishes | 0.099668 | 0 | 0 | 123 |
23,622,923 | 2014-05-13T04:40:00.000 | 5 | 1 | 0 | 0 | python,c++,unit-testing | 23,623,089 | 5 | false | 0 | 1 | It really depends on what it is you are trying to test. It almost always makes sense to write unit tests in the same language as the code you are testing so that you can construct the objects under test or invoke the functions under test, both of which can be most easily done in the same language, and verify that they ... | 5 | 28 | 0 | I have a static library I created from C++, and would like to test this using a Driver code.
I noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.
I would like to take this approach, but I realize... | Is it acceptable practice to unit-test a program in a different language? | 0.197375 | 0 | 0 | 4,198 |
23,622,923 | 2014-05-13T04:40:00.000 | 4 | 1 | 0 | 0 | python,c++,unit-testing | 23,623,087 | 5 | false | 0 | 1 | Why not, it's an awesome idea because you really understand that you are testing the unit like a black box.
Of course there may be technical issues involved, what if you need to mock some parts of the unit under test, that may be difficult in a different language.
This is a common practice for integration tests though... | 5 | 28 | 0 | I have a static library I created from C++, and would like to test this using a Driver code.
I noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.
I would like to take this approach, but I realize... | Is it acceptable practice to unit-test a program in a different language? | 0.158649 | 0 | 0 | 4,198 |
23,622,923 | 2014-05-13T04:40:00.000 | 4 | 1 | 0 | 0 | python,c++,unit-testing | 23,623,031 | 5 | false | 0 | 1 | I would say it depends on what you're actually trying to test. For true unit testing, it is, I think, best to test in the same language, or at least a binary-compatible language (i.e. testing Java with Groovy -- I use Spock in this case, which is Groovy based, to unit-test my Java code, since I can intermingle the Java... | 5 | 28 | 0 | I have a static library I created from C++, and would like to test this using a Driver code.
I noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.
I would like to take this approach, but I realize... | Is it acceptable practice to unit-test a program in a different language? | 0.158649 | 0 | 0 | 4,198 |
23,622,923 | 2014-05-13T04:40:00.000 | 9 | 1 | 0 | 0 | python,c++,unit-testing | 23,623,093 | 5 | false | 0 | 1 | A few things to keep in mind:
If you are writing tests as you code, then, by all means, use whatever language works best to give you rapid feedback. This enables fast test-code cycles (and is fun as well). BUT.
Always have well-written tests in the language of the consumer. How is your client/consumer going to call yo... | 5 | 28 | 0 | I have a static library I created from C++, and would like to test this using a Driver code.
I noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.
I would like to take this approach, but I realize... | Is it acceptable practice to unit-test a program in a different language? | 1 | 0 | 0 | 4,198 |
23,622,923 | 2014-05-13T04:40:00.000 | 28 | 1 | 0 | 0 | python,c++,unit-testing | 23,623,088 | 5 | true | 0 | 1 | I'd say that it's best to test the API that your users will be exposed to. Other tests are good to have as well, but that's the most important aspect.
If your users are going to write C/C++ code linking to your library, then it would be good to have tests making use of your library the same way.
If you are going to shi... | 5 | 28 | 0 | I have a static library I created from C++, and would like to test this using a Driver code.
I noticed one of my professors like to do his tests using python, but he simply executes the program (not a library in this case, but an executable) using random test arguments.
I would like to take this approach, but I realize... | Is it acceptable practice to unit-test a program in a different language? | 1.2 | 0 | 0 | 4,198 |
23,623,717 | 2014-05-13T05:54:00.000 | 0 | 0 | 0 | 0 | python,python-2.7,ubuntu,graphviz | 34,070,637 | 2 | false | 0 | 0 | This is a bug in latest ubuntu xdot package, please use xdot in pip repository:
sudo apt-get remove xdot
sudo pip install xdot | 1 | 0 | 1 | Lately I have observed that xdot utility which is implemented in python to view dot graphs is giving me following error when I am trying to open any dot file.
File "/usr/bin/xdot", line 4, in xdot.main()
File "/usr/lib/python2.7/dist-packages/xdot.py", line 1947, in main win.open_file(args[0])
File "/usr/lib/pytho... | Graphviz xdot utility fails to parse graphs | 0 | 0 | 0 | 1,384 |
23,623,763 | 2014-05-13T05:58:00.000 | 0 | 0 | 1 | 1 | python,crash,installation | 23,644,079 | 1 | false | 0 | 0 | It turns out uninstalling Blender, uninstalling Python, reinstalling Python and then reinstalling Blender(optional) did the trick. Blender 2.70 has some Python 3.4 libraries bundled with it on installation, but I'm guessing for some reason, having an older version of Python already installed caused conflicts/dependenc... | 1 | 0 | 0 | This issue doesn't pertain to any code exactly. I think my installation (python 3.3.5) became corrupted somehow. I've tried uninstalling and reinstalling, as well as repairing, but nothing has worked. It's been a while since I last ran any python code or did anything involving python, really, so I can't say I accide... | pythonw.exe stopped working, can't run IDLE or any .py files | 0 | 0 | 0 | 676 |
23,627,989 | 2014-05-13T09:51:00.000 | 1 | 0 | 0 | 0 | java,python,c++,xml,sax | 23,628,074 | 1 | false | 0 | 0 | Not really sure if this answers your question, but I would take a different approach. 10GB is not THAT much data, so you could implement a two-phase parsing.
Phase 1 would be to split the file in smaller chunks based on some tag, so you end up with more smaller files. For example if your first file is A.xml, you split ... | 1 | 0 | 0 | I'm working on a project that needs to parse a very big XML file (about 10GB). Because process time is really long (about days), It's possible that my code exit in the middle of the process; so I want to save my code's status once in a while and then be able to restart it from last save point.
Is there a way to start (... | restart SAX parser from the middle of the document | 0.197375 | 0 | 1 | 162 |
23,628,936 | 2014-05-13T10:38:00.000 | 0 | 1 | 0 | 0 | python,django | 23,638,267 | 1 | false | 0 | 0 | If you catch that raised exception at the place in your view where you triggered the signal you can then respond with whatever you want in the view. | 1 | 0 | 0 | I'm trying to find a way to interrupt a save and return a HttpResponse from it. So far I've only managed to do this with raising an Exception, but I want to return a propper HttpResponse.
Any ideas? Also looking for any other ways of stopping a save. | Return HttpResponse from pre_save() | 0 | 0 | 0 | 78 |
23,634,759 | 2014-05-13T14:56:00.000 | 8 | 0 | 1 | 0 | python,nlp,nltk | 23,634,933 | 3 | false | 0 | 0 | No there is not. What is more important it is quite a complex problem, which can be a topic of research, and not something that "simple built in function" could solve. Such operation requires semantic analysis of the sentence, think about for example "I think that I could run faster" which of the 3 verbs should be nega... | 1 | 5 | 1 | I am new to NLTK. I would like to create the negative of a sentence (which will usually be in the present tense). For example, is there a function to allow me to convert:
'I run' to 'I do not run'
or
'She runs' to 'She does not run'.
I suppose I could use POS to detect the verb and its preceding pronoun but I just won... | How to create the negative of a sentence in nltk | 1 | 0 | 0 | 2,143 |
23,636,068 | 2014-05-13T15:56:00.000 | 0 | 0 | 0 | 0 | python,mysql,sql,mysql-python | 23,636,177 | 1 | false | 0 | 0 | Step 1 - Make your initial insert into a staging table.
Step 2 - deal with duplicate records and all other issues.
Step 3 - write to your real tables from the staging table. | 1 | 1 | 0 | I have a question in MySQL and Python MySQLdb library:
Suppose I'd like to insert a bulk in to the DB. When I'm inserting, there are possibly a duplicated among the records in the bulk, or a record in the bulk may be a duplicate of a record in the table. In case of duplicates, I'd like to ignore the duplication and jus... | Bulk insert into MySQL on duplicate | 0 | 1 | 0 | 289 |
23,639,085 | 2014-05-13T18:39:00.000 | -2 | 0 | 0 | 0 | python,django,django-manage.py,manage.py | 38,094,213 | 15 | false | 1 | 0 | I was struggling with the same problem and found one solution. I guess it can help you.
when you run python manage.py runserver, it will take 127.0.0.1 as default ip address and 8000 as default port number which can be configured in your python environment.
In your python setting, go to <your python env>\Lib\site-packa... | 3 | 193 | 0 | I would like to make the default port that manage.py runserver listens on specifiable in an extraneous config.ini. Is there an easier fix than parsing sys.argv inside manage.py and inserting the configured port?
The goal is to run ./manage.py runserver without having to specify address and port every time but having it... | django change default runserver port | -0.02666 | 0 | 0 | 268,838 |
23,639,085 | 2014-05-13T18:39:00.000 | -2 | 0 | 0 | 0 | python,django,django-manage.py,manage.py | 26,317,016 | 15 | false | 1 | 0 | This is an old post but for those who are interested:
If you want to change the default port number so when you run the "runserver" command you start with your preferred port do this:
Find your python installation. (you can have multiple pythons installed and you can have your virtual environment version as well so ma... | 3 | 193 | 0 | I would like to make the default port that manage.py runserver listens on specifiable in an extraneous config.ini. Is there an easier fix than parsing sys.argv inside manage.py and inserting the configured port?
The goal is to run ./manage.py runserver without having to specify address and port every time but having it... | django change default runserver port | -0.02666 | 0 | 0 | 268,838 |
23,639,085 | 2014-05-13T18:39:00.000 | 2 | 0 | 0 | 0 | python,django,django-manage.py,manage.py | 36,612,064 | 15 | false | 1 | 0 | I'm very late to the party here, but if you use an IDE like PyCharm, there's an option in 'Edit Configurations' under the 'Run' menu (Run > Edit Configurations) where you can specify a default port. This of course is relevant only if you are debugging/testing through PyCharm. | 3 | 193 | 0 | I would like to make the default port that manage.py runserver listens on specifiable in an extraneous config.ini. Is there an easier fix than parsing sys.argv inside manage.py and inserting the configured port?
The goal is to run ./manage.py runserver without having to specify address and port every time but having it... | django change default runserver port | 0.02666 | 0 | 0 | 268,838 |
23,639,412 | 2014-05-13T18:57:00.000 | 1 | 0 | 0 | 0 | python,django | 23,640,050 | 2 | false | 1 | 0 | This is not strictly an answer to your question, but in general the best practice is to store time in UTC and convert it to whatever timezone you want at display time. This way there is less ambiguity about the time. | 1 | 0 | 0 | Please help!!!
I'm in views have value date by localzone, but in database, the Django was pull date by UTC...
What i'm must do, to push in base date by my local timezone? (my local zone Europe/Kiev)
Please help))) | Django was push in base wrong date | 0.099668 | 0 | 0 | 59 |
23,640,182 | 2014-05-13T19:41:00.000 | 7 | 0 | 1 | 0 | python,pip | 23,642,321 | 3 | true | 0 | 0 | There are few options available
Try simple ignorance
Simply do not care about these packages being present in pip output.
Delete these lines from output
Filter the output through some grep filter and have the result clean.
Use virtualenv and do not install unwanted packages into it
Note, that pip freeze in virtualenv d... | 2 | 12 | 0 | Title basically says it all. How can I tell pip freeze to ignore certain packages, like pylint and pep8, and their dependencies? | Ignore certain packages and their dependencies with pip freeze | 1.2 | 0 | 0 | 9,938 |
23,640,182 | 2014-05-13T19:41:00.000 | 10 | 0 | 1 | 0 | python,pip | 43,137,206 | 3 | false | 0 | 0 | My approach is the following:
I my .bashrc I create the following alias: alias pipfreezeignore='pip freeze | grep -vFxf ignore_requirements.txt'
Create the virtual environment, and install first all the packages that I do not want to keep track of (i.e. pip install jedi flake8 importmagic autopep8 yapf).
Immediately s... | 2 | 12 | 0 | Title basically says it all. How can I tell pip freeze to ignore certain packages, like pylint and pep8, and their dependencies? | Ignore certain packages and their dependencies with pip freeze | 1 | 0 | 0 | 9,938 |
23,643,027 | 2014-05-13T23:04:00.000 | 2 | 0 | 1 | 0 | python,environment-variables,pythonpath | 23,643,251 | 1 | false | 0 | 0 | Definitely do not add your project to site-packages this is going to spoil your system Python installation and will fire back at the moment some other app would come there or you would need to install something.
There are at last two popular options for installing python apps in isolated manner
Using virtualenv
See vir... | 1 | 1 | 0 | I have a Python project which contains three components: main executable scripts, modules which those scripts rely on, and data (sqlite3 databases, flat files, etc.) which those scripts manipulate. The top level has an __init__.py file so that other programs can also borrow from the modules if needed.
The question is,... | Should I add my Python project to the site-packages directory, or append my project to PYTHONPATH? | 0.379949 | 0 | 0 | 392 |
23,644,545 | 2014-05-14T02:11:00.000 | 0 | 0 | 0 | 1 | python,hadoop | 23,644,971 | 2 | false | 0 | 0 | Did not try, but taking the example with KeyFieldBasedPartitioner and simply replacing:
-partitioner org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner
with
-partitioner org.apache.hadoop.mapreduce.lib.partition.TotalOrderPartitioner
Should work. | 1 | 0 | 1 | I'm using python with Hadoop streaming to do a project, and I need the similar functionality provided by the TotalOrderPartitioner and InputSampler in Hadoop, that is, I need to sample the data first and create a partition file, then use the partition file to decide which K-V pair will go to which reducer in the mappe... | Using TotalOrderPartitioner in Hadoop streaming | 0 | 0 | 0 | 909 |
23,645,572 | 2014-05-14T04:19:00.000 | 5 | 0 | 0 | 1 | python,django,google-app-engine | 23,646,875 | 1 | true | 1 | 0 | In simple words these are two versions of datastore . db being the older version and ndb the newer one. The difference is in the models, in the datastore these are the same thing. NDB provides advantages like handling caching (memcache) itself. and ndb is faster than db. so you should definitely go with ndb. to use ndb... | 1 | 2 | 0 | I have been going through the Google App Engine documentation (Python) now and found two different types of storage.
NDB Datastore
DB Datastore
Both quota limits (free) seem to be same, and their database design too. However NDB automatically cache data in Memcache!
I am actually wondering when to use which storage?... | App Engine: Difference between NDB and Datastore | 1.2 | 1 | 0 | 568 |
23,646,485 | 2014-05-14T05:42:00.000 | 1 | 1 | 0 | 0 | python,pyramid,mako,waitress | 23,654,584 | 2 | false | 1 | 1 | Oh my,
I found the thing... I had <%block cached="True" cache_key="${self.filename}+body"> and the file inclusion was inside of that block.
Cheerious:) | 1 | 0 | 0 | I've a strange issue. pserve --reload has stopped reloading the templates. It is reloading if some .py-file is changing, but won't notice .mak-file changes anymore.
I tried to fix it by:
Checking the filepermissions
Creating the new virtualenv, which didn't help.
Installing different version of mako without any effec... | Pyramid Mako pserver --reload not reloading in Mac | 0.099668 | 0 | 0 | 216 |
23,647,516 | 2014-05-14T06:49:00.000 | 1 | 0 | 0 | 1 | python-idle | 41,288,341 | 2 | false | 0 | 0 | I've found that use of character æ, ø, å, even as it is comment out, Python 2.7 IDE won't save the file. | 2 | 1 | 0 | Sometimes I can save a script by using Ctrl+S when using IDLE, but then other times it fails to save for no reason, as haven't changed anything. Is this a bug of some kind? It's starting to irritate me.
Platform: Windows 7 Professional | Ctrl+s does not always save a file on IDLE | 0.099668 | 0 | 0 | 1,776 |
23,647,516 | 2014-05-14T06:49:00.000 | 2 | 0 | 0 | 1 | python-idle | 34,439,578 | 2 | false | 0 | 0 | It may be some character. I faced that same trouble, then I removed some character, such as "Ç" and it worked fine. | 2 | 1 | 0 | Sometimes I can save a script by using Ctrl+S when using IDLE, but then other times it fails to save for no reason, as haven't changed anything. Is this a bug of some kind? It's starting to irritate me.
Platform: Windows 7 Professional | Ctrl+s does not always save a file on IDLE | 0.197375 | 0 | 0 | 1,776 |
23,653,170 | 2014-05-14T11:18:00.000 | 0 | 0 | 1 | 0 | python,gunicorn | 25,699,363 | 1 | false | 1 | 0 | Assuming that by global variable, you mean another process that keeps them in memory or on disk, yes I think so. I haven't checked the source code of Gunicorn, but based on a problem I had with some old piece of code was that several users retrieved the same key from a legacy MyISAM table, incrementing it and creating ... | 1 | 3 | 0 | Is it possible to have multiple workers running with Gunicorn and have them accessing some global variable in an ordered manner i.e. without running into problems with race conditions? | Variable access in gunicorn with multiple workers | 0 | 0 | 0 | 1,514 |
23,654,867 | 2014-05-14T12:31:00.000 | 0 | 0 | 1 | 0 | python,regex,string,python-3.x,lazy-evaluation | 23,654,986 | 2 | false | 0 | 0 | If the number of elements in that list is truly to the order of 10**8 then you are probably better off doing a linear search if you only want to do it once. Otherwise, you have to create this huge string that is really very inefficient. The other thing I can think of if you need to do this more than once is inserting t... | 1 | 2 | 0 | I'm looking for a way to run a regex over a (long) iterable of "characters" in Python. (Python doesn't actually have characters, so it's actually an iterable of one-length strings. But same difference.)
The re module only allows searching over strings (or buffers), as far as I can tell.
I could implement it myself, but... | Is there any streaming regular-expression module for Python? | 0 | 0 | 0 | 127 |
23,656,062 | 2014-05-14T13:27:00.000 | 0 | 0 | 1 | 0 | python,powershell,cmd | 42,074,963 | 5 | false | 0 | 0 | The python file closes because the interpreter encounters an error in the script. To overcome this challenge, simply use Python IDLE program to run your script instead of running from the CLI.
Start Idle, create a new file then open your script and click RUN module from the Run menu.
Hope this is useful. | 1 | 0 | 0 | Tried running this code first through powershell and then through cmd and even simply clicking it. I am typing "start python myfile.py" to run it. In each case, the file blinks on screen and immediately closes.
The only way I can view it is to drag the file directly into cmd, in which case it looks perfect.
I am doing ... | Python file opens and immediately closes | 0 | 0 | 0 | 13,378 |
23,657,718 | 2014-05-14T14:35:00.000 | 1 | 0 | 1 | 0 | python,rest | 23,657,898 | 3 | false | 1 | 0 | Start simple and use the way, which seems to be easy to use for you. Consider optimization to be done later on only if needed.
Use of async libraries would come into play as helpful if you would have thousands of request a second. Much sooner you are likely to have performance problems related to database (if you use i... | 1 | 1 | 0 | I have a REST API and now I want to create a web site that will use this API as only and primary datasource. The system is distributed: REST API is on one group of machines and the site will be on the other(s).
I'm expecting to have quite a lot of load, so I'd like to make requests as efficient, as possible.
Do I need ... | Consume REST API from Python: do I need an async library? | 0.066568 | 0 | 1 | 3,037 |
23,659,248 | 2014-05-14T15:40:00.000 | 0 | 0 | 0 | 1 | python,user-interface,cross-platform | 23,660,787 | 2 | false | 0 | 1 | Firstly, you should always use .pyw for GUIs.
Secondly, you could convert it to .exe if you want people without python to be able to use your program. The process is simple. The hardest part is downloading one of these:
for python 2.x: p2exe
for python 3.x: cx_Freeze
You can simply google instructions on how to use ... | 2 | 1 | 0 | I am developing a simple standalone, graphical application in python. My development has been done on linux but I would like to distribute the application cross-platform.
I have a launcher script which checks a bunch of environment variables and then sets various configuration options, and then calls the application wi... | python or pythonw in creating a cross-platform standalone GUI app | 0 | 0 | 0 | 933 |
23,659,248 | 2014-05-14T15:40:00.000 | 0 | 0 | 0 | 1 | python,user-interface,cross-platform | 23,659,489 | 2 | false | 0 | 1 | If you save the file as main.pyw, it should run the script without opening up a new cmd/terminal.
Then you can run it as python main.pyw | 2 | 1 | 0 | I am developing a simple standalone, graphical application in python. My development has been done on linux but I would like to distribute the application cross-platform.
I have a launcher script which checks a bunch of environment variables and then sets various configuration options, and then calls the application wi... | python or pythonw in creating a cross-platform standalone GUI app | 0 | 0 | 0 | 933 |
23,659,698 | 2014-05-14T16:01:00.000 | 1 | 0 | 0 | 0 | python,scipy,mathematical-optimization,minimize | 23,659,957 | 1 | true | 0 | 0 | You have 2 options I can think of:
opt for constrained optimization
modify your objective function to diverge whenever your numerical simulation does not converge. Basically this means returning a large value, large compared to a 'normal' value, which depends on your problem at hand. minimize will then try to optimize... | 1 | 3 | 1 | I'm using scipy.optimize.minimize for unrestricted optimization of an objective function which receives a couple of parameters and runs a complex numerical simulation based on these parameters. This simulation does not always converge in which case I make the objective function return inf, in some cases, in others NaN.... | Tell scipy.optimize.minimize to fail | 1.2 | 0 | 0 | 2,291 |
23,662,048 | 2014-05-14T18:11:00.000 | 1 | 0 | 0 | 0 | python,windows-8 | 23,662,251 | 3 | true | 0 | 0 | Assuming that you used one of the standard installers for python on windows, .py is already registered and it should just work. Copy it to your desktop and double-click. A console running the program should appear and run as normal. Its still a console app - the the customer wants a gui app, that's a different story.
b... | 2 | 0 | 0 | I have a program called ftpgrab.py. At the command prompt to run it I type:
c:\path\to\python\dir\python.exe ftpgrab.py
Is there a way on Windows 8 to create an icon which I can double-click to run this? | I have a Python program that the customer would like to access as a double clickable desktop icon on Windows 8. How do I do this? 8 | 1.2 | 0 | 0 | 74 |
23,662,048 | 2014-05-14T18:11:00.000 | 2 | 0 | 0 | 0 | python,windows-8 | 23,662,083 | 3 | false | 0 | 0 | create a file named foo.bat;
copy your command to that file and save it;
double click foo.bat... | 2 | 0 | 0 | I have a program called ftpgrab.py. At the command prompt to run it I type:
c:\path\to\python\dir\python.exe ftpgrab.py
Is there a way on Windows 8 to create an icon which I can double-click to run this? | I have a Python program that the customer would like to access as a double clickable desktop icon on Windows 8. How do I do this? 8 | 0.132549 | 0 | 0 | 74 |
23,666,321 | 2014-05-14T22:36:00.000 | 2 | 0 | 0 | 0 | python,django-1.7,django-migrations | 23,666,529 | 1 | true | 1 | 0 | It's done via MIGRATION_MODULES setting.
In my case:
MIGRATION_MODULES = dict([(app, 'migrations.' + app) for app in INSTALLED_APPS]) | 1 | 3 | 0 | In django 1.7, using the provided makemigrations command(not from South), is there a way to change the location of where the generated migration files are stored?
I'm keeping these files under version control and for apps imported from Django's contrib, they get generated right inside the app directory, which resides o... | Change base path of the generated migration files | 1.2 | 0 | 0 | 798 |
23,666,333 | 2014-05-14T22:38:00.000 | 0 | 0 | 0 | 0 | python,camera,pygame,2d-games | 23,671,391 | 2 | false | 0 | 1 | Since I can't have a look into your code, I can't assess how useful this answer will be for you.
My approach for side scroller, moveable maps, etc. is to blit all tiles onto a pygame.Surface spanning the dimensions of the whole level/map/ etc. or at least a big chunk of it. This way I have to blit only one surface per ... | 1 | 0 | 0 | So I've been making a game using Python, specifically the PyGame module. Everything has been going fairly well (except Python's speed, am I right :P), and I've got a nice list of accomplishments from this, but I just ran into a... speedbump. Maybe a mountain. I'm not to sure yet. The problem is:
How do I go about impl... | 2D Game Engine - Implementing a Camera | 0 | 0 | 0 | 2,049 |
23,667,610 | 2014-05-15T01:04:00.000 | 0 | 1 | 1 | 0 | python,unit-testing,python-unittest | 72,185,121 | 3 | false | 0 | 0 | As they mentioned above, setup() and teardown() will run after and before each test. however SetupClass() and TearDownClass() will run only once for the whole class. | 1 | 139 | 0 | What is the difference between setUp() and setUpClass() in the Python unittest framework? Why would setup be handled in one method over the other?
I want to understand what part of setup is done in the setUp() and setUpClass() functions, as well as with tearDown() and tearDownClass(). | What is the difference between setUp() and setUpClass() in Python unittest? | 0 | 0 | 0 | 61,754 |
23,667,700 | 2014-05-15T01:15:00.000 | 3 | 0 | 0 | 0 | python,c++,algorithm,boost | 23,668,100 | 1 | true | 0 | 0 | One rectangle can be divided into two rectangles by drawing either a horizontal or a vertical line. Divide one of those rectangles and the result is three rectangles. Continue until you have N rectangles. Some limitations to observe to improve the results
Don't divide a rectangle with a horizontal line if the height ... | 1 | 0 | 1 | How to split one big rectangle on N smaller rectangles to look random ?
I need to generate couple divisions for different value of n.
Is there library for this in boost for c++ or some for python ? | How to split one big rectangle on N smaller rectangles to look random? | 1.2 | 0 | 0 | 1,261 |
23,673,433 | 2014-05-15T08:50:00.000 | 1 | 0 | 0 | 0 | python,xlsxwriter | 23,674,407 | 1 | true | 0 | 0 | No, such functionality is not what xlsxwriter offers.
This package is able to write Excel files, but as importing HTML you describe is using MS Excell GUI functionality and as MS Excel is not an requirement of xlsxwriter, do not expect it to be present.
On the other hand, you could play with Python to do the conversion... | 1 | 0 | 0 | I just wanted to know if it is possible to insert the contents of a local tabulated html file into an Excel worksheet using xlsxwriter? Manually it works fine by just dragging and dropping the file into Excel and the formatting is clear, but I can't find any information on inserting file contents into Excel using xlsx... | Using Python's xlsxwriter to drop a tabulated html file into worksheet - is this possible? | 1.2 | 1 | 0 | 448 |
23,676,718 | 2014-05-15T11:19:00.000 | 1 | 0 | 0 | 0 | python,django,datetime,timezone | 23,676,984 | 2 | false | 0 | 0 | Yes, you should store everything in your db in UTC.
I don't know why you say you won't be able to cope with DST. On the contrary, any good timezone library - such as pytz - is quite capable of translating UTC to the correct time in any timezone, taking DST into account. | 1 | 0 | 0 | I have an app which will work in multiple timezones. I need the app to be able to say "Do this at 10 PM, 12 April, 2015, in the America/New York timezone and repeat every 30 days." (And similar).
If I get a datetime from the user in PST, should I be storing the datetime in DB after converting to UTC?
Pros: Easier to ma... | Convert datetime to UTC before storing in DB? | 0.099668 | 1 | 0 | 158 |
23,677,734 | 2014-05-15T12:06:00.000 | 8 | 0 | 0 | 0 | python,classification,scikit-learn,feature-selection | 23,682,058 | 1 | true | 0 | 0 | In general the p-value indicates how probable a given outcome or a more extreme outcome is under the null hypothesis. In your case of feature selection, the null hypothesis is something like this feature contains no information about the prediction target, where no information is to be interpreted in the sense of the s... | 1 | 5 | 1 | Recently, I have used sklearn(a python meachine learning library) to do a short-text classification task. I found that SelectKBest class can choose K best of features. However, the first argument of SelectKBest is a score function, which "taking two arrays X and y, and returning a pair of arrays (scores, pvalues)". I k... | What's the meaning of p-values which produced by feature selection (i.e. chi2 method)? | 1.2 | 0 | 0 | 6,714 |
23,678,292 | 2014-05-15T12:30:00.000 | 0 | 1 | 0 | 0 | python,raspberry-pi,google-calendar-api,autostart | 23,686,241 | 1 | true | 0 | 0 | Figured this out now. It's tough, not knowing whether it's a Python, Linux or Google issue, but it was a Google one. I found that other people across the web have had issues with client_secrets.json as well, and the solution is to find where its location is stored in the Python code, and instead of just having the name... | 1 | 0 | 0 | I have written a python tkinter program which runs on my Raspberry Pi, which does a number of things, including interfacing with my google calendar (read only access). I can navigate to the directory it is in and run it there - it works fine.
I would like the program to start at boot-up, so I added it to the autostart ... | Can't auto-start Python program on Raspberry Pi due to Google Calendar | 1.2 | 0 | 0 | 381 |
23,678,753 | 2014-05-15T12:51:00.000 | 0 | 0 | 0 | 0 | python,pyqt,py2exe | 23,681,056 | 1 | false | 0 | 1 | PyQt is essentially a wrapper around Qt.
In theory it should be possible to use Qt without PyQt, but you'd have to make the bindings yourself. | 1 | 0 | 0 | I just used py2exe to compile my python app that uses pyqt. The size of it is 23MB.
The Pyqt libraries (PyQt4.QtCore.pyd, PyQt4.QtGui.pyd, QtCore4.dll and QtGui4.dll) sum more than 17MB.
Is there a way to use QT with a reduced size?
Thank you! | Reduce Size py2exe and pyqt | 0 | 0 | 0 | 475 |
23,679,480 | 2014-05-15T13:19:00.000 | 0 | 0 | 0 | 0 | python,web-scraping,beautifulsoup | 65,200,203 | 2 | false | 1 | 0 | print(soup.find('h1',class_='pdp_product_title'))
does not give any result
<div class="pr2-sm css-1ou6bb2"><h2 class="headline-5-small pb1-sm d-sm-ib css-1ppcdci" data-test="product-sub-title">Women's Shoe</h2><h1 id="pdp_product_title" class="headline-2 css-zis9ta" data-test="product-title">Nike Air Force 1 Shadow</h1... | 1 | 9 | 0 | In mechanize we click links either by using follow_link or click_link. Is there a similar kind of thing in beautiful soup to click a link on a web page? | Clicking link using beautifulsoup in python | 0 | 0 | 1 | 52,594 |
23,679,951 | 2014-05-15T13:38:00.000 | 0 | 0 | 1 | 0 | python,pandas | 23,698,952 | 1 | false | 0 | 0 | Found the best solution:
pd.tools.merge.concat([test.construction,test.ops],join='outer')
Joins along the date index and keeps the different columns. To the extent the column names are the same, it will join 'inner' or 'outer' as specified. | 1 | 0 | 1 | I have two dataframes, each with a series of dates as the index. The dates to not overlap (in other words one date range from, say, 2013-01-01 through 2016-06-15 by month and the second DataFrame will start on 2016-06-15 and run quarterly through 2035-06-15.
Most of the column names overlap (i.e. are the same) and th... | 'combine first' in pandas produces NA error | 0 | 0 | 0 | 373 |
23,680,786 | 2014-05-15T14:12:00.000 | 2 | 0 | 1 | 0 | python,ipython | 30,603,070 | 1 | false | 0 | 0 | If you are connected to the kernel via the IPython console client and are on a Unix-like OS, you can detach using Ctrl-\ | 1 | 4 | 0 | Can someone please tell me how I can detach from an IPython kernel without terminating it?
I see in the documentation of quit() that there is a parameter keep_kernel, but unfortunately quit(keep_kernel=True) won't work. | Detach from IPython kernel without terminating it | 0.379949 | 0 | 0 | 682 |
23,682,222 | 2014-05-15T15:11:00.000 | 2 | 0 | 0 | 0 | python,django | 23,682,246 | 1 | true | 1 | 0 | django is a server side application | 1 | 1 | 0 | Hello :) My task is to write a web framework for a Python program with some massive calculations, which are desired to be executed at proper server and the result should be sent to the browser after it's calculated. My question is - is Django the right framework for that purpose? I tried to find out where Django execut... | Do Django excecute scripts at server or in browser? | 1.2 | 0 | 0 | 44 |
23,687,183 | 2014-05-15T19:37:00.000 | 0 | 0 | 0 | 0 | python | 23,687,339 | 2 | false | 0 | 0 | This problem is a bit underspecified.
Say, you're on some Windows: You could assign the correct python invocation as default open action to the .xml file type, but this would then apply to all .xml files. And you might need elevated access rights to perform the change.
On Linux, you'd have to deal with various ways of ... | 1 | 0 | 0 | I have a project where the goal is to have a user double click on an xml file, which is sent to my python script to work with. What is the best way to do accomplish something like this? Can this even be done programmatically or is this some kind of system preference I have to modify? How can my program retrieve the fil... | Execute Python when double clicking a file | 0 | 0 | 1 | 301 |
23,688,227 | 2014-05-15T20:41:00.000 | 9 | 0 | 0 | 0 | python,matplotlib | 23,688,578 | 1 | true | 0 | 0 | I do not like those layers
pylab : massive namespace dump that pulls in everything from pyplot and numpy. It is not a 'layer' so much as a very cluttered name space.
pyplot : state-machine based layer (it knows what your 'current axes' and 'current figure' are and applies the functions to that axes/figure. You shoul... | 1 | 4 | 1 | In this period I am working with matplotlib. I studied many examples, and was able to modify it to suit several of my needs. But I would like to better understand the general structure of the library. For this reason, apart reading a lot of tutorials on the web, I also purchased the ebook "Matplotlib for Python Develop... | Confusion about Artist place in matplotlib hierarchy | 1.2 | 0 | 0 | 1,693 |
23,691,819 | 2014-05-16T02:43:00.000 | 0 | 0 | 0 | 0 | python,python-3.x,tkinter | 23,704,276 | 1 | false | 0 | 1 | I cannot answer this specifically for 'unlock' event (if there even is one in the GUI; I can't find one by cursory search.).
But I think the real answer is to change the question. Having a program simply take focus when user unlocks the display is very un-Windows-ish behavior. The Windows user expects to see the de... | 1 | 0 | 0 | I have a tkinter program written in python 3.3.3. I see myself in the need of making the the program get focus when the user unlocks the computer. I don't really know how to go ahead and start with this, users have a .exe version of the program that I created with cxfreeze. I f i need to modify the .py and create anoth... | Get focus on tkinter program after pc is unlocked | 0 | 0 | 0 | 100 |
23,695,305 | 2014-05-16T12:45:00.000 | 0 | 0 | 0 | 0 | python,scipy,openshift | 33,723,529 | 1 | false | 0 | 0 | Either add scipy to your setup.py file or login to openshift rhc ssh yourapp and install manually: pip install scipy | 1 | 0 | 0 | I would like to install scipy on openshift but I don't know how to do it. I'm an absolute beginner with python and openshift. Therefore it would be great if somebody could provide a step by step explanation on how to proceed. | install scipy on openshift | 0 | 0 | 0 | 232 |
23,696,185 | 2014-05-16T13:23:00.000 | 0 | 0 | 1 | 1 | python,python-2.7 | 23,697,040 | 1 | true | 0 | 0 | m = s.readline() has \n at the end of line. Then you're doing .format(i, m, values) which writes m in the middle of the string.
I leave it as exercise to the reader to find out what's happening when you're writing such line to a file. :-)
(hint: m = s.readline().rstrip('\n')) | 1 | 0 | 0 | I've been trying to write lines to a file based on specific file names from the same directory, a search of the file names in another log file(given as an input), and the modified date of the files.
The output is limiting me to under 80 characters per line.
def getFiles(flag, file):
if (flag == True):
... | Writing to file limitation on line length | 1.2 | 0 | 0 | 1,868 |
23,699,378 | 2014-05-16T15:40:00.000 | 0 | 0 | 1 | 0 | python,algorithm,permutation,time-complexity,combinatorics | 23,734,414 | 7 | false | 0 | 0 | The first part is straight forward if you work wholly in the lexiographic side of things. Given my answer on the other thread, you can go from a permutation to the factorial representation instantly. Basically, you imagine a list {0,1,2,3} and the number that I need to go along is the factorial representation, so for 1... | 1 | 13 | 1 | I've been working on this for hours but couldn't figure it out.
Define a permutation's degree to be the minimum number of transpositions that need to be composed to create it. So a the degree of (0, 1, 2, 3) is 0, the degree of (0, 1, 3, 2) is 1, the degree of (1, 0, 3, 2) is 2, etc.
Look at the space Snd as the space... | Get permutation with specified degree by index number | 0 | 0 | 0 | 1,866 |
23,702,324 | 2014-05-16T18:31:00.000 | 0 | 0 | 1 | 0 | javascript,python,cocos2d-x,cocos2d-js | 33,130,769 | 4 | false | 1 | 0 | You should know, Chrome is tenacious about caching.
You can turn it off every way they offer, and it will still retain js files you don't want it to.
My advice is to restart your entire browser--not just the tab you're debugging--at least once an hour. | 3 | 4 | 0 | Context:
I'm creating a Cocos2d-JS Game. I have already created the Project and am in development phase.
I can run cocos run -p web or cocos run -p web --source-map from the project directory in the Console. These commands work and allow me to run and test my project.
Problem:
Simply: Code changes I make are not being... | Cocos2D-JS -- Compile and Run a 'Clean' build? | 0 | 0 | 0 | 4,146 |
23,702,324 | 2014-05-16T18:31:00.000 | 7 | 0 | 1 | 0 | javascript,python,cocos2d-x,cocos2d-js | 23,703,216 | 4 | true | 1 | 0 | Fix it: .js files were being Cached by my Browser.
Issue:
Chrome Browser was Caching the .js files. I solved this problem by turning off Caching. I did not realize that the localhost was indeed pointing to the project directory.
Solution: Disable Caching in Chrome:
Menu (top right icon) -> Tools -> Developer Tools -> ... | 3 | 4 | 0 | Context:
I'm creating a Cocos2d-JS Game. I have already created the Project and am in development phase.
I can run cocos run -p web or cocos run -p web --source-map from the project directory in the Console. These commands work and allow me to run and test my project.
Problem:
Simply: Code changes I make are not being... | Cocos2D-JS -- Compile and Run a 'Clean' build? | 1.2 | 0 | 0 | 4,146 |
23,702,324 | 2014-05-16T18:31:00.000 | 0 | 0 | 1 | 0 | javascript,python,cocos2d-x,cocos2d-js | 34,370,929 | 4 | false | 1 | 0 | Yes it was as simple as this, just open the dev tools with F12, then go to settings, do the cache thing, and when you run your game , activate the dev tools again (F12) and refresh the page | 3 | 4 | 0 | Context:
I'm creating a Cocos2d-JS Game. I have already created the Project and am in development phase.
I can run cocos run -p web or cocos run -p web --source-map from the project directory in the Console. These commands work and allow me to run and test my project.
Problem:
Simply: Code changes I make are not being... | Cocos2D-JS -- Compile and Run a 'Clean' build? | 0 | 0 | 0 | 4,146 |
23,703,135 | 2014-05-16T19:24:00.000 | 0 | 0 | 0 | 0 | python,flask | 23,703,319 | 1 | false | 1 | 0 | I see a few solutions:
read /dev/urandom a few times, calculate sha-256 of the number and use it as a file name; collision is extremely improbable
use Redis and command like LPUSH, using it from Python is very easy; then RPOP from right end of the linked list, there's your queue | 1 | 0 | 0 | My web app asks users 3 questions and simple writes that to a file, a1,a2,a3. I also have real time visualization of the average of the data (reads real time from file).
Must I use a database to ensure that no/minimal information is lost? Is it possible to produce a queue of read/writes>(Since files are small I am not ... | Is it possible to make writing to files/reading from files safe for a questionnaire type website? | 0 | 1 | 0 | 31 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.