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,369,108 | 2014-04-29T15:34:00.000 | 0 | 0 | 0 | 1 | python,firefox-addon,firefox-addon-sdk | 24,506,049 | 4 | false | 0 | 0 | Just install Python 2.6 instead of Python 2.7. When i tried with Python 2.7 i got also the same error. Then i removed Python 2.7 and installed Python 2.6. And all worked finely. | 1 | 0 | 0 | I have downloaded Add-on SDK and executed activate.
Python 2.7 is installed. PATH variable is configured properly and py files can run from anywhere.
However, when i am trying to execute cfx (from Far command prompt, using the full path), i get the message: 'python' is not recognized as an internal or external command.... | Running cfx program for Firefox Add-on SDK on Windows | 0 | 0 | 0 | 497 |
23,370,556 | 2014-04-29T16:43:00.000 | -1 | 0 | 1 | 0 | python,audio,pyaudio | 35,827,692 | 2 | false | 1 | 0 | check if the top end 8 bits are 0. If they are not, you have a true 24 bit recording. | 1 | 5 | 0 | I need to record 24-bit audio (because it's the archival standard for audio digitization). However, the wave library seems to only go up to 16-bit.
It looks like pyaudio can work with 24-bit audio but every example I've found shows pyaudio using the wave library, meaning it has to save 16-bit.
Is it possible to record ... | Recording 24-bit audio with pyaudio | -0.099668 | 0 | 0 | 2,262 |
23,374,854 | 2014-04-29T20:42:00.000 | 0 | 1 | 1 | 0 | c#,python,ipc | 62,980,335 | 2 | false | 0 | 0 | Based on the what you have said, you can connect to the python process and catch standard output text. Easy, fast and reliable! | 1 | 5 | 0 | I have some C# code that needs to call a Python script several thousand times, each time passing a string, and then expecting a float back. The python script can be run using ANY version of Python, so I cannot use Iron python. It's been recommended that I use IPC named pipes. I have no experience with this, and am havi... | Simplest way to communicate between Python and C# using IPC? | 0 | 0 | 0 | 9,440 |
23,376,103 | 2014-04-29T22:01:00.000 | 0 | 0 | 0 | 0 | python,mysql,python-3.x,mysql-python,python-3.4 | 49,185,013 | 11 | false | 0 | 0 | for fedora and python3 use: dnf install mysql-connector-python3 | 1 | 53 | 0 | I have installed Python version 3.4.0 and I would like to do a project with MySQL database. I downloaded and tried installing MySQLdb, but it wasn't successful for this version of Python.
Any suggestions how could I fix this problem and install it properly? | Python 3.4.0 with MySQL database | 0 | 1 | 0 | 143,430 |
23,376,816 | 2014-04-29T23:01:00.000 | 3 | 0 | 0 | 0 | python,amazon-s3,zip | 23,376,918 | 5 | false | 0 | 0 | If speed is a concern, a good approach would be to choose an EC2 instance fairly close to your S3 bucket (in the same region) and use that instance to unzip/process your zipped files.
This will allow for a latency reduction and allow you to process them fairly efficiently. You can remove each extracted file after fini... | 1 | 11 | 0 | I have zip files uploaded to S3. I'd like to download them for processing. I don't need to permanently store them, but I need to temporarily process them. How would I go about doing this? | Python S3 download zip file | 0.119427 | 0 | 0 | 24,492 |
23,378,498 | 2014-04-30T02:11:00.000 | 0 | 0 | 0 | 0 | python,django,django-urls | 23,379,239 | 2 | true | 1 | 0 | For 1), if you don't want to do a separate route for every single route on your website, you'll need middleware that implements process_exception and outputs an HttpResponseRedirect.
For 2 and 3, those are rules that are presumably limited to specific routes, so you can do them without middleware.
2 might be doable in ... | 1 | 1 | 0 | Need a little help with my urls.py and other stuff.
How can I replicate this in Django?
1) When user requests a non-existent page it will redirect to one up the directory level. Ex: example.com/somegoodpage/somebadpage should be redirected to example.com/somegoodpage.
2) When user requests page example.com/foo/bar/?n... | Python Django: urls.py questions | 1.2 | 0 | 0 | 173 |
23,379,033 | 2014-04-30T03:13:00.000 | 0 | 0 | 0 | 1 | python,macos,shell,.app | 23,379,138 | 2 | false | 0 | 0 | if your using applescript, just save it as a bundle by save as, and click the drop down saying script, change that to bundle i think. after that, click on the bundle icon in apple script and drag the script to the folder you want. to run it put your run command in and drag the script that you placed in the bundle folde... | 2 | 1 | 0 | I have a script (Shell, chmod-ed to 755. Python is in the script, meaning not run from an outside .py file) that is executable. It works when I run it. How can I make a .app that executes said script on runtime? I have a simple .app that has this structure: APPNAME.App>Contents>MacOS>script
This does not run. Is there ... | Make a Mac .App run a script on running of said .App | 0 | 0 | 0 | 930 |
23,379,033 | 2014-04-30T03:13:00.000 | 1 | 0 | 0 | 1 | python,macos,shell,.app | 23,379,360 | 2 | true | 0 | 0 | Run Automator and create a new Application project.
Add a Run Shell Script action.
In the Shell: list, select the interpreter of choice; /usr/bin/python in this case.
Paste the contents of your Python script into the action and save the *.app bundle. | 2 | 1 | 0 | I have a script (Shell, chmod-ed to 755. Python is in the script, meaning not run from an outside .py file) that is executable. It works when I run it. How can I make a .app that executes said script on runtime? I have a simple .app that has this structure: APPNAME.App>Contents>MacOS>script
This does not run. Is there ... | Make a Mac .App run a script on running of said .App | 1.2 | 0 | 0 | 930 |
23,381,990 | 2014-04-30T07:20:00.000 | 3 | 1 | 0 | 1 | python,rabbitmq,twisted | 23,382,374 | 1 | true | 0 | 0 | If your server is does not receive packets often, it will not improve much - only gain some tiny overhead on inter server communication. Still it is a very good design idea, because it scales well and once you finally get many packets you will just add an instance of data processing server. | 1 | 2 | 0 | I am developing a tcp/ip server whose purpose is receive packets from client, parse them, do some computation(on data arriving in packet) and store it in database. Till now, everything was being done by single server application written using twisted python. Now I am across RabbitMQ so my question is, if it is possible... | Using rabbitmq with twisted | 1.2 | 0 | 0 | 545 |
23,382,499 | 2014-04-30T07:49:00.000 | 3 | 0 | 0 | 0 | python,mysql,database,events | 23,382,595 | 3 | false | 0 | 0 | You can use 'Stored Procedures' in your database a lot of RDBMS engines support one or multiple programming languages to do so. AFAIK postgresql support signals to call external process to. Google something like 'Stored Procedures in Python for PostgreSQL' or 'postgresql trigger call external program' | 1 | 8 | 0 | I'm running a python script that makes modifications in a specific database.
I want to run a second script once there is a modification in my database (local server).
Is there anyway to do that?
Any help would be very appreciated.
Thanks! | Run python script on Database event | 0.197375 | 1 | 0 | 20,648 |
23,383,554 | 2014-04-30T08:44:00.000 | 1 | 0 | 1 | 0 | python,syntax,pycharm | 43,342,637 | 9 | false | 0 | 0 | You can also add particular typo word to PyCharm dictionary by pressing Alt + Enter this word and select Save [typo word] to dictionary. Sometimes this is best choice for me. | 4 | 112 | 0 | Where is the option to disable the spell check on the strings for the PyCharm IDE?
I hate the jagged line under my comments and strings. | How to avoid the spell check on string in Pycharm | 0.022219 | 0 | 0 | 60,750 |
23,383,554 | 2014-04-30T08:44:00.000 | 6 | 0 | 1 | 0 | python,syntax,pycharm | 23,383,853 | 9 | false | 0 | 0 | PyCharm does not check the syntax inside strings and comments. It checks spelling.
You can find the settings of the spell-checker under the Settings... page. There is a Spelling page inside Project Settings. Inside this page, at the bottom of the Dictionaries tab you can enable/disable dictionaries. If you don't want s... | 4 | 112 | 0 | Where is the option to disable the spell check on the strings for the PyCharm IDE?
I hate the jagged line under my comments and strings. | How to avoid the spell check on string in Pycharm | 1 | 0 | 0 | 60,750 |
23,383,554 | 2014-04-30T08:44:00.000 | 2 | 0 | 1 | 0 | python,syntax,pycharm | 58,810,499 | 9 | false | 0 | 0 | In the newer version of PyCharm, go to Preferences -> Editor -> Inspections -> Spelling. | 4 | 112 | 0 | Where is the option to disable the spell check on the strings for the PyCharm IDE?
I hate the jagged line under my comments and strings. | How to avoid the spell check on string in Pycharm | 0.044415 | 0 | 0 | 60,750 |
23,383,554 | 2014-04-30T08:44:00.000 | 0 | 0 | 1 | 0 | python,syntax,pycharm | 71,669,007 | 9 | false | 0 | 0 | For single line you can use the # noqa at the end of the line and it will suppress spelling inspections (the squiggly green line).
GOOFY_API_USERNAME_THING = "LAksdfallae@#lkdaslekserlse#lsese" # noqa
I'm using PyCharm 2021.3.2 | 4 | 112 | 0 | Where is the option to disable the spell check on the strings for the PyCharm IDE?
I hate the jagged line under my comments and strings. | How to avoid the spell check on string in Pycharm | 0 | 0 | 0 | 60,750 |
23,383,569 | 2014-04-30T08:45:00.000 | 1 | 0 | 0 | 0 | django,python-2.7,django-settings | 23,384,956 | 1 | false | 1 | 0 | In your settings.py, add FORCE_SCRIPT_NAME = 'path', where 'path' is the directory where the project resides.
For example, if your site exists at http://john.example.com/mywebsite, settings.py would contain FORCE_SCRIPT_NAME = '/mywebsite'. | 1 | 0 | 0 | I am trying to deploy my django on a server, but this server has an extra tag for the url like this. http://john.example.com/mywebsite instead of http://john.example.com
so whenever I want to redirect from the homepage to other pages, I got error messages because the redirected pages are missing the extra tag /mywebsit... | How to set default url in settings.py for "www.example.com/path" | 0.197375 | 0 | 0 | 617 |
23,383,615 | 2014-04-30T08:47:00.000 | 0 | 0 | 1 | 0 | python,sockets | 23,384,465 | 2 | false | 0 | 0 | Yes you can do this, but mostly people do multiple blocking sockets with threads or multiple non-blocking sockets with event loops. But it should be no problem in switching in-between, as long as you don't switch between buffered and unbuffered I/O. | 2 | 1 | 0 | I would like to start the conversation in blocking mode and later switch to non-blocking.
Is that a stupid idea?
The python docs are kind of ambiguous about it, there it says:
... You do this [setblocking(0)] after creating the socket, but before using it. (Actually, if you’re nuts, you can switch back and forth.)
I ... | switching between blocking and nonblocking on a python socket | 0 | 0 | 1 | 243 |
23,383,615 | 2014-04-30T08:47:00.000 | 0 | 0 | 1 | 0 | python,sockets | 23,384,627 | 2 | false | 0 | 0 | blocking and nonblocking socket are different programming model.
switching between them will make your program too complicated. | 2 | 1 | 0 | I would like to start the conversation in blocking mode and later switch to non-blocking.
Is that a stupid idea?
The python docs are kind of ambiguous about it, there it says:
... You do this [setblocking(0)] after creating the socket, but before using it. (Actually, if you’re nuts, you can switch back and forth.)
I ... | switching between blocking and nonblocking on a python socket | 0 | 0 | 1 | 243 |
23,383,699 | 2014-04-30T08:52:00.000 | 7 | 0 | 1 | 0 | python,warnings,sublimetext3,syntax-checking | 27,613,279 | 4 | false | 0 | 0 | You can use set sublime as:
view -> Indentation -> Convert indentation to spaces
This will enable your tabs to be converted to 4(according your setting) spaces. It works on my machine.
And modify the existing tabs in the file to spaces:
View -> Indentation -> Convert Indentation to Spaces | 1 | 10 | 0 | I didn't find an answer to this question on the web, so I'll say it up front; this is NOT a question about SublimeLinter, and I do NOT want to format my python code according to the PEP8 standards.
How to disable the warning "Indentation contains tabs" in the Python Checker package? | Sublime Text 3 - Disable Python Checker warning "indentation contains tabs" | 1 | 0 | 0 | 21,090 |
23,384,351 | 2014-04-30T09:25:00.000 | 1 | 0 | 1 | 0 | python,regex,python-2.7,sentiment-analysis | 23,384,749 | 3 | false | 0 | 0 | I would not do this with regexp. Rather I would;
Split the input on punctuation characters.
For each fragment do
Set negation counter to 0
Split input into words
For each word
Add negation counter number of NEG_ to the word. (Or mod 2, or 1 if greater than 0)
If original word is in {No,Never,Not} incre... | 2 | 3 | 0 | How do I add the tag NEG_ to all words that follow not, no and never until the next punctuation mark in a string(used for sentiment analysis)? I assume that regular expressions could be used, but I'm not sure how.
Input:It was never going to work, he thought. He did not play so well, so he had to practice some more.
De... | How to add tags to negated words in strings that follow "not", "no" and "never" | 0.066568 | 0 | 0 | 1,678 |
23,384,351 | 2014-04-30T09:25:00.000 | 0 | 0 | 1 | 0 | python,regex,python-2.7,sentiment-analysis | 23,384,819 | 3 | false | 0 | 0 | You will need to do this in several steps (at least in Python - .NET languages can use a regex engine that has more capabilities):
First, match a part of a string starting with not, no or never. The regex \b(?:not?|never)\b([^.,:;!?]+) would be a good starting point. You might need to add more punctuation characters t... | 2 | 3 | 0 | How do I add the tag NEG_ to all words that follow not, no and never until the next punctuation mark in a string(used for sentiment analysis)? I assume that regular expressions could be used, but I'm not sure how.
Input:It was never going to work, he thought. He did not play so well, so he had to practice some more.
De... | How to add tags to negated words in strings that follow "not", "no" and "never" | 0 | 0 | 0 | 1,678 |
23,385,917 | 2014-04-30T10:39:00.000 | 0 | 0 | 0 | 0 | python,menu,process,nuke | 23,422,211 | 2 | false | 1 | 0 | Turns out that I have to write out inside the menu.py file instead of init.py file.
And for some reasons, the naming convention - 'Show Primary Grade' works despite me unable to find the pass name for it even though I am able to track down its gizmo file... | 1 | 2 | 0 | I am trying to set my viewerProcess option to be 'Show Primary Grade' instead of 'Film' whenever my nuke is booted
However, due to the limiting information I am able to find on the net, I tried inserting the following code nuke.knobDefault("viewerProcess", "Show Primary Grade") in the init.py but I am unable to get it ... | setting custom viewerProcess fails | 0 | 0 | 0 | 902 |
23,386,550 | 2014-04-30T11:11:00.000 | 1 | 0 | 0 | 0 | python,django,debugging,ipdb | 23,388,104 | 1 | true | 1 | 0 | I'd ensure I've killed the runserver/gunicorn and restarted it cleanly, to ensure there are no threads that are still running ipdb. (if you're using django-devserver, for instance, that's multi-threaded) | 1 | 0 | 0 | Ihave problem with IPDB. I comment out it after I do not use it but after I run the web page after single refresh the debbuger is fired anyway. I have to referesh at least two times or so, to force django not willing going into debugging.
additionally I am expiriencing extremlly often error: [Errno 32] Broken pipe
(if ... | django import ipdb; ipdb.set_trace(); still want to run debugger even if commented. WHY? | 1.2 | 0 | 0 | 1,057 |
23,386,831 | 2014-04-30T11:24:00.000 | 12 | 0 | 1 | 0 | python,reload,interpreter | 23,386,923 | 4 | true | 0 | 0 | If you import as import foo as f in the first place, then the reload call can be reload(f) | 1 | 8 | 0 | Messing around in the interpreter, it would be useful for me to be able to do something along the lines of reload(foo) as f, though I know it is not possible. Just like I do import foo as f, is there a way to do it?
Using Python 2.6
Thanks! | Is it possible to reload a python module as something? | 1.2 | 0 | 0 | 2,114 |
23,388,509 | 2014-04-30T12:46:00.000 | 1 | 0 | 1 | 0 | python | 23,388,853 | 2 | false | 0 | 0 | You can think of it this way: "Duck Typing" applies to the type of a variable, not of the variable's contents. A string variable is something that can for example be indexed with [] or added to other strings with + and even repeated several times with * {some integer}, but you can't add a string to an integer, even if ... | 1 | 0 | 0 | I'm new to using Python (and dynamically typed languages in general) and I'm having trouble with the my variables being incorrectly-typed at run time. The program I've written accepts 6 variables (all should be integers) and performs a series of calculations using them. However, the interpreter refuses to perform the f... | How do I make my program acknowledge that a variable contains an integer in Python | 0.099668 | 0 | 0 | 61 |
23,388,647 | 2014-04-30T12:53:00.000 | 1 | 0 | 0 | 0 | python,sqlite,pygtk | 23,389,055 | 1 | true | 0 | 1 | AFAIK, WinXP supports setlocale just fine.
If you want to do locale-aware conversions, try using locale.atof('2,34') instead of float('2,34'). | 1 | 0 | 0 | I'm trying to use the data collected by a form I to a sqlite query. In this form I've made a spin button which gets any numeric input (ie. either2,34 or 2.34) and sends it in the form of 2,34 which python sees as str.
I've already tried to float() the value but it doesn't work. It seems to be a locale problem but someh... | pygtk spinbutton "greek" floating point | 1.2 | 1 | 0 | 48 |
23,388,810 | 2014-04-30T13:00:00.000 | 2 | 0 | 1 | 0 | python,ipython,ipython-notebook | 41,843,805 | 9 | false | 0 | 0 | just use the print command instead of calling the list directly. Like print mylist . It would not truncate then. | 2 | 64 | 0 | I have a long list (about 4000 items) whose content is suppressed when I try to display it in an ipython notebook output cell. Maybe two-thirds is shown, but the end has a "...]", rather than all the contents of the list. How do I get ipython notebook to display the whole list instead of a cutoff version? | IPython Notebook output cell is truncating contents of my list | 0.044415 | 0 | 0 | 121,706 |
23,388,810 | 2014-04-30T13:00:00.000 | 6 | 0 | 1 | 0 | python,ipython,ipython-notebook | 63,039,619 | 9 | false | 0 | 0 | For cases where the output of print(mylist) is something like [1, 1, 1, ..., 1, 1, 1] then [*mylist] will expand the items into rows where all items are visible. | 2 | 64 | 0 | I have a long list (about 4000 items) whose content is suppressed when I try to display it in an ipython notebook output cell. Maybe two-thirds is shown, but the end has a "...]", rather than all the contents of the list. How do I get ipython notebook to display the whole list instead of a cutoff version? | IPython Notebook output cell is truncating contents of my list | 1 | 0 | 0 | 121,706 |
23,392,591 | 2014-04-30T15:47:00.000 | 5 | 0 | 1 | 0 | python,inheritance | 23,392,692 | 1 | true | 0 | 0 | Yes, potentially you might want to skip the immediate superclass method, but still call the methods further up the hierarchy. This might happen for example when you know you have replaced the logic with your own, and calling the superclass method would be pointless or even harmful. | 1 | 2 | 0 | I know that in Python 3, you can write super() and Python automatically passes the correct arguments to super.
It's also possible to introduce subtle bugs by accidentally writing super(Parent, self).
Are there any scenarios where you wouldn't want to pass the current class as the first argument to super? | Would you ever pass anything other than (MyClass, self) to super()? | 1.2 | 0 | 0 | 44 |
23,393,456 | 2014-04-30T16:31:00.000 | 0 | 0 | 0 | 0 | python,machine-learning,statistics,categorization | 23,421,883 | 1 | true | 0 | 0 | The principled way to do this is to assign probabilities to different model types and to different parameters within a model type. Look for "Bayesian model estimation". | 1 | 0 | 1 | My problem is as follows:
I am given a number of chi-squared values for the same collection of data sets, fitted with different models. (so, for example, for 5 collections of points, fitted with either a single binomial distribution, or both binomial and normal distributions, I would have 10 chi-squared values).
I woul... | Categorizing points using known distributions | 1.2 | 0 | 0 | 52 |
23,393,532 | 2014-04-30T16:35:00.000 | 0 | 0 | 0 | 1 | python,fabric | 23,403,551 | 1 | false | 0 | 0 | Looks like you have your /usr/local/bin directory set to 777 or world writable. This is very bad, lock it down to 755 and owned by root at the very least. | 1 | 0 | 0 | When i try to run a simple deploy this message error comes to me:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Usage: fab mapfile [options]
Please specify a valid map file.
I am not ... | Usage: fab mapfile [options] Please specify a valid map file | 0 | 0 | 0 | 92 |
23,394,785 | 2014-04-30T17:48:00.000 | 3 | 0 | 0 | 0 | python,testing,sqlalchemy | 23,702,417 | 1 | true | 0 | 0 | The scoped session manager will by default return the same session object for each connection. Accordingly, one can replace .commit with .flush, and have that change persist across invocations to the session manager.
That will prevent commits.
To then rollback all changes, one should use session.transaction.rollback(). | 1 | 3 | 0 | I'm using fixtures with SQLAlchemy to create some integration tests.
I'd like to put SQLAlchemy into a "never commit" mode to prevent changes ever being written to the database, so that my tests are completely isolated from each other. Is there a way to do this?
My initial thoughts are that perhaps I could replace Sess... | sqlalchemy - force it to NEVER commit? | 1.2 | 1 | 0 | 838 |
23,395,679 | 2014-04-30T18:40:00.000 | 2 | 1 | 0 | 0 | python,file-comparison | 23,396,192 | 2 | false | 0 | 0 | the "report generating" methods of dircmp.filecmp don't accept a file object, they just use the print statement (or, in the Python 3 version, the print() function)
You could create a subclass of dircmp.filecmp which accepts a file argument to methods report, report_full_closure and report_partial_closure (if needed), a... | 1 | 2 | 0 | I'd like to output a series of dircmp report_full_disclosure()'s to a text file. However the report_full_disclosure() format is one blob of text, it doesn't play nicely with file.write(comparison_object.report_full_disclosure()) because file.write() expects a single line to write to the file.
I've tried iterating throu... | How do write filecmp's report_full_disclosure() to a text file? | 0.197375 | 0 | 0 | 1,224 |
23,396,807 | 2014-04-30T19:47:00.000 | 1 | 0 | 0 | 0 | python,nlp,nltk | 23,396,854 | 1 | false | 0 | 0 | In short "you cannot". This task is far beyond simple text processing which is provided with NLTK. Such objects relations sentiment analysis could be the topic of the research paper, not something solvable with a simple approach. One possible method would be to perform a grammar analysis, extraction of the conceptual r... | 1 | 0 | 1 | I'm using NLTK to extract named entities and I'm wondering how it would be possible to determine the sentiment between entities in the same sentence. So for example for "Jon loves Paris." i would get two entities Jon and Paris. How would I be able to determine the sentiment between these two entities? In this case shou... | How to determine the "sentiment" between two named entities with Python/NLTK? | 0.197375 | 0 | 0 | 301 |
23,397,090 | 2014-04-30T20:04:00.000 | 0 | 0 | 0 | 0 | python,django,forms,selenium | 45,631,061 | 2 | false | 1 | 0 | I guess it depends on how deep down the rabbit hole you want to go.
If you're building a test for the functional side from the user's perspective, and your GET action results in changes on the webpage, then trigger the submit with selenium, then wait for the changes to propagate to the webpage (like waiting for one/mo... | 1 | 3 | 0 | I'm using Selenium (python bindings, with Django) for automated web app testing. My page has a form with a button, and the button has a .click() handler that captures the click (i.e. the form is not immediately submitted). The handler runs function2(), and when function2() is done, it submits the form.
In my test wi... | How to detect POST after form submit in Selenium python? | 0 | 0 | 1 | 2,251 |
23,399,888 | 2014-04-30T23:38:00.000 | 1 | 0 | 1 | 0 | python,path,console,ipython | 23,588,025 | 2 | true | 0 | 0 | I am pulling the answer out of the comments.
Point your PATH system variable to the correct version of Python. This is accomplished (on Windows) by going to System Properties -> Advanced -> Environment Variables. If you already have a Python directory in there, modify it to the correct, new path. Otherwise, append it t... | 1 | 0 | 0 | I've been using ipython notebook with console2 for a while now and recently installed a different version of python and now my console is giving me an error saying "No module named IPython". I think the path has been changed or something, but I don't know how to fix it. Any help is greatly appreciated! | ipython console2 no module named Ipython | 1.2 | 0 | 0 | 1,050 |
23,406,340 | 2014-05-01T10:58:00.000 | 0 | 0 | 1 | 0 | c#,visual-studio,ironpython | 23,409,623 | 1 | true | 0 | 0 | As Pawel said, IronPython uses a complex build system to handle all of the platforms it supports and make it easy-ish to add new ones (at least until IronPython and the DLR can be refactored into portable libraries ... sometime around 2016). In this case you need to dig through a couple of levels of imports to find whe... | 1 | 0 | 0 | I am building ironpython3 with Visual Studio 2013. In the references Visual Studio shows a yellow triangle on Microsoft.Scripting.Core reference. Since I read this reference has been moved to System.Core I simply removed the reference to Microsoft.Scripting.Core. The project builds just fine without this reference.
But... | Cannot remove a reference in Visual Studio 2013 | 1.2 | 0 | 0 | 1,489 |
23,415,765 | 2014-05-01T20:10:00.000 | 0 | 0 | 0 | 0 | wxpython,panel | 23,416,753 | 1 | true | 0 | 1 | There are a couple of approaches. The first is to just create all of the panels that you need and hide them as you've been doing. Another approach would be to create the sizers with the widgets laid out appropriately and just hide the sizers as needed. This way you would only ever have one or two panels, but different ... | 1 | 0 | 0 | I do not have any code to show with this question because I am just seeking advice. I have a functional piece of code and through the execution of which I create approx 20 - 30 unique panels. I only use one at any given time (with a few small exceptions) and I use show/hide to manage which panels are displayed at a g... | wxpython create multiple panels at start or as the program progresses | 1.2 | 0 | 0 | 16 |
23,418,949 | 2014-05-02T00:33:00.000 | 21 | 0 | 1 | 0 | module,pygame,python-2.5,attributeerror,traceback | 31,551,977 | 1 | true | 0 | 1 | I think there is a python file named "copy" in your directory. I had the same problem, after I delete the "copy" file, the error has gone. | 1 | 6 | 0 | I encountered Error: 'module' object has no attribute 'copy' while running a pygame program. In my code, I never referred to a copy attribute, so I don't understand where the error is coming from. | Pygame AttributeError: 'module' object has no attribute 'copy' | 1.2 | 0 | 0 | 11,076 |
23,419,967 | 2014-05-02T02:46:00.000 | 7 | 1 | 1 | 0 | python,profiling | 24,132,022 | 2 | false | 0 | 0 | Here is my understanding:
RCalls number of recursive calls
Local Total time spent on local execution (without calling another method)
/Call Local time per call
Cum Total cumulative time
/Call Cumulative time per call | 1 | 8 | 0 | This may be really obvious but just wanted to make sure I understand what the columns are in runsnakerun.
Name, Calls, RCalls, Local, /Call, Cum, /Call, File, Line, Directory
Here are some that I think I understand
Name - name of function being called
Calls - number of calls?
File - file where the function is stored
L... | Python profiling - What are the columns in runsnakerun output? | 1 | 0 | 0 | 1,257 |
23,421,959 | 2014-05-02T06:17:00.000 | 0 | 0 | 0 | 0 | python,openerp-7 | 23,443,504 | 1 | false | 1 | 0 | You can use webkit reports,
Install report_webkit module in OpenERP
Install wkhtmltopdf
in terminal type, sudo apt-get install wkhtmltopdf
in terminal type which wkhtmltopdf and copy the path
in OpenERP, Go to Settings->Technical->Parameters->System Parameters
And create a new record with key 'webkit_path' and paste t... | 1 | 0 | 0 | I wanted to know whats is the process of creating reports in my openerp-7 module. Do I have to install some specific module for reporting or is there any default configuration ? I want to create reports of my forms . Like if I want to create report in form view then what am I suppose to do .
Hopes for suggestion
... | How to create reports of form view in Openerp-7? | 0 | 0 | 0 | 480 |
23,422,259 | 2014-05-02T06:40:00.000 | 0 | 0 | 0 | 0 | python,firefox,drag-and-drop,selenium-webdriver | 23,422,482 | 1 | false | 0 | 0 | Is drag and drop working manually when you open page in firefox? It may happen page has changed. | 1 | 1 | 0 | Drag and drop feature is not working in test framework. It is working for last 6 months and all of a sudden this feature alone of Selenium is not working.
Previously my selenium version 2.33 and upgraded to latest 2.41.0. Still it is not working
All other actions say double click, filling text box etc are working fine.... | Python Selenium Webdriver: Drag and drop failing | 0 | 0 | 1 | 291 |
23,423,582 | 2014-05-02T08:11:00.000 | 0 | 0 | 0 | 0 | python,web-crawler,scrapy | 37,941,838 | 2 | true | 1 | 0 | HtmlAgilityPack helped me in parsing and reading Xpath for the reviews. It worked :) | 1 | 0 | 0 | I am using scrapy to scrape reviews about books from a site. Till now i have made a crawler and scraped comments of a single book by giving its url as starting url by myself and i even had to give tags of comments about that book by myself after finding it from page's source code. Ant it worked. But the problem is that... | Comments scraping without using Api | 1.2 | 0 | 1 | 514 |
23,426,515 | 2014-05-02T10:59:00.000 | 0 | 0 | 0 | 0 | python,django,web-services,openerp,xmlrpclib | 23,648,694 | 2 | false | 1 | 0 | Aternatively you can promote datetime.date() to datetime.datetime() before sending the reply. | 1 | 2 | 0 | I am trying save record from django (front-end) to openerp (back-end). I am using openerp webservice using xmlrpclib. It works well with normal string and number data, but when i tried to pass date field, it throws error. cannot marshal <type 'datetime.date'> objects
Please help me.. | cannot marshal objects | 0 | 0 | 0 | 4,577 |
23,426,916 | 2014-05-02T11:20:00.000 | 1 | 0 | 0 | 0 | python,django,mezzanine,cartridge | 23,427,146 | 1 | true | 1 | 0 | The products most likely aren't published, but can be previewed by an authenticated administrator.
Check the "status" and "published from" fields for each product. | 1 | 0 | 0 | I am trying to develop a small project to learn how mezzanine and cartridge work.
I have the problem that items in the shop are listed only if I am logged in, while I'd like to be able to show them to unauthorized users.
Is there a setting that has to be toggled? | Products are not shown if the user is not logged in | 1.2 | 0 | 0 | 56 |
23,427,939 | 2014-05-02T12:14:00.000 | 3 | 0 | 0 | 0 | python,qt,pyqt | 23,436,083 | 2 | true | 0 | 1 | You can call QApplication::setStyle("windows") before creating QApplication object to set a style by name. However, Qt on Linux is usually built without modern Windows styles, so it's possible that the best you will accomplish is the classic (old) Windows style, which is not very attractive. You can also try to use "fu... | 2 | 0 | 0 | How can I make a PyQt5 application to look like the same when run on Windows, and Linux?
I would prefer the Windows style on both systems.
Thanks | Make PyQt application look like the same on Windows and Linux | 1.2 | 0 | 0 | 1,984 |
23,427,939 | 2014-05-02T12:14:00.000 | 0 | 0 | 0 | 0 | python,qt,pyqt | 23,474,604 | 2 | false | 0 | 1 | You can use existing styles mentioned above
or you can specify the styles of your widgets using Stylesheet, which is quite powerful. | 2 | 0 | 0 | How can I make a PyQt5 application to look like the same when run on Windows, and Linux?
I would prefer the Windows style on both systems.
Thanks | Make PyQt application look like the same on Windows and Linux | 0 | 0 | 0 | 1,984 |
23,428,618 | 2014-05-02T12:49:00.000 | 8 | 0 | 0 | 0 | python,sqlite,treeview | 23,489,182 | 1 | true | 0 | 1 | Finally I managed to figure this out, so I post this answer to my own question in case someone finds it helpful:
All I had to do was to .clear the list_store, rebuild it and use set_model to the TreeView.
The refresh function goes as below:
liststore.clear()
create_model_checks() # re-create liststore
treeView.set_mode... | 1 | 6 | 0 | I finally managed to write a little app that reads from a sqlite database and show the results to a treeview. Another form (in another module) gives the ability to write new or update existing records. After writing to the database it closes the window
What I'm trying to do now is to update the "main" window (containin... | pygtk treeview contents update/refresh | 1.2 | 0 | 0 | 3,427 |
23,436,414 | 2014-05-02T20:28:00.000 | 2 | 0 | 1 | 0 | python,url,cherrypy | 23,436,508 | 1 | true | 0 | 0 | Turns out using an _ in the method definition works as a dot/period. This does mean I have to have two function definitions if I want to be able to call it either with or without the .py, but since I can easily call the one function from the other, this is a minor quibble. | 1 | 1 | 0 | Is there a way to get CherryPy to respond to a url that includes a period, such as http://some/base/path/oldscript.py ? I have a number of old CGI scripts that were called like that, and I'm trying to roll them into a nice pretty CherryPy web app - but I don't want to break all the bookmarks and the like that still poi... | cherrypy: respond to url that includes a dot? | 1.2 | 0 | 1 | 450 |
23,437,084 | 2014-05-02T21:16:00.000 | 2 | 0 | 0 | 0 | python,urllib2 | 23,437,205 | 2 | true | 0 | 0 | There's nothing wrong with using try/except. That's the way to do such things in python.
it's easier to ask forgiveness than permission | 1 | 2 | 0 | Is there a way beyond catching exceptions(HTTPError,URLError), to check if access to a url is permitted.
I have to constantly(every 30 secs) ping a url (using urllib2.open)(which might or might not be valid).
And throwing and catching exceptions each time seems excessive. I couldn't find anything in the documentation. | Python: Checking if you can connect to a given url (urllib2) | 1.2 | 0 | 1 | 121 |
23,439,474 | 2014-05-03T02:08:00.000 | 0 | 0 | 0 | 0 | python,pygame,alpha | 23,485,047 | 1 | true | 0 | 1 | It is possible that you have already thought of this and have decided against it, but it would obviously run far better in real time if the polygons were pre-drawn. Presuming there aren't very many different types of polygons, you could even resize them however you need and you would be saving CPU.
Also, assuming that ... | 1 | 2 | 0 | I have a scene, and I need to be able to overlay the scene with translucent polygons (which can be done easily using pygame.gfxdraw.filled_polygon which supports drawing with alpha), but the catch is that the amount of translucency has to fade over a distance (so for example, if the alpha value is 255 at one end of the... | Gradient alpha polygon with pygame | 1.2 | 0 | 0 | 948 |
23,440,391 | 2014-05-03T04:49:00.000 | 0 | 0 | 0 | 1 | python,sublimetext2 | 23,440,406 | 2 | false | 0 | 0 | Just add raw_input("Press ENTER to exit") and it will "pause" until you press a key. You should be able to add this line anywhere and as often as needed. | 1 | 0 | 0 | I was learning python use sublime text2 dev.
when I code "hello world" and build it, the "cmd"window appears and disappears in a moment.
I want to make the output hold on,but I don't know how.
help me, thank you. | how to prevent the window from self-close when building program in sublime | 0 | 0 | 0 | 302 |
23,441,657 | 2014-05-03T07:44:00.000 | 124 | 0 | 1 | 0 | python,pycharm | 45,199,074 | 6 | false | 0 | 0 | I found out an easier way.
go to File -> Settings -> Keymap
Search for Execute Selection in Console and reassign it to a new shortcut, like Crl + Enter.
This is the same shortcut to the same action in Spyder and R-Studio. | 2 | 106 | 0 | Is it possible to run only a part of a program in PyCharm?
In other editors there is something like a cell which I can run, but I can't find such an option in PyCharm?
If this function doesn't exist it would be a huge drawback for me... Because for my data analysis I very often only need to run the last few lines of my... | Pycharm: run only part of my Python file | 1 | 0 | 0 | 152,784 |
23,441,657 | 2014-05-03T07:44:00.000 | 25 | 0 | 1 | 0 | python,pycharm | 23,442,815 | 6 | false | 0 | 0 | You can select a code snippet and use right click menu to choose the action "Execute Selection in console". | 2 | 106 | 0 | Is it possible to run only a part of a program in PyCharm?
In other editors there is something like a cell which I can run, but I can't find such an option in PyCharm?
If this function doesn't exist it would be a huge drawback for me... Because for my data analysis I very often only need to run the last few lines of my... | Pycharm: run only part of my Python file | 1 | 0 | 0 | 152,784 |
23,448,140 | 2014-05-03T18:11:00.000 | 0 | 0 | 0 | 0 | string,listbox,wxpython | 23,455,859 | 2 | false | 0 | 1 | Than you very much! I have fixed it! If somebody will have the same problem you must change OnDelete code (The first code in question) for this:
def OnDelete(self, event):
sel = self.listbox.GetSelection()
f = open("Save/savegame.txt", "r")
read = f.readlines()
f.close()
name ... | 1 | 0 | 0 | I have very complicated problem. I´ve search whole internet and tried everything, but nothing worked. I want get string from listbox and than delete line in file with word from listbox. Can please somebody help me? Here is code:
def OnDelete(self, event):
sel = self.listbox.GetSelection()
if sel != -1:... | How to get string from listbox | 0 | 0 | 0 | 817 |
23,453,650 | 2014-05-04T07:16:00.000 | 0 | 1 | 0 | 0 | python,zeromq | 23,468,773 | 1 | false | 0 | 0 | You shouldn't be able to bind more than once to the same port number, either from the same process or another.
ZMQ should give a failure when you issue bind with a port number already in use. Are you checking return codes? | 1 | 0 | 0 | I have a ZMQ server listening on port 12345 TCP. When another server connects on that port locally or via VM it works fine, but if I try from a remote server that has to go through port forwarding on my Fios firewall it just bombs. The packets are showing up in Wireshark but ZMQ just ignores them. Is there anyway to ge... | Incoming ZeroMQ traffic dropped by server due to NAT? | 0 | 0 | 1 | 144 |
23,453,735 | 2014-05-04T07:27:00.000 | 0 | 1 | 1 | 0 | python,ldap,python-ldap | 23,841,869 | 1 | true | 0 | 0 | As stated by Guntram Blohm, it is not possible to delete object classes on existing objects because doing that would invalidate the schema checks that the server did when creating the object. So the way to do it will be to delete the object and create a new one. This is a property of the server and the client libraries... | 1 | 0 | 0 | I am using Python-LDAP module to interact with my LDAP server. How can I remove an objectClass from an entry using python-ldap? When I generated a modlist with modlist.modifyModlist({'objectClass':'inetLocalMailRecipient},{'objectClass' : ''}) , it just generates (1, 'objectClass', None) which obviously doesn't seem co... | How to remove an objectClass from an entry using python-ldap? | 1.2 | 0 | 0 | 615 |
23,454,496 | 2014-05-04T09:13:00.000 | 0 | 0 | 0 | 0 | python,parsing,html-parsing,beautifulsoup | 23,464,291 | 2 | false | 1 | 0 | Your solution is really going to be specific to each website page you want to scrape, so, without knowing the websites of interest, the only thing I could really suggest would be to inspect the page source of each page you want to scrape and look if the article is contained in some html element with a specific attribut... | 1 | 0 | 0 | I have built a program for summarization that utilizes a parser to parse from multiple websites at a time. I extract only <p> in each article.
This throws out a lot of random content that is unrelated to the article. I've seen several people who can parse any article perfectly. How can i do it? I am using Beautiful So... | Parsing multiple News articles | 0 | 0 | 1 | 917 |
23,454,521 | 2014-05-04T09:16:00.000 | 0 | 1 | 0 | 0 | python,linux,web,flask,raspberry-pi | 23,454,864 | 2 | false | 1 | 0 | Best practice is to never do this kind of thing. If you are giving sudo access to your pi from internet and then executing user input you are giving everyone in the internet the possibility of executing arbitrary commands in your system. I understand that this is probably your pet project, but still imagine someone get... | 1 | 0 | 0 | I have created a web-app using Python Flask framework on Raspberry Pi running Raspbian. I want to control the hardware and trigger some sudo tasks on the Pi through web.
The Flask based server runs in non-sudo mode listening to port 8080. When a web client sends request through HTTP, I want to start a subprocess with s... | How to start a privileged process through web on the server? | 0 | 0 | 0 | 166 |
23,457,532 | 2014-05-04T14:43:00.000 | 2 | 1 | 1 | 0 | python,pycharm | 23,457,554 | 3 | false | 1 | 0 | I'd suggest you to use composition instead of inheritance. Then you design class's interface and decide which methods are available. | 1 | 5 | 0 | I am making a programming framework (based on Django) that is intended for students with limited programming experience. Students are supposed to inherit from my base classes (which themselves are inherited from Django models, forms, and views).
I am testing this out now with some students, and the problem is that when... | In Python, can I hide a base class's members? | 0.132549 | 0 | 0 | 1,650 |
23,458,792 | 2014-05-04T16:42:00.000 | 5 | 0 | 0 | 0 | python,scikit-learn | 23,472,135 | 1 | true | 0 | 0 | There's no hard limit to the number of iterations for LogisticRegression; instead it tries to detect convergence with a specified tolerance, tol: the smaller tol, the longer the algorithm will run.
From the source code, I gather that the algorithms stops when the norm of the objective's gradient is less than tol times ... | 1 | 4 | 1 | I'm using scikit-learn to train classifiers. I'm particularly using linear_model.LogisticRegression. But my question is: what's the stopping criteria for the training?! because I don't see any parameter that indicates the number of epochs!
Also the same for random forests? | When does fit() stop running in scikit? | 1.2 | 0 | 0 | 1,201 |
23,462,833 | 2014-05-04T23:39:00.000 | 2 | 1 | 1 | 0 | python,c++ | 23,462,868 | 1 | false | 0 | 0 | No, the PyObjects don't generate code -- it is just a c struct that holds the information of that particular Python object. You can inspect them in your C++ debugger.
I'm experienced with py embedding. The docs seem clear. Don't really get what your problem is. | 1 | 0 | 0 | I am learning how to run Python through C++ and I'm having a hard time getting a handle on things. Is there a way to output the code that is generated by the various PyObjects? I'm not very experienced with embedding, so the documentation went a bit over my head. | Debugging Python extended on C++ | 0.379949 | 0 | 0 | 35 |
23,464,220 | 2014-05-05T03:13:00.000 | 1 | 0 | 0 | 0 | image,drag-and-drop,wxpython | 23,479,767 | 1 | true | 0 | 1 | I think you could use a wx.Panel without any issues. There is a CustomDragAndDrop example in the wxPython demo that shows how to drag and drop images from one wx.Window to another. A wx.Panel is a type of wx.Window and I would think it would be better to use anyway. I would give that a try. | 1 | 0 | 0 | I am using wxPython for a board game. And want to drag chessman over positions.
What is the container I should use? Should I put image for chessman in its own panel or as button or somewhere? | wxPython -- Drag and Drop image between position-fixed containers, what is the suitable container? | 1.2 | 0 | 0 | 68 |
23,467,213 | 2014-05-05T07:36:00.000 | 1 | 0 | 1 | 0 | python,documentation,distutils | 23,501,164 | 1 | true | 0 | 0 | Installing docs is not supported by distutils. These days it seems more important to publish them online than to install them on the target system though, so if you’re set up to use Reat The Docs or upload docs to PyPI, you’re good. | 1 | 2 | 0 | I'm publishing a few Python packages internally and I would like to include API documentation, currently in .rst form, but might go for Sphinx-generated HTML in the future. I need more details than I can reasonably put into a docstring (background info, tutorial examples, etc), so I've written it out long-hand.
I have ... | Installing Python package documentation | 1.2 | 0 | 0 | 209 |
23,467,814 | 2014-05-05T08:12:00.000 | 0 | 0 | 0 | 0 | python,c++,openscenegraph | 23,624,458 | 3 | true | 0 | 1 | Finally I managed to solve this issue by creating a new python type (python extension) and using Node Visitors to assign node references upon creation. | 1 | 0 | 0 | I am working with an embedded python system which requires a C++ frontend using OpenSceneGraph for rendering visualizations. My question is:
Is there any possible way to perform this task? I need to modify C++ osg nodes from Python. Would it be an option to create wrappers for this osg nodes? If this is the answer cou... | How can I use C++ OSG objects from Python? | 1.2 | 0 | 0 | 741 |
23,468,132 | 2014-05-05T08:33:00.000 | 0 | 0 | 0 | 0 | python,django,mercurial | 23,479,318 | 1 | false | 1 | 0 | This is something you should fix at the web application level, not at the Mercurial level. If you're fine with having people wait you set up a distributed locking scheme where the web worker thread tries to acquire a repository-specific lock from shared memory/storage before taking any actions. If it can't acquire th... | 1 | 0 | 0 | Our Django project provides interfaces to users to create repository
create new repo
add new changes to existing repo
Any user can access any repo to make changes directly via an HTTP POST containing changes.
Its totally fine if the traffic is less. But if the traffic increases up to the point that multiple users wan... | Django: Atomic operations on a directory in media storage | 0 | 0 | 0 | 37 |
23,477,570 | 2014-05-05T16:40:00.000 | 4 | 1 | 0 | 1 | python,cron,flask,openshift,nohup | 23,485,693 | 1 | true | 1 | 0 | I'm lazy. Cut and paste :)
I have been told 5 minutes is the limit for the free accounts. That includes all background processes. I asked a similar question here on SO. | 1 | 3 | 0 | I have a long-running daily cron on OpenShift. It takes a couple hours to run. I've added nohup and I'm running it in the background. It still seems to timeout at the default 5 minutes (It works appropriately for this time). I'm receiving no errors and it works perfectly fine locally.
nohup python ${OPENSHIFT_REPO_DI... | Long-running Openshift Cron | 1.2 | 0 | 0 | 629 |
23,478,266 | 2014-05-05T17:31:00.000 | 10 | 0 | 1 | 0 | python,pydev,python-import | 23,481,504 | 1 | true | 0 | 0 | The problem seems to be coming from pylint. Error disappears if I add: # pylint: disable-msg=E0611 to the line | 1 | 5 | 0 | I'm getting a 'No-name-in-module' import error whenever I try to import linalg from scipy
I have no trouble importing scipy or anything else from scipy. For some reason it doesn't like linalg. Oddly, eclipse includes linalg under auto-completion.
I have tried:
Removing the interpreter and then adding it again
Adding s... | 'No-name-in-module' import error | 1.2 | 0 | 0 | 9,320 |
23,479,021 | 2014-05-05T18:14:00.000 | 0 | 0 | 1 | 1 | python-2.7,python-3.x,windows-7 | 23,479,112 | 2 | false | 0 | 0 | To make sure that you are always running python 3, you can modify your Windows PATH Environment variable to include the python 3 directory, and remove the python 2 directory. | 1 | 1 | 0 | I have python 2.7.6 and python 3.4 installed on windows 7 machine.
When I open command prompt for windows and type python, python 2.7.6 starts by default.
I have a python script which I want to compile (or interpret officially speaking) using python 3.4.
Is there a command to use python 3.4 from c:/ prompt? or make 3.4... | Forcing a python program to interpret using python 3 | 0 | 0 | 0 | 161 |
23,482,115 | 2014-05-05T21:20:00.000 | 6 | 0 | 1 | 1 | python,multiprocessing | 25,519,766 | 1 | false | 0 | 0 | For me the error was actually that my receiving process had thrown an exception and terminated, and so the sending process was receiving an EOFError, meaning that the interprocess communication pipeline had closed. | 1 | 5 | 0 | I have a bunch of clients connecting to a server via 0MQ. I have a Manager queue used for a pool of workers to communicate back to the main process on each client machine.
On just one client machine having 250 worker processes, I see a bunch of EOFError's almost instantly. They occur at the point that the put() is bein... | EOFError with multiprocessing Manager | 1 | 0 | 0 | 5,086 |
23,489,412 | 2014-05-06T08:17:00.000 | 1 | 0 | 1 | 0 | python,multithreading | 23,489,517 | 1 | false | 0 | 0 | The underlying file handle generated when opening a file can be used for reading at one point of the file only. You cannot read multiple offset with the same file handle.
So you should use one thread reading the file while other threads read a kind of queue generated by the first thread with the file buffers. | 1 | 0 | 0 | i will like to design my platform to calculate something and the structure is ,
one big file (maybe 5gb or 10gb)
20 threading and execute different algorithm
the current structure of mine is 20 thread open the big file by itself
and then read line by line to execute by each thread
however, i would like to design a ne... | How can design multithreading and read same input | 0.197375 | 0 | 0 | 43 |
23,491,608 | 2014-05-06T10:04:00.000 | 1 | 1 | 0 | 0 | python,c++,mysql,c | 23,493,503 | 3 | false | 0 | 1 | Not the answer you expected, but i have been down that road and advise KISS:
First make it work in the most simple way possible.
Only than look into speeding things up later / complicating the design.
There are lots of other ways to phrase this such as "do not fix hypothetical problems unless resources are unlimited"... | 3 | 4 | 0 | I'm implementing an algorithm into my Python web application, and it includes doing some (possibly) large clustering and matrix calculations. I've seen that Python can use C/C++ libraries, and thought that it might be a good idea to utilize this to speed things up.
First: Are there any reasons not to, or anything I sh... | Using C/C++ for heavy calculations in Python (Also MySQL) | 0.066568 | 0 | 0 | 1,084 |
23,491,608 | 2014-05-06T10:04:00.000 | 1 | 1 | 0 | 0 | python,c++,mysql,c | 23,497,013 | 3 | true | 0 | 1 | Use the ecosystem.
For matrices, using numpy and scipy can provide approximately the same range of functionality as tools like Matlab. If you learn to write idiomatic code with these modules, the inner loops can take place in the C or FORTRAN implementations of the modules, resulting in C-like overall performance with ... | 3 | 4 | 0 | I'm implementing an algorithm into my Python web application, and it includes doing some (possibly) large clustering and matrix calculations. I've seen that Python can use C/C++ libraries, and thought that it might be a good idea to utilize this to speed things up.
First: Are there any reasons not to, or anything I sh... | Using C/C++ for heavy calculations in Python (Also MySQL) | 1.2 | 0 | 0 | 1,084 |
23,491,608 | 2014-05-06T10:04:00.000 | 1 | 1 | 0 | 0 | python,c++,mysql,c | 23,497,054 | 3 | false | 0 | 1 | cython support for c++ is much better than what it was. You can use most of the standard library in cython seamlessly. There are up to 500x speedups in the extreme best case.
My experience is that it is best to keep the cython code extremely thin, and forward all arguments to c++. It is much easier to debug c++ direct... | 3 | 4 | 0 | I'm implementing an algorithm into my Python web application, and it includes doing some (possibly) large clustering and matrix calculations. I've seen that Python can use C/C++ libraries, and thought that it might be a good idea to utilize this to speed things up.
First: Are there any reasons not to, or anything I sh... | Using C/C++ for heavy calculations in Python (Also MySQL) | 0.066568 | 0 | 0 | 1,084 |
23,492,589 | 2014-05-06T10:48:00.000 | 1 | 1 | 0 | 1 | python,path,absolute-path | 23,492,856 | 2 | true | 0 | 0 | you could change your current working directory inside the script before you start calling your relative imports, use os.chdir("absolute path on where your script lives"). | 2 | 0 | 0 | I realise this question may already exist, but the answers I've found haven't worked and I have a slightly different setup.
I have a python file /home/pi/python_games/frontend.py that I am trying to start when lxde loads by placing @python /home/pi/python_games/frontend.py in /etc/xdg/lxsession/LXDE/autostart.
It doesn... | Starting a python script on boot (startx) with an absolute path, in which there are relative paths | 1.2 | 0 | 0 | 751 |
23,492,589 | 2014-05-06T10:48:00.000 | 0 | 1 | 0 | 1 | python,path,absolute-path | 23,496,772 | 2 | false | 0 | 0 | Rather than change your current working directory, in yourfrontend.pyscript you could use the value of the predefined__file__module attribute, which will be the absolute pathname of the script file, to determine absolute paths to the other files in the same directory.
Functions in theos.pathmodule, such assplit()andjoi... | 2 | 0 | 0 | I realise this question may already exist, but the answers I've found haven't worked and I have a slightly different setup.
I have a python file /home/pi/python_games/frontend.py that I am trying to start when lxde loads by placing @python /home/pi/python_games/frontend.py in /etc/xdg/lxsession/LXDE/autostart.
It doesn... | Starting a python script on boot (startx) with an absolute path, in which there are relative paths | 0 | 0 | 0 | 751 |
23,497,255 | 2014-05-06T14:15:00.000 | 1 | 0 | 1 | 0 | python,exception | 23,497,677 | 2 | false | 0 | 0 | Only an uncaught exception will terminate a program. If you raise an exception that your 3rd-party software is not prepared to catch and handle, the program will terminate. Raising an exception is like a soft abort: you don't know how to handle the error, but you give anyone using your code the opportunity to do so rat... | 1 | 1 | 0 | Does invoking a raise statement in python cause the program to exit with traceback or continue the program from next statement? I want to raise an exception but continue with the remainder program.
Well I need this because I am running the program in a thirdparty system and I want the exception to be thrown yet contin... | Does raising a manual exception in a python program terminate it? | 0.099668 | 0 | 0 | 1,370 |
23,498,086 | 2014-05-06T14:53:00.000 | 2 | 0 | 1 | 1 | python,ubuntu,pip,virtualenv,packages | 23,498,202 | 2 | true | 0 | 0 | apt-get update updates packages from Ubuntu package catalog, which has nothing to do with mainstream versions.
LTS in Ubuntu stands for Long Term Support. Which means that after a certain period in time they will only release security-related bugfixes to the packages. In general, major version of packages will not chan... | 1 | 2 | 0 | I'm trying to install pip and virtualenv on a server (running Ubuntu 12.04.4 LTS) on which I have access, but I can only do it with sudo apt-get install (school politics). The problem is that althought I have run the sudo apt-get update command to update the packages list, I think it keeps installing old ones. After do... | apt-get installing older version of packages (Ubuntu) | 1.2 | 0 | 0 | 3,744 |
23,500,942 | 2014-05-06T17:16:00.000 | 1 | 0 | 0 | 0 | python,apache | 23,501,387 | 1 | false | 1 | 0 | It looks like your application is using zmq to bind to some port.
As you have suspected already, each request can be run as independent process, thus competing in access to the port to bind to.
There can be so called workers, each running one process processing http/wsgi requests, and each trying to bind.
You shall red... | 1 | 0 | 0 | I have a python web application running on apache2 deployed with mod_wsgi. The application has a thread continuously running. This thread is a ZeroMQ thread and listening to a port in loop. The application is not maintaining session. Now if I open the browser and sends a request to the apache server the data is accepte... | How does apache runs a application when a request comes in? | 0.197375 | 0 | 0 | 54 |
23,503,667 | 2014-05-06T19:49:00.000 | 3 | 1 | 0 | 0 | python,math,numpy,scipy | 23,552,362 | 4 | false | 0 | 0 | Approach #3: Compute the QR decomposition of AT
In general, to find an orthogonal basis of the range space of some matrix X, one can compute the QR decomposition of this matrix (using Givens rotations or Householder reflectors). Q is an orthogonal matrix and R upper triangular. The columns of Q corresponding to non-zer... | 1 | 7 | 1 | I can test the rank of a matrix using np.linalg.matrix_rank(A) . But how can I test if all the rows of A are orthogonal efficiently?
I could take all pairs of rows and compute the inner product between them but is there a better way?
My matrix has fewer rows than columns and the rows are not unit vectors. | How to detect if all the rows of a non-square matrix are orthogonal in python | 0.148885 | 0 | 0 | 7,018 |
23,507,196 | 2014-05-07T01:25:00.000 | 0 | 0 | 0 | 0 | php,python,sockets | 23,507,273 | 1 | true | 0 | 0 | I've decided it would be better if I still do the HTTP request, but depending on what the request returned, I could have the client send a packet to the server telling it to give the specific user a notification.
For example, if I tried adding user ID #323095643, I send the HTTP request and everything turns out okay an... | 1 | 0 | 0 | I'm working on a game that allows you to add other users as your friend. The game is in Flash AS2 and the server is Python.
I'm currently hoping to make it so the game sends an HTTP request to an API server that will then verify everything, such as if they're already friends, if they can be friends, etc, and then if e... | Communicating to Socket Server From External Script | 1.2 | 0 | 1 | 41 |
23,508,360 | 2014-05-07T03:47:00.000 | 1 | 0 | 1 | 0 | python,fwrite | 23,508,435 | 3 | false | 0 | 0 | One way to do it is the append the new data at the end of the existing file. If you catch an error , delete all that you appended.
If no errors, delete everything that you had before appending so the new file will have only the appended data.
Create a copy of your file before starting capturing the data in a new file. | 2 | 0 | 0 | I need to write data to a file and overwrite it if file exists. In case of an error my code should catch an exception and restore original file (if applicable)
How can I restore file? Should I read original one and put content i.e. in a list and then in case of an exception just write this list to a file?
Are there any... | Restore original file in case of an error | 0.066568 | 0 | 0 | 186 |
23,508,360 | 2014-05-07T03:47:00.000 | 1 | 0 | 1 | 0 | python,fwrite | 23,508,401 | 3 | false | 0 | 0 | Any attempt to restore on error will be fragile; what if your program can't continue or encounters another error when attempting to restore the data?
A better solution would be to not replace the original file until you know that whatever you're doing succeeded. Write whatever you need to to a temporary file, then w... | 2 | 0 | 0 | I need to write data to a file and overwrite it if file exists. In case of an error my code should catch an exception and restore original file (if applicable)
How can I restore file? Should I read original one and put content i.e. in a list and then in case of an exception just write this list to a file?
Are there any... | Restore original file in case of an error | 0.066568 | 0 | 0 | 186 |
23,510,212 | 2014-05-07T06:21:00.000 | 2 | 0 | 0 | 0 | python,flask,amazon-dynamodb | 23,512,512 | 1 | false | 1 | 0 | No. SQLite is just one option for backend storage. SQLite is mentioned in the tutorial only for its simplicity in getting something working fast and simply on a typical local developers environment. (No db to or service to install/configure etc.) | 1 | 0 | 0 | I am writing a small web application using Flask and I have to use DynamoDB as backend for some hard requirements.
I went through the tutorial on Flask website without establishing sqlite connection. All data were pulled directly from DynamoDB and it seemed to work.
Since I am new to web development in general and Flas... | Use Flask with Amazon DynamoDB without SQLite | 0.379949 | 1 | 0 | 637 |
23,513,981 | 2014-05-07T09:31:00.000 | 0 | 0 | 0 | 1 | python,github | 23,514,046 | 3 | false | 0 | 0 | .sh is a shell script, you can just execute it.
./setup.sh | 2 | 0 | 0 | I have downloaded and unzip the cabot(python tool) in my linux system.But then I don't know how to install it.In the cabot folder there is setup.sh file. But when I put build or install it is not working.So What to do? | How to install cabot in linux | 0 | 0 | 0 | 1,740 |
23,513,981 | 2014-05-07T09:31:00.000 | 0 | 0 | 0 | 1 | python,github | 23,514,107 | 3 | false | 0 | 0 | It's an ".sh" file right?
Then to run the same what you have to do is :-
1)Open Terminal
2)Change directory to file location
3) run the following command.
sh setup.sh | 2 | 0 | 0 | I have downloaded and unzip the cabot(python tool) in my linux system.But then I don't know how to install it.In the cabot folder there is setup.sh file. But when I put build or install it is not working.So What to do? | How to install cabot in linux | 0 | 0 | 0 | 1,740 |
23,515,224 | 2014-05-07T10:26:00.000 | 1 | 1 | 0 | 1 | python,linux | 23,515,529 | 1 | true | 0 | 0 | If you are using logrotate for log rotation then it has options to remove old files, if not you could run something as simple as this once a day in your cron:
find /path/to/log/folder -mtime +5 -type f -exec rm {} \;
Or more specific match a pattern in the filename
find . -mtime +5 -type f -name *.log -exec ls -l ... | 1 | 0 | 0 | I have two questions about using crontab file:
1.I am using a service. When it runs, a new log file created everyday in a log directory. i want to delete all files that already exist greater 5 day in that log directory
2.I want to delete all the infomation that exist greater than 5 days in a log file( /var/log/syslog)
... | How to delete some file with crontab in linux | 1.2 | 0 | 0 | 374 |
23,526,579 | 2014-05-07T19:25:00.000 | 1 | 0 | 0 | 0 | python,scrapy,scrapyd | 24,659,705 | 1 | false | 1 | 0 | Maybe you should do a cron job that executes every three hours and performs a curl call to Scrapyd to schedule the job. | 1 | 0 | 0 | I want to make my spider start every three hours.
I have a scrapy confinguration file located in c:/scrapyd folder.
I changed the poll_interval to 100
the spider works, but it didn't repeat each 100 seconds.
how to do that please? | scrapyd pool_intervel to scheduler a spider | 0.197375 | 0 | 1 | 215 |
23,529,212 | 2014-05-07T21:56:00.000 | 2 | 0 | 0 | 0 | scripting,mysql-python | 23,529,243 | 1 | true | 0 | 0 | you can just separate the queries with a semi-column and run them as a batch. | 1 | 0 | 0 | I have a mysql database with some huge tables, i have a task that I must run three queries one after another and the last one exports to the outfile.csv.
i.e.
Query 1. Select values from some tables with certain parameter. then write into a new table. aprox 4.5 hours
Query 2. After the first one is done, then use the ... | How to automatically run chain multiple mysql queries | 1.2 | 1 | 0 | 121 |
23,530,254 | 2014-05-07T23:36:00.000 | 2 | 0 | 1 | 1 | python,macos,homebrew | 23,530,352 | 2 | false | 0 | 0 | Use pip inside of the virtualenv and it will isolate the packages to just that virtualenv. Each virtualenv has a local version of pip and will install the packages locally. | 1 | 0 | 0 | Is there anyway I can use homewbrew to install packages (like numpy or matplotlib) into isolated virtual environments created using virtualenv, without having the packaged installed system wide. | Use homebrew to install applications to virtual enviornment | 0.197375 | 0 | 0 | 55 |
23,531,555 | 2014-05-08T02:09:00.000 | 0 | 1 | 0 | 0 | python,emacs,virtualenv,org-mode | 23,557,258 | 1 | false | 1 | 0 | Reads like a bug, please consider reporting it at emacs-orgmode@gnu.org
As a workaround try setting the virtualenv at the Python-side, i.e. give PYTHONPATH as argument.
Alternatively, mark the source-block as region and execute it the common way, surpassing org | 1 | 1 | 0 | I'm running into a few issues on my Emacs + Org mode + Python setup. I thought I'd put this out there to see if the community had any suggestions.
Virtualenv:
I'm trying to execute a python script within a SRC block using a virtual environment instead of my system's python implementation. I have a number of libraries i... | Run python from virtualenv in org file & HTML5 export in org v.7.9.3 | 0 | 0 | 0 | 510 |
23,532,399 | 2014-05-08T03:49:00.000 | 0 | 0 | 0 | 1 | python,websocket,tornado | 23,540,966 | 1 | false | 0 | 0 | If you will only ever have one connection, you can call IOLoop.current().stop() from your WebSocketHandler's on_close method. If you need more than one you can increment a counter in open(), decrement it in on_close(), and stop the IOLoop when it reaches zero. | 1 | 0 | 0 | I want to start a temporary web app when there is a connection comes, stop it when there is no connection and timeout.
I use python tornado WebSocketHandler, anyone can help? An example will be helpfull. | How to stop tornado web app when there is no connection? | 0 | 0 | 0 | 53 |
23,534,594 | 2014-05-08T06:42:00.000 | 0 | 1 | 1 | 0 | python,file-io,newline | 23,535,129 | 1 | false | 0 | 0 | The mode attribute is left intact when opening files. I expect you could check if newlines exists and mode contains 'U'. Other translations are indicated by encoding. | 1 | 0 | 0 | How can I see if a file-like object is in universal newline mode or not (or any details related to that)?
Both Python 2 and/or 3 answers are okay.
Hint: No, the newlines attribute does not reflect this. It is always there when the Python interpreter has universal newlines support. | How to see whether a file was opened in universal newlines mode? (Or whatever newline translations it is doing?) | 0 | 0 | 0 | 54 |
23,537,731 | 2014-05-08T09:24:00.000 | 0 | 0 | 0 | 1 | python,multithreading,concurrency,tornado,gevent | 23,543,454 | 1 | false | 0 | 0 | If by ssh you mean actually running the ssh process, try tornado.process.Subprocess. If you want something more integrated into the server, twisted has an asynchronous ssh implementation. If you're using something like paramiko, threads are probably your best bet. | 1 | 1 | 0 | Scenario:
My server/application needs to handle multiple concurrent requests and for each request the server opens an ssh link to another m/c, runs a long command and sends the result back.
1 HTTP request comes → server starts 1 SSH connection → waits long time → sends back the SSH result as HTTP response
This should h... | Handle multiple HTTP connections and a heavy blocking function like SSH | 0 | 0 | 0 | 289 |
23,542,821 | 2014-05-08T13:13:00.000 | 0 | 0 | 1 | 0 | python,django,pycharm | 23,542,926 | 1 | false | 0 | 0 | I'm not sure I understand exactly what your question is.
Look under the VCS menu selection at the top or the Change tab on the bottom. All merge activities are handled by the built in source code management clients for either Subversion or Git.
I think JetBrains clients for Subversion and Git are top shelf. | 1 | 0 | 0 | Is it possible to merge to files, one from remote repository, other local, if I've already applied merging?
I can't find any function in Pycharm menu for that. | Pycharm - Merge again | 0 | 0 | 0 | 118 |
23,544,818 | 2014-05-08T14:32:00.000 | 0 | 0 | 1 | 0 | python,setuptools | 23,544,854 | 2 | false | 0 | 0 | No it wouldn't. If you have 2 files in the same directory, they can import each other. | 1 | 0 | 0 | I have seen a few packages on github that does something like this:
from setuptools import setup, find_packages
import mypackage
setup(name="mypackage", version=mypackage.__version__ ..
This would fail as mypackage when running "python setup.py develop" as mypackage has not been installed yet. Is there a way to fix thi... | How do you list down a python dependency that depends on itself? | 0 | 0 | 0 | 63 |
23,547,783 | 2014-05-08T16:44:00.000 | 2 | 0 | 0 | 0 | python,django,django-rest-framework | 23,548,216 | 1 | true | 1 | 0 | This is not a question about Django REST, but about Django itself.
The problem with extending the User object directly is that it is already a concrete model, so extending it will use multi-table inheritance. That's not usually a good idea - especially if you're further extending it.
AbstractUser is an abstract model,... | 1 | 2 | 0 | I am using Django REST to create users for my app.
Everywhere i look at, for users they extend AbstractBaseUser.
I tried extending the User model, and it seems to work just fine.
I have an PersonalAbstractUser that extends the Django User. Then, Worker and Client extends PersonalAbstractUser.
Login and custom permissi... | Why not to extend User in Django REST | 1.2 | 0 | 0 | 74 |
23,548,149 | 2014-05-08T17:03:00.000 | 0 | 0 | 0 | 1 | python,sockets,udp,ip,openshift | 23,548,201 | 2 | false | 0 | 0 | That will not work on OpenShift, we only offer two kinds of external ports for use, http/https and ws/wss | 1 | 1 | 0 | I had built a python udp hole puncher using raw socket and I wonder whether is there a service, or an option to use an external server, on the web(like dedicated server) that will host and run this program.
openshift was something i considered but it did not work because it uses apache is a proxy and therefore its imp... | Server host for python raw sockets use | 0 | 0 | 1 | 287 |
23,548,519 | 2014-05-08T17:21:00.000 | 2 | 0 | 0 | 0 | python,django,security | 23,548,585 | 1 | true | 1 | 0 | This is not really suited for StackOveflow; but the suggestion I would make is to take the parts of your code that are subject to audit; write them as a Python C module which is then imported. You can ship the compiled module along with your normal, unmodified django application.
This would only work if certain parts o... | 1 | 2 | 0 | Here's the deal: I have a Python application for business written in Django. It's not in Cloud, customers should install them at their own servers.
However, Brazil IT laws for tax payment calculation softwares forces me to homologate every piece of code (in this case, every file.py). They generate a MD5 hash and if a c... | Allow customers to see Python code, but secure modification | 1.2 | 0 | 0 | 65 |
23,550,613 | 2014-05-08T19:14:00.000 | 1 | 0 | 0 | 0 | python,pyqt4 | 23,551,836 | 3 | false | 0 | 1 | I think that you can afford generating a new TextEdit content from the relevant data, every time something changes. That should be very easy to implement. QCursors and stuff like that is good for editable QTextEdits which is not true in your case. And there is no guarantee that it will be faster at all. | 1 | 0 | 0 | How do you go about selecting a specific line in a QTextEdit and changing say... The font colour to green
I am using a QTextEdit widget to display the content of a file, a sequence of commands being sent over rs232. I would like to provide some visual feedback as to what line is being executed, say change the text colo... | format a specific line in a QtextEdit | 0.066568 | 0 | 0 | 2,307 |
23,551,808 | 2014-05-08T20:24:00.000 | 3 | 0 | 0 | 1 | python,django,architecture,celery | 23,846,005 | 2 | false | 1 | 0 | Celery actually makes this pretty simple, since you're already putting the tasks on a queue. All that changes with more workers is that each worker takes whatever's next on the queue - so multiple workers can process at once, each on their own machine.
There's three parts to this, and you've already got one of them.
S... | 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.291313 | 0 | 0 | 2,804 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.