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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,635,443 | 2012-07-24T16:38:00.000 | 2 | 0 | 1 | 1 | python,python-3.x | 11,639,758 | 3 | false | 0 | 0 | In Python things like this is generally so trivial that it's hard to even provide examples. Hooks are generally callbacks, yes. Callbacks in python are simply done by passing functions around and calling them. | 1 | 6 | 0 | In the world of penetration testing with Python, it looks like
one has to generally hook into an API that's OS specific. This makes sense
to me because we're dealing with different architectures and kernels between
OSX, Linux, Windows. But I'm wondering if this isn't the case?
Beyond some of the limited functionality ... | Can API hooking in python be OS agnostic? | 0.132549 | 0 | 0 | 6,564 |
11,638,579 | 2012-07-24T20:10:00.000 | 1 | 0 | 1 | 0 | python | 12,689,109 | 3 | false | 0 | 0 | If some IDE interprets '####' as a half-baked string plus a comment, change the IDE! | 1 | 2 | 0 | I want to have a string containing 4 pound signs..how can I accomplish this in Python without commenting the string out due to the pound signs? | Using POUND SIGN as a string in PYTHON? | 0.066568 | 0 | 0 | 17,557 |
11,639,235 | 2012-07-24T21:00:00.000 | 1 | 0 | 0 | 0 | python,django-templates,apache2,django-views,locale | 11,727,380 | 2 | true | 1 | 0 | I managed to solve the problem by explicitly calling
locale.setlocale(locale.LC_ALL,'en_US.UTF-8')
I'm not sure why it wasn't working without the en_US.UTF-8 parameter as the local setting is 'en_US.UTF-8'. If anyone knows why I needed to use an explicit call when the apache process runs the code but not when I'm... | 1 | 0 | 0 | I've got a simple Ubuntu/django/apache server set up and I'm having trouble formatting some of the numbers that I want to display in my Django templates. When I run the code locally (i.e. on my work machine) using the Django test server everything formats with no problem.
Likewise, when I open up IDLE on the server I c... | python locale.setlocale fails when running apache | 1.2 | 0 | 0 | 958 |
11,641,077 | 2012-07-25T00:17:00.000 | 1 | 1 | 1 | 0 | python,physics,game-physics | 11,641,106 | 2 | false | 0 | 0 | Assuming that you've got an in-game quantized unit of time, a "tick" of the clock, if you will, give each body a velocity vector (how much, and in which directions, it moves per "tick") and for each tick, have each other body change its velocity vector by some amount based on their distance (exert a force on it, divide... | 2 | 3 | 0 | I'm writing a 2D game in Python that has gravity as a major mechanic.
I have some of the game engine made, but the part where I'm stuck is actually determining what to add to the X and Y velocities of each mass.
So say I have circle A and circle B, each with a position, a velocity, and a mass. Each should be pulled tow... | Newtonian gravity simulation | 0.099668 | 0 | 0 | 1,914 |
11,641,077 | 2012-07-25T00:17:00.000 | 3 | 1 | 1 | 0 | python,physics,game-physics | 11,641,140 | 2 | true | 0 | 0 | You need to solve the equations of motion for each body. They'll be written as a set of coupled, first-order, ordinary differential equations. You'll write one equation each for the x- and y-directions, which will give you the acceleration as a function of the gravitational force between the two bodies divided by th... | 2 | 3 | 0 | I'm writing a 2D game in Python that has gravity as a major mechanic.
I have some of the game engine made, but the part where I'm stuck is actually determining what to add to the X and Y velocities of each mass.
So say I have circle A and circle B, each with a position, a velocity, and a mass. Each should be pulled tow... | Newtonian gravity simulation | 1.2 | 0 | 0 | 1,914 |
11,642,105 | 2012-07-25T03:04:00.000 | 0 | 0 | 1 | 0 | python,time | 11,642,138 | 3 | false | 0 | 0 | For a database, your best bet is to store it in the database-native format, assuming its precision matches your needs. For a SQL database, the DATETIME type is appropriate.
EDIT: Or TIMESTAMP. | 2 | 0 | 0 | I am wondering what the most reliable way to generate a timestamp is using Python. I want this value to be put into a MySQL database, and for other programming languages and programs to be able to parse this information and use it.
I imagine it is either datetime, or the time module, but I can't figure out which I'd us... | Most reliable way to generate a timestamp with Python | 0 | 1 | 0 | 390 |
11,642,105 | 2012-07-25T03:04:00.000 | 0 | 0 | 1 | 0 | python,time | 11,642,253 | 3 | false | 0 | 0 | if it's just a simple timestamp that needs to be read by multiple programs, but which doesn't need to "mean" anything in sql, and you don't care about different timezones for different users or anything like that, then seconds from the unix epoch (start of 1970) is a simple, common standard, and is returned by time.tim... | 2 | 0 | 0 | I am wondering what the most reliable way to generate a timestamp is using Python. I want this value to be put into a MySQL database, and for other programming languages and programs to be able to parse this information and use it.
I imagine it is either datetime, or the time module, but I can't figure out which I'd us... | Most reliable way to generate a timestamp with Python | 0 | 1 | 0 | 390 |
11,643,221 | 2012-07-25T05:21:00.000 | 0 | 0 | 0 | 0 | python,user-interface,icons,pyqt,pyside | 11,693,002 | 8 | false | 0 | 1 | in PyQt, the window icon is by default the Qt logo. I think you will have to find your own icons for things inside the gui. | 1 | 28 | 0 | I'm reading a tutorial on PySide and I was thinking , do I need to find my own icons for every thing or is there some way to use some built in icons . That way I wouldn't need to find an entire new set of icons if I want my little gui to run on another desktop environment . | Are there default icons in PyQt/PySide? | 0 | 0 | 0 | 30,098 |
11,644,808 | 2012-07-25T07:35:00.000 | 0 | 0 | 0 | 1 | python,linux,ssh,console | 11,663,302 | 2 | true | 0 | 0 | I have seen that indeed screen does what i need...
Thanks Ignacio | 2 | 0 | 0 | I have a python script that runs continuously in background and print some logs on standard output.
If I log with the same user on the same machine via ssh however I cannot see the output since (I guess) I opened a different shell.
Is there any way to specify that the standard output of this process must be seen by all... | Output of a process displayed in multiple consoles | 1.2 | 0 | 0 | 234 |
11,644,808 | 2012-07-25T07:35:00.000 | 0 | 0 | 0 | 1 | python,linux,ssh,console | 11,645,207 | 2 | false | 0 | 0 | In UNIX you could write to all shells using the command wall. I'm not sure if there is a Python binding for wall though. | 2 | 0 | 0 | I have a python script that runs continuously in background and print some logs on standard output.
If I log with the same user on the same machine via ssh however I cannot see the output since (I guess) I opened a different shell.
Is there any way to specify that the standard output of this process must be seen by all... | Output of a process displayed in multiple consoles | 0 | 0 | 0 | 234 |
11,645,123 | 2012-07-25T07:56:00.000 | 1 | 0 | 0 | 0 | python,winapi,google-chrome | 57,915,124 | 3 | false | 0 | 0 | I quite new to StackOverFlow so apologies if the comment is out of tone.
After looking at :
Selenium,
launching chrome://History directly,
doing some keyboard emulation : copy/paste with Pywinauto,
trying to use SOCK_RAW connections to capture the headers as per the Network tab of the DevTool (this one was very intere... | 1 | 12 | 0 | How can my Python script get the URL of the currently active Google Chrome tab in Windows? This has to be done without interrupting the user, so sending key strokes to copy/paste is not an option. | How do I get the URL of the active Google Chrome tab in Windows? | 0.066568 | 0 | 1 | 13,519 |
11,645,451 | 2012-07-25T08:17:00.000 | 0 | 1 | 0 | 0 | python,selenium,windmill,browser-testing | 12,344,550 | 1 | false | 1 | 0 | If you're looking to run Windmill in headless mode (no monitor) you can do it by running
Xvfb :99 -ac &
DISPLAY=:99 windmill firefox -e test=/path/to/your/test.py | 1 | 1 | 0 | In selenium testing, there is htmlunitdriver which you can run tests without browser with. I need to do this with windmill too. Is there a way to do this in windmill?
Thank! | Windmill-Without web browser | 0 | 0 | 1 | 364 |
11,645,609 | 2012-07-25T08:28:00.000 | 1 | 0 | 1 | 0 | python,exception,import,dependencies | 11,645,654 | 1 | true | 0 | 0 | Not really. But if the optional import fails then you could provide "stub" classes which would explain the error if instantiated. | 1 | 0 | 0 | I am creating a package in python, that has some optional dependencies. These dependencies are not required for core features but their lack will disable use of some class (it is an orm which offers a field for storing html. lxml is used to store and retrieve the value).
Obviously I may just not create the class if the... | An informative way to show a lack of optional dependency in python | 1.2 | 0 | 0 | 103 |
11,646,830 | 2012-07-25T09:35:00.000 | 1 | 0 | 0 | 1 | python,jenkins,jython,nose | 11,650,753 | 2 | false | 1 | 0 | There is no way to achieve this from your tests. The report generator simply won't display the output unless there are errors.
You will have to get the sources for Jenkins itself (the JUnit runner is built into it) and patch the reporter or write your own plugin. | 2 | 2 | 0 | I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose wi... | Add logging to tests results in jenkins | 0.099668 | 0 | 0 | 3,561 |
11,646,830 | 2012-07-25T09:35:00.000 | 2 | 0 | 0 | 1 | python,jenkins,jython,nose | 11,742,115 | 2 | true | 1 | 0 | With the latest Jenkins there is an option to save the output (Retain long standard output/error) right under the post build step belonging to JUnit. Additionally I run nose with --nocapture. This gives me a console output view on every test (an option on the left menu when I have a test opened) | 2 | 2 | 0 | I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose wi... | Add logging to tests results in jenkins | 1.2 | 0 | 0 | 3,561 |
11,647,112 | 2012-07-25T09:52:00.000 | 0 | 0 | 0 | 0 | python,search,solr | 11,679,439 | 4 | false | 0 | 0 | Besides DIH, you could setup a trigger in your db to fire Solr's REST service that would update changed docs for all inserted/updated/deleted documents.
Also, you could setup a Filter (javax.servlet spec) in your application to intercept server requests and push them to Solr before they even reach database (it can even... | 1 | 1 | 0 | I am building a system where entries are added to a SQL database sporadically throughout the day. I am trying to create a system which imports these entries to SOLR each time.
I cant seem to find any infomation about adding individual records to SOLR from SQL. Can anyone point me in the right direction or give me a bi... | SOLR - Adding a single entry at a time | 0 | 1 | 0 | 606 |
11,647,268 | 2012-07-25T10:00:00.000 | 0 | 0 | 0 | 0 | python,python-2.7,activemq | 11,719,245 | 2 | false | 0 | 0 | Finally I am using STOMP python for listening to a ActiveMQ Broker. PyActiveMq is to unstable to be used as it is no more maintained. | 1 | 3 | 0 | I have to write a Listener for ActiveMQ in python.
Is there any python package which could be used to write the listener.
Also what is with Stomp/Openwire protocol. When i start activemq, i see three urls with protocol namely tcp, ssl, stomp.
Any help will be appreciated
EDIT!: Another question I have is suppose we st... | ActiveMQ Listener in Python | 0 | 0 | 1 | 7,213 |
11,647,810 | 2012-07-25T10:33:00.000 | 1 | 1 | 0 | 1 | python,debugging | 11,648,687 | 1 | false | 0 | 0 | You can compile a debug-enabled version python in your home folder without having root access and develop the C extension against that version. | 1 | 1 | 0 | How do I debug a Python extension written in C? I found some links that said we need to get the Python debug built, but how do we do that if we don't have root access? I have Python 2.7 installed. | How do I debug a Python extension written in C? | 0.197375 | 0 | 0 | 262 |
11,649,155 | 2012-07-25T11:58:00.000 | 0 | 0 | 1 | 0 | python,windows,package,inno-setup | 11,848,353 | 1 | true | 0 | 0 | You can use python together with inno. With inno you can collect all the user data which you need, and with python you can do all the other work with this user data. To do that you need to include the python files in your setup. During your setup you need to extract the files and then you can call your python scripts. | 1 | 1 | 0 | I know python and I am working on a project where we are using Inno setup. Is there any package builder where I can write the setup-code in python? | Any package builder for windows (like Inno Setup) which uses python | 1.2 | 0 | 0 | 370 |
11,649,744 | 2012-07-25T12:29:00.000 | 0 | 1 | 1 | 0 | c++,python,coding-style | 11,649,914 | 3 | false | 0 | 0 | That depends very much on the specific case.
If I were to use the file in several (sub)functions than I would rather pass the initialised file object (or function).
If I have one function to get the filename and path and another to do something with the data of the file, I would probably prefer to pass the path and f... | 2 | 1 | 0 | In a programming language that has a file object, would you rather pass this object to a function or the path to the physical file and let the function open the file itself?
If the language does matter for your answer, please consider c++ and python.
Thanks,
Somebody | pass file or filename to function | 0 | 0 | 0 | 681 |
11,649,744 | 2012-07-25T12:29:00.000 | 3 | 1 | 1 | 0 | c++,python,coding-style | 11,649,800 | 3 | false | 0 | 0 | My understanding of good coding practices is to open the file where the information is to be used and not in a more global scope in any language. | 2 | 1 | 0 | In a programming language that has a file object, would you rather pass this object to a function or the path to the physical file and let the function open the file itself?
If the language does matter for your answer, please consider c++ and python.
Thanks,
Somebody | pass file or filename to function | 0.197375 | 0 | 0 | 681 |
11,653,040 | 2012-07-25T15:19:00.000 | 4 | 0 | 0 | 0 | python,mysql,django | 11,653,215 | 1 | false | 1 | 0 | You need to install the client libraries. The Python module is a wrapper around the client libraries. You don't need to install the server. | 1 | 0 | 0 | i am trying to connect to mysql in django. it asked me to install the module. the module prerequisites are "MySQL 3.23.32 or higher" etc. do i really need to install mysql, cant i just connect to remote one?? | Not able to install python mysql module | 0.664037 | 1 | 0 | 62 |
11,656,036 | 2012-07-25T18:15:00.000 | 0 | 0 | 1 | 0 | python,ms-word,docx,doc | 40,494,032 | 4 | false | 0 | 0 | To keep a proper word heading format.
create a template docx file with header/footer
insert placeholders (i.e. #headerText) through Word into the docx (group the text)
expand the xml tree of the template
replace the placeholders with your desired text
output new word document
This is not an ideal solution to edit d... | 2 | 3 | 0 | I have several hundred word documents for which I need to add a specific header (as in a typical MS Word header/ footer). It is not that the header needs to be modified, these documents just don't contain one. Is there any way to do this with the Python-docx module? I recently discovered it and it seems promising. | Adding a header to docx file with python | 0 | 0 | 0 | 4,102 |
11,656,036 | 2012-07-25T18:15:00.000 | 0 | 0 | 1 | 0 | python,ms-word,docx,doc | 38,598,493 | 4 | false | 0 | 0 | Well if I understood, you need to create a header section in many docx files.
As far as I concern people are working on python-docx to implement this.
While this new feature is not available, you might directly add this to your docx file.
In case you don't know yet, docx files can be unzipped. Inside it's structure the... | 2 | 3 | 0 | I have several hundred word documents for which I need to add a specific header (as in a typical MS Word header/ footer). It is not that the header needs to be modified, these documents just don't contain one. Is there any way to do this with the Python-docx module? I recently discovered it and it seems promising. | Adding a header to docx file with python | 0 | 0 | 0 | 4,102 |
11,656,306 | 2012-07-25T18:32:00.000 | 7 | 0 | 1 | 1 | python,linux,cpython | 11,656,437 | 2 | false | 0 | 0 | By default, the keymappings are:
older: alt-p
more recent: alt-n
You can change it in Options -> Configure IDLE -> Keys -> "history-previous" and "history-next" respectively. | 1 | 10 | 0 | I am using a VT100 terminal emulator on Linux. In bash, up and down arrows scroll through the last commands executed; they work as expected.
Previous (up arrow) and next (down arrow) commands are not interpreted in the Python command line interpreter. What kind of key mappings do I need to make this work?
Thank you. | Why do up and down arrow commands not work in the Python command line interpreter? | 1 | 0 | 0 | 6,773 |
11,657,734 | 2012-07-25T20:04:00.000 | 6 | 0 | 1 | 0 | python,windows,sleep | 11,657,786 | 7 | false | 0 | 0 | 0.25 seconds are 250 ms, not 25. Apart from this, there is no way to wait for exactly 25 ms on common operating systems – you would need some real-time operating system. | 2 | 8 | 0 | I need to wait for about 25ms in one of my functions. Sometimes this function is called when the processor is occupied with other things and other times it has the processor all to itself.
I've tried time.sleep(.25) but sometimes its actually 25ms and other times it takes much longer. Is there a way to sleep for an ex... | Sleep for exact time in python | 1 | 0 | 0 | 12,004 |
11,657,734 | 2012-07-25T20:04:00.000 | 2 | 0 | 1 | 0 | python,windows,sleep | 11,657,821 | 7 | false | 0 | 0 | What you intend to do is a real time application. Python (and probably the OS you are using) is not intended to program this kind of applications, where time restriction is so strict.
In order for you to achieve what you are looking for you need a RTOS (Real Time Operating System) and develop your application using a s... | 2 | 8 | 0 | I need to wait for about 25ms in one of my functions. Sometimes this function is called when the processor is occupied with other things and other times it has the processor all to itself.
I've tried time.sleep(.25) but sometimes its actually 25ms and other times it takes much longer. Is there a way to sleep for an ex... | Sleep for exact time in python | 0.057081 | 0 | 0 | 12,004 |
11,657,757 | 2012-07-25T20:05:00.000 | 0 | 0 | 1 | 0 | python,virtualenv,pip,virtualenvwrapper | 11,658,449 | 2 | true | 0 | 0 | pip-python is the name of the executable in some Linux distributions. It is on my Fedora machine.
When pip is installed in a virtualenv, the name of the executable is simply pip, not pip-python. So you need to execute it with ~/.virtualenvs/NAME/bin/pip, not ~/.virtualenvs/NAME/bin/pip-python. | 2 | 0 | 0 | I've installed python-virtualenv and python-virtualenvwrapper, and created a virtual environment by using mkvirtualenv NAME, and then activated it through workon NAME. By looking in ~/.virtualenvs/NAME/bin I see that pip is installed there.
However, when I try and install anything through pip, I'm told pip-python: comm... | pip-python not found within virtual environment | 1.2 | 0 | 0 | 4,515 |
11,657,757 | 2012-07-25T20:05:00.000 | 1 | 0 | 1 | 0 | python,virtualenv,pip,virtualenvwrapper | 11,657,796 | 2 | false | 0 | 0 | You must install pip on you system to make it accessible in virtualenv. | 2 | 0 | 0 | I've installed python-virtualenv and python-virtualenvwrapper, and created a virtual environment by using mkvirtualenv NAME, and then activated it through workon NAME. By looking in ~/.virtualenvs/NAME/bin I see that pip is installed there.
However, when I try and install anything through pip, I'm told pip-python: comm... | pip-python not found within virtual environment | 0.099668 | 0 | 0 | 4,515 |
11,660,203 | 2012-07-25T23:27:00.000 | 1 | 0 | 0 | 1 | python,osx-lion,aquamacs | 18,509,905 | 1 | false | 0 | 0 | I also met with this problem recently.
You need to add minor mode Fill. Press on the Python in the mode line in mouse-3 way and choose Auto Fill. | 1 | 0 | 0 | I am editing a python script that I wrote a while ago, using aquamacs on Mac lion.
Whichever letter or number I type is being interpreted as "enter" (that is, I hit "g" for example, my text is dissrupted and a newline appears, but "g" does not appear). Restarting aquamacs, the terminal out of which I run it, or the who... | Aquamacs (on Mac lion): whatever I write i being interpreted as "Enter" | 0.197375 | 0 | 0 | 323 |
11,661,053 | 2012-07-26T01:22:00.000 | 0 | 0 | 1 | 1 | python,python-idle | 11,661,081 | 3 | false | 0 | 0 | python.exe is Python, the python interpreter specifically. | 1 | 0 | 0 | I am running Windows 7 currently, and I remember when using Linux at the school computers I was able to type "gedit &" into the terminal for example to open up the gedit text editor. I was wondering whether there is a similar process to open IDLE, and for that matter a Python program/script by typing it into the "termi... | How to start Python IDLE from python.exe window if possible, and if not, what is python.exe even used for? | 0 | 0 | 0 | 2,121 |
11,662,219 | 2012-07-26T04:10:00.000 | 2 | 0 | 0 | 1 | python,linux,shell,operating-system,command | 11,662,267 | 3 | true | 0 | 0 | All of the things you've mentioned (which have been succeeded by the subprocess module by the way) are ways of spawning processes. You sound like you're looking for setuid. You can either call a function that will do that (e.g. os.setuid), or, as often is the case depending on what your script does, you can just run th... | 1 | 2 | 0 | As far as I kown, there are about 3 ways to excute a system command in Python:
os.system(command) -> exit_status
os.popen(command [, mode='r' [, bufsize]]) -> pipe
commands.getoutput(command)-> string
Now I need to control the excutor of a system command, beside the way like:
os.system('su xxx;' + command)
is there ... | Is there any way to excute a command as a specific user in Python? | 1.2 | 0 | 0 | 814 |
11,665,765 | 2012-07-26T08:57:00.000 | 2 | 1 | 0 | 0 | python,import | 11,666,220 | 1 | true | 0 | 0 | Call your script with -v option.
python -v yourscript.py
This will trace all the import statements and look or do grep for your project name. If it's not in that, then either it's not at all added to your python path or you're running different python interpreter. | 1 | 0 | 0 | I addded the project root of my python project to the PYTHONPATH. Now the import of my modules works in the CLI of python bot NOT in a python script.
How can I fix that? | Relative import works on CLI but not in script | 1.2 | 0 | 0 | 72 |
11,668,748 | 2012-07-26T11:55:00.000 | 5 | 0 | 0 | 0 | python,chess | 11,668,833 | 2 | false | 0 | 0 | Generally the unmake approach is used more as it avoids unnecessary copying of the board. This is especially true if you want to keep your pieces in two different forms in your Position class; as a traditional 8x8 array and as a set of 64-bit unsigned integers (bitboards).
You need to create a class to store your Unma... | 1 | 4 | 0 | I'm at the start of creating a chess engine. When I created a function that checks if a move is legal, first I had to make the move and then check if the move had put my king in check and then unmake it.
After giving some thought on how to make a function that unmakes a move, I decided it's much simpler to just copy t... | Unmake move vs copy board in chess programming | 0.462117 | 0 | 0 | 1,935 |
11,673,711 | 2012-07-26T16:21:00.000 | 1 | 1 | 0 | 0 | python,boto,mechanicalturk | 11,677,299 | 2 | true | 0 | 0 | Looking through the MTurk API (http://docs.amazonwebservices.com/AWSMechTurk/latest/AWSMturkAPI/Welcome.html) I don't see anything that returns a list of HIT types. You should post a query to the MTurk forum (https://forums.aws.amazon.com/forum.jspa?forumID=11). It seems like a useful feature to add. | 2 | 0 | 0 | Is there a way to list all my HIT types (not HITs or assignments) using the mturk api?
I can't find any documentation on this. I'm using python, so it'd be nice if boto supported this query. | List all hitTypes through the mturk API? | 1.2 | 0 | 1 | 362 |
11,673,711 | 2012-07-26T16:21:00.000 | 1 | 1 | 0 | 0 | python,boto,mechanicalturk | 11,678,042 | 2 | false | 0 | 0 | Unfortunately there isn't. We resort to persisting every HitType locally that we create through turk's api at houdiniapi.com which works just fine. | 2 | 0 | 0 | Is there a way to list all my HIT types (not HITs or assignments) using the mturk api?
I can't find any documentation on this. I'm using python, so it'd be nice if boto supported this query. | List all hitTypes through the mturk API? | 0.099668 | 0 | 1 | 362 |
11,674,359 | 2012-07-26T17:02:00.000 | 2 | 1 | 1 | 1 | python | 11,674,391 | 2 | false | 0 | 0 | env is a program that handles these sort of things. You should pretty much always use something like #! /usr/bin/env python3 as your shebang line rather than specifying an absolute path. | 1 | 1 | 0 | I'm sure this is well documented somewhere, but I can't find it! I want to make my scripts portable to machines that may not have their Python interpreters in the same location. For that reason, I thought that I could just code the first line as #!python3 rather than with the absolute path to the interpreter, like #!/u... | How to make Python script portable to machines with interpreters in different locations? | 0.197375 | 0 | 0 | 155 |
11,674,762 | 2012-07-26T17:29:00.000 | 1 | 1 | 1 | 0 | python,unit-testing,mocking | 11,674,984 | 1 | false | 0 | 0 | So, it's tough to see exactly what's going on without seeing the code, but based solely on your explanation...
I would agree with you. The behavior is what is important, not the flow of the code.
What if someone later on needs to change the flow of the code to support a different case (say, using a function with a diff... | 1 | 2 | 0 | I am starting on a new project at a new job. This is my first time working heavily in Python. Mocking is a whole new beast compared to the hoops I had to jump through in a statically typed language. I took it upon myself to look into the team's unit tests and hopefully upgrade some of them from using Dingus to Mock.
Ea... | Python Unit Testing and when to Mock | 0.197375 | 0 | 0 | 355 |
11,675,707 | 2012-07-26T18:28:00.000 | -1 | 1 | 1 | 0 | java,c++,python,c | 11,675,784 | 2 | false | 0 | 0 | Many of the STL containers in C++ are commonly implemented using trees. Examples include std::map and std::set | 2 | 1 | 0 | I was until now programming in C, which is a very basic language. But now as I am studying data structures, my online teacher actually uses some methods like leftChild(), rightChild(), etc.
But then I started searching whether tree ADT and such are implemented in C++, Python, Java
by default. And mostly the answers we... | built in Abstract Data Types in c++/python/java | -0.099668 | 0 | 0 | 668 |
11,675,707 | 2012-07-26T18:28:00.000 | -1 | 1 | 1 | 0 | java,c++,python,c | 11,676,043 | 2 | false | 0 | 0 | These are the basic ADTs. I think you should first learn and code them yourselves before jumping into any library with these inbuild features.
Thanks | 2 | 1 | 0 | I was until now programming in C, which is a very basic language. But now as I am studying data structures, my online teacher actually uses some methods like leftChild(), rightChild(), etc.
But then I started searching whether tree ADT and such are implemented in C++, Python, Java
by default. And mostly the answers we... | built in Abstract Data Types in c++/python/java | -0.099668 | 0 | 0 | 668 |
11,678,950 | 2012-07-26T22:27:00.000 | 6 | 0 | 0 | 0 | python,django,amazon-web-services,amazon-dynamodb,django-database | 11,679,929 | 1 | true | 1 | 0 | I think the answer is there's no easy way. Django supports relational databases, but DynamoDB is NoSQL.
There doesn't appear to be a backend for django-nonrel, an unofficial fork for non relational databases.
If you want to use amazon to host the database, you could use their RDS service and configure Django as you wo... | 1 | 8 | 0 | Is it possible to set up an AWS DynamoDB as the database backed for a Django server?
If so, how would I go about doing this?
thanks! | Django DynamoDB Database backend | 1.2 | 0 | 0 | 6,014 |
11,681,354 | 2012-07-27T04:15:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore | 11,681,451 | 1 | true | 1 | 0 | I found the answer: db.allocate_id_range(...) | 1 | 0 | 0 | Is it possible to tell AppEngine Datastore to reserve a range of IDs, which should never be allocated to models? | AppEngine datastore reserve ID range | 1.2 | 0 | 0 | 178 |
11,681,557 | 2012-07-27T04:42:00.000 | 4 | 0 | 0 | 0 | python,google-app-engine,twitter-bootstrap,blogs | 20,403,908 | 4 | false | 1 | 0 | In addition to the answers above, also note that the order of declarations is important. The - url: /.* part should be the last one, in this case | 1 | 7 | 0 | So I'm a programming noob. I have been following many of the Udacity classes and I am slowly learning to code.
Alright so here's my question. I have built the basic HTML files of my blog using Twitter Bootstrap as it is so simple to use. Now what I would like to do is to combine the great template's that Bootstrap pro... | Twitter Bootstrap Website Deployed with GAE | 0.197375 | 0 | 0 | 9,488 |
11,681,940 | 2012-07-27T05:25:00.000 | 1 | 0 | 1 | 0 | python-2.7,nonetype | 12,072,782 | 1 | false | 0 | 0 | None is a singleton object of type NoneType, but like any other object (well, any one without an odd __eq__ method), it's not equal to its type.
The equivalent check would be type(function()) == type(None), or, since type-checking is a bit silly in this case, function() is None. | 1 | 0 | 0 | I have a function that doesn't return anything, and when I write type(function()) I get type NoneType. But when type(function()) == None, the feedback is False. Why does this happen? | NoneType object returns False when equated to None | 0.197375 | 0 | 0 | 475 |
11,684,796 | 2012-07-27T09:10:00.000 | 1 | 0 | 0 | 0 | python | 11,684,911 | 1 | false | 0 | 1 | these are two different widget libraries.
TkInter is built-in, however, as far as I remember, it translates python statements to tcl statements, which might not make it fast. It's also looking like a tcl/tk application on all platforms.
wxpython is NOT built-in, therefore you have to distribute it with your code to al... | 1 | 0 | 0 | Can anybody explain me difference between wxpython and tkinter?
Which one is the best for development?
I want to develop a media player using python. | Difference between wxpython and tkinter | 0.197375 | 0 | 0 | 1,691 |
11,686,311 | 2012-07-27T10:48:00.000 | 5 | 0 | 0 | 0 | python,pyramid | 11,689,231 | 1 | true | 0 | 0 | Pyramid does not call NewRequest more than once per request. The only reason this would happen is if you are registering your subscriber multiple times accidentally. Another common reason people think it is called multiple times is that the browser usually follows requests with a favicon request, but that only accounts... | 1 | 0 | 0 | It was interesting to me and I've checked it. As you can read NewRequest subscribers are called 3 times on each request (or 7 times with debug_toolbar enabled...) while BeforeRender subscribers are called 1 time on each request (> 30 times with debug_toolbar enabled).
So, if I want to connect mongodb to my project thro... | Pyramid: why NewRequest subscribers calls 3 times on every request? | 1.2 | 0 | 0 | 400 |
11,687,183 | 2012-07-27T11:49:00.000 | 1 | 1 | 1 | 0 | python,string,int,type-conversion,performance | 11,687,359 | 3 | false | 0 | 0 | I don't really know what you exactly mean by "compare", but if it is not always only strict egality you'd better work with integers. You could need to sort your data or whatever, and it will be easier this way ! | 1 | 3 | 0 | I'm currently writing a script, which at some point needs to compare numbers provided to the script by two different sources/inputs. One source provides the numbers as integers and one source provides them as strings. I need to compare them, so I need to use either str() on the integers or int() on the strings.
Assumin... | More efficient to convert string to int or inverse? | 0.066568 | 0 | 0 | 2,669 |
11,688,397 | 2012-07-27T13:08:00.000 | 0 | 0 | 0 | 0 | php,python,node.js,asynchronous,real-time | 11,688,432 | 4 | false | 1 | 0 | You could use a poll, long-poll or if you want a push system. Easiest would be a poll. However, all solutions require client side coding.
Performance impact depends on your solution. Easiest to implement would be a poll. A poll with short frequency does effectively a request every, say 100ms ot simulate real time. A lo... | 1 | 8 | 0 | How to show continuous real time updates in browser like facebook ticker, meetup.com home page does? In python, PHP, node.js and what would be the performance impact at the server side ?
Also how could we achieve the same update thing if the page is cached by an CDN like akamai? | How to show continuous real time updates like facebook ticker, meetup.com home page does? | 0 | 0 | 1 | 5,085 |
11,689,223 | 2012-07-27T13:53:00.000 | 0 | 0 | 1 | 1 | python,unicode,utf-8,filesystems,iso-8859-1 | 11,835,980 | 2 | false | 0 | 0 | Use character encoding detection, chardet modules for python work well for determining actual encoding with some confidence. "as appropriate" -- You either know the encoding or you have to guess at it. If with chardet you guess wrong, at least you tried. | 1 | 0 | 0 | I have an application written in Python 2.7 that reads user's file from the hard-drive using os.walk.
The application requires a UTF-8 system locale (we check the env variables before it starts) because we handle files with Unicode characters (audio files with the artist name in it for example), and want to make sure w... | Python, UTF-8 filesystem, iso-8859-1 files | 0 | 0 | 0 | 1,707 |
11,691,039 | 2012-07-27T15:32:00.000 | 2 | 0 | 0 | 1 | python,pyodbc,opensuse | 11,691,895 | 2 | true | 0 | 0 | I don't see a way around having the Python header files (which are part of python-devel package). They are required to compile the package.
Maybe there was a pre-compiled egg for the 64bit version somewhere, and this is how it got installed.
Why are you reluctant to install python-devel? | 1 | 1 | 0 | when I try to install the pyodbc by using "python setup.py build install", it shows up with some errors like the following:
gcc -pthread -fno-strict-aliasing -DNDEBUG -march=i586 -mtune=i686 -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fwrapv -fPIC ... | Error when installing pyodbc on opensuse | 1.2 | 1 | 0 | 4,644 |
11,691,351 | 2012-07-27T15:51:00.000 | 1 | 0 | 0 | 1 | python,unix,cron,tkinter,crontab | 11,691,425 | 1 | false | 0 | 0 | In most modern Linux distros like Debian or Ubuntu, you can add an executable file (like a shell script or a symlink to one) into /etc/cron.weekly and it will be automatically run once a week for you. This is using the anacron command, which is fairly common these days. | 1 | 2 | 0 | Through an application I have made with Tkinter, I'm trying to add a command to run a script every week. When the program is closed the command should be in forever place.
I've sifted through the documentation on cron, but there doesn't seem to be a way to edit the crontab without using the shell. Also I've looked thr... | Creating a Scheduled task in Tkinter on Unix | 0.197375 | 0 | 0 | 355 |
11,693,047 | 2012-07-27T17:50:00.000 | 55 | 0 | 1 | 0 | c++,python,visual-studio-2010,swig | 11,732,619 | 1 | true | 0 | 0 | Step-by-step instructions. This assumes you have the source and are building a single DLL extension that links the source directly into it. I didn't go back through it after creating a working project, so I may have missed something. Comment on this post if you get stuck on a step. If you have an existing DLL and w... | 1 | 22 | 0 | I've been trying for weeks to get Microsoft Visual Studio 2010 to create a DLL for me with SWIG. If you have already gone through this process, would you be so kind as to give a thoughtful step-by-step process explanation? I've looked everywhere online and have spent many many hours trying to do this; but all of the tu... | How to create a DLL with SWIG from Visual Studio 2010 | 1.2 | 0 | 0 | 14,880 |
11,694,213 | 2012-07-27T19:11:00.000 | 0 | 0 | 0 | 0 | wxpython | 11,722,723 | 1 | false | 0 | 1 | You could use a wx.TextCtrl with the TE_RICH style flag and set it up so it doesn't have any borders. Or you could use the HTMLWindow. | 1 | 0 | 0 | How to create a readonly multicolored text widget like a StyledTextCtrl, but without scrollbars, borders etc? It should be just a widget that allows to paint different parts of text by different colors, nothing more...
Maybe wxPython is not the best solution for it? | wxPython: Create multicolored text widget for ASCII game | 0 | 0 | 0 | 111 |
11,695,649 | 2012-07-27T21:06:00.000 | 1 | 0 | 0 | 0 | python,pyqt4,qthread,python-multithreading | 11,695,734 | 2 | false | 0 | 1 | This is a really bad plan. Split up the 'before thread action' and 'after thread action'. The 'after thread action' should be a slot fired by a QueuedConnection that the thread can signal.
Do not wait in GUI event handlers! | 2 | 1 | 0 | I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the worker thread is finished processing to continue executing its own code.
The solution that immediately comes to my mind is to have the threa... | How do I tell my main GUI to wait on a worker thread? | 0.099668 | 0 | 0 | 330 |
11,695,649 | 2012-07-27T21:06:00.000 | 0 | 0 | 0 | 0 | python,pyqt4,qthread,python-multithreading | 11,695,743 | 2 | false | 0 | 1 | If the GUI thread called the wait() function on the worker thread object, it would not return from it until the worker thread returns from its main function. This is not what you want to do.
The solution you describe using signal and slots seems to make plenty of sense to me. Or you could just use a boolean. | 2 | 1 | 0 | I have successfully outsourced an expensive routine in my PyQT4 GUI to a worker QThread to prevent the GUI from going unresponsive. However, I would like the GUI to wait until the worker thread is finished processing to continue executing its own code.
The solution that immediately comes to my mind is to have the threa... | How do I tell my main GUI to wait on a worker thread? | 0 | 0 | 0 | 330 |
11,696,472 | 2012-07-27T22:28:00.000 | 2 | 0 | 1 | 0 | python | 58,792,847 | 4 | false | 0 | 0 | For strings, forget about using WHENCE: use f.seek(0) to position at beginning of file and f.seek(len(f)+1) to position at the end of file. Use open(file, "r+") to read/write anywhere in a file. If you use "a+" you'll only be able to write (append) at the end of the file regardless of where you position the cursor. | 2 | 148 | 0 | Please excuse my confusion here but I have read the documentation regarding the seek() function in python (after having to use it) and although it helped me I am still a bit confused on the actual meaning of what it does, any explanations are much appreciated, thank you. | seek() function? | 0.099668 | 0 | 0 | 177,654 |
11,696,472 | 2012-07-27T22:28:00.000 | 47 | 0 | 1 | 0 | python | 11,696,525 | 4 | false | 0 | 0 | When you open a file, the system points to the beginning of the file. Any read or write you do will happen from the beginning. A seek() operation moves that pointer to some other part of the file so you can read or write at that place.
So, if you want to read the whole file but skip the first 20 bytes, open the file, s... | 2 | 148 | 0 | Please excuse my confusion here but I have read the documentation regarding the seek() function in python (after having to use it) and although it helped me I am still a bit confused on the actual meaning of what it does, any explanations are much appreciated, thank you. | seek() function? | 1 | 0 | 0 | 177,654 |
11,697,289 | 2012-07-28T00:47:00.000 | 5 | 0 | 0 | 0 | python,try-catch,urllib2,urllib | 11,697,336 | 3 | true | 0 | 0 | There are only two exceptions you'll see, HTTPError (HTTP status codes) and URLError (everything that can go wrong), so it's not like it's overkill handling both of them. You can even just catch URLError if you don't care about status codes, since HTTPError is a subclass of it. | 1 | 5 | 0 | I'm working with urllib and urllib2 in python and am using them to retrieve images from urls.
Using something similar to :
try:
buffer=urllib2.url_open(urllib2.Request(url))
f.write(buffer)
f.close
except (Errors that could occur): #Network Errors(?)
print "Failed to retrieve "+url
pass
Now wha... | Python: trying to raise multi-purpose exception for multiple error types | 1.2 | 0 | 1 | 1,816 |
11,697,457 | 2012-07-28T01:22:00.000 | 2 | 0 | 0 | 0 | php,python,http,header,hit | 11,697,490 | 2 | false | 1 | 0 | The best way to do it is pattern-recognition, since most proxies won't tell you that they are a proxy: if you see certain spikes of traffic, flag them and don't add them to the hitcount.
Alternatively, if (s)he's using the same proxies over and over again, just blacklist those IP addresses. You could also try to detect... | 1 | 4 | 0 | I am making a social site where users can post content and the content has views. Whenever a user from a different IP address views the content, the view count is incremented; multiple requests coming from the same IP address do not count. However lately someone is iterating though a list of proxies or something and ar... | How can I prevent my website from being "hit-boosted"? | 0.197375 | 0 | 1 | 216 |
11,700,172 | 2012-07-28T10:24:00.000 | 3 | 1 | 0 | 1 | python,reboot | 11,700,297 | 1 | false | 0 | 0 | It's not about python but rather about your whole system config. In given conditions I suggest you to split your script on 2 parts. First part is doing 1..3 and storing some extra info you're required onto persistent storage other than the fs you're experimenting on. The second part is invoked on each OS os start, read... | 1 | 0 | 0 | I want to write a test script in python which should reboot the system in between the test execution on local machine... (No remote automation server is monitoring the script). How the script execution can be made continuous even after reboot? The script covers following scenario...
Create a Volume on some disk
Create... | How to continue the python script execution from the point it left before reboot | 0.53705 | 0 | 0 | 1,400 |
11,701,887 | 2012-07-28T14:30:00.000 | 5 | 0 | 0 | 0 | python,database,django,settings,local | 11,702,027 | 2 | true | 1 | 0 | You can hold 2 different settings.py and while run manage.py do :
python manage.py runserver --settings=[projectname].[settingsfile].
change the settingsfile according to your database. | 1 | 5 | 0 | i have different configurations for django database in settings, one named "default" and one named "clean".
How i can run the development server (python manage.py runserver ip:port) binding the "clean" database setting and not the default? | How to launch Django development server with a different database setting (not default) | 1.2 | 0 | 0 | 1,173 |
11,701,920 | 2012-07-28T14:35:00.000 | 1 | 1 | 0 | 0 | python,pyramid | 13,202,389 | 3 | false | 0 | 0 | Also check the response status code: response.status_int
I use it for example, to introspect my internal URIs and see whether or not a given relative URI is really served by the framework (example to generate breadcrumbs and make intermediate paths as links only if there are pages behind) | 1 | 5 | 0 | I need to call GET, POST, PUT, etc. requests to another URI because of search, but I cannot find a way to do that internally with pyramid. Is there any way to do it at the moment? | Pyramid subrequests | 0.066568 | 0 | 1 | 552 |
11,703,407 | 2012-07-28T17:57:00.000 | 0 | 0 | 0 | 0 | python,django,gis,postgis,geodjango | 11,703,980 | 3 | false | 0 | 0 | Use the appropriate data connection to execute the SQL function that you're already using, then retrieve that... Keeps everything consistent. | 1 | 2 | 0 | I'm writing an application that makes heavy use of geodjango (on PostGis) and spatial lookups. Distance queries on database side work great, but now I have to calculate distance between two points on python side of application (these points come from models obtained using separate queries).
I can think of many ways th... | How to calculate distance between points on python side of my application in way that is consistent in what database does | 0 | 1 | 0 | 1,898 |
11,705,114 | 2012-07-28T22:20:00.000 | 0 | 0 | 0 | 0 | python,mysql,vim,encoding,smart-quotes | 18,619,898 | 4 | false | 0 | 0 | Are all these "junk" characters in the range <80> to <9F>? If so, it's highly likely that they're Microsoft "Smart Quotes" (Windows-125x encodings). Someone wrote up the text in Word or Outlook, and copy/pasted it into a Web application. Both Latin-1 and UTF-8 regard these characters as control characters, and the usua... | 1 | 1 | 1 | I am reading a bunch of strings from mysql database using python, and after some processing, writing them to a CSV file. However I see some totally junk characters appearing in the csv file. For example when I open the csv using gvim, I see characters like <92>,<89>, <94> etc.
Any thoughts? I tried doing string.encode... | Junk characters (smart quotes, etc.) in output file | 0 | 1 | 0 | 1,903 |
11,705,563 | 2012-07-28T23:45:00.000 | 3 | 0 | 1 | 0 | python,utf-8,ascii | 11,705,594 | 2 | false | 0 | 0 | UTF-8 is an extension of ASCII in that valid 7-bit ASCII text is also valid UTF-8 text, so if all the data is in fact representable in ASCII it doesn't make any difference whether it's ASCII or UTF-8.
If the data coming is UTF-8 encoded, the best approach is to decode it to unicode objects. For example if you read in ... | 1 | 2 | 0 | I'm using the python module requests to get data from some API's and they all return json data which are converted to dicts. What I want to do is take some info from these dicts and either convert them all to python strings where I can use the stemming and string.translate() modules on them, or convert the whole thing ... | Processing Utf-8 data in python | 0.291313 | 0 | 0 | 340 |
11,705,835 | 2012-07-29T00:57:00.000 | 0 | 0 | 0 | 0 | python,regex,beautifulsoup,twill | 11,712,834 | 2 | false | 1 | 0 | I'd rather user CSS selectors or "real" regexps on page source. Twill is AFAIK not being worked on. Have you tried BS or PyQuery with CSS selectors? | 1 | 3 | 0 | I'm currently using urllib2 and BeautifulSoup to open and parse html data. However I've ran into a problem with a site that uses javascript to load the images after the page has been rendered (I'm trying to find the image source for a certain image on the page).
I'm thinking Twill could be a solution, and am trying to ... | Using Regular Expression with Twill | 0 | 0 | 1 | 225 |
11,706,424 | 2012-07-29T03:31:00.000 | 0 | 0 | 0 | 0 | python,regex,selenium,webdriver,beautifulsoup | 11,707,106 | 2 | false | 1 | 0 | You'd need to figure out what HTTP requests the Javascript is making, and make the same ones in your Python code. You can do this by using your favorite browser's development tools, or wireshark if forced. | 1 | 1 | 0 | I'm trying to get the content of a HTML table generated dynamically by JavaScript in a webpage & parse it using BeautifulSoup to use certain values from the table.
Since the content is generated by JavaScript it's not available in source (driver.page_source).
Is there any other way to obtain the content and use it? It... | Get dynamic html table using selenium & parse it using beautifulsoup | 0 | 0 | 1 | 1,222 |
11,706,501 | 2012-07-29T03:53:00.000 | 0 | 0 | 1 | 0 | python,sorting,knuth | 11,709,448 | 3 | false | 0 | 0 | I ended up using a regular sorting algorithm (insertion sort) with a custom comparison operator that interrupts the sorting and progressively builds an execution plan to resume or reproduce the process.
It was ugly: the function raised an exception encapsulating the necessary information to continue sorting. Then sorti... | 2 | 6 | 0 | I have to model the execution plan of sorting a list of 5 elements, in python, using the minimum number of comparisons between elements. Other than that, the complexity is irrelevant.
The result is a list of pairs representing the comparisons needed to sort the list at another time.
I know there's an algorithm that doe... | Sorting 5 elements with minimum element comparison | 0 | 0 | 0 | 3,674 |
11,706,501 | 2012-07-29T03:53:00.000 | 3 | 0 | 1 | 0 | python,sorting,knuth | 11,706,574 | 3 | false | 0 | 0 | Well, there are 5!=120 ways how can elements be ordered. Each comparison gives you one bit of information, so you need at least k comparisons, where 2^k >= 120. You can check 2^7 = 128, so the 7 is least number of comparisons you need to perform. | 2 | 6 | 0 | I have to model the execution plan of sorting a list of 5 elements, in python, using the minimum number of comparisons between elements. Other than that, the complexity is irrelevant.
The result is a list of pairs representing the comparisons needed to sort the list at another time.
I know there's an algorithm that doe... | Sorting 5 elements with minimum element comparison | 0.197375 | 0 | 0 | 3,674 |
11,711,060 | 2012-07-29T16:51:00.000 | 1 | 1 | 0 | 1 | python,apache | 14,268,807 | 2 | false | 0 | 0 | BlaXpirit's answer should solve your problem with a 500 server internal error.
It is important to note the "\n" at the end of the first print statement. You can also write it as
print("Content-Type: text/html; charset=utf-8")
print()
I was surprised to learn that writing out these headers is necessary even if your Py... | 1 | 2 | 0 | I put a simple python script inside the cgi-bin in apache2 and tried to execute it using the browser as follows,
"http://www.example.com/cgi-bin/test.py"
But it gives a 500 Internal sever error.
Following is the error.log in apache2.
[Sun Jul 29 22:07:51 2012] [error] (8)Exec format error: exec of '/usr/lib/cgi-bin/tes... | How to run a python script inside the cgi-bin of apache server? | 0.099668 | 0 | 0 | 2,241 |
11,712,328 | 2012-07-29T19:37:00.000 | 2 | 0 | 1 | 0 | python,machine-learning,artificial-intelligence,classification | 11,713,517 | 2 | false | 0 | 0 | Probably not. You'd need to do a fair bit of work to extract data in some usable form (such as names), and at the end of the day, there are probably few enough categories that it would simply be easier to manually identify a list of keywords for each category and set a parser loose on titles/descriptions.
For example,... | 1 | 0 | 0 | I'm trying to take a long list of objects (in this case, applications from the iTunes App Store) and classify them more specifically. For instance, there are a bunch of applications currently classified as "Education," but I'd like to label them as Biology, English, Math, etc.
Is this an AI/Machine Learning problem? I ... | How to programmatically classify a list of objects | 0.197375 | 0 | 0 | 1,258 |
11,712,629 | 2012-07-29T20:24:00.000 | 7 | 0 | 1 | 0 | python,windows,linux,multithreading,python-multithreading | 11,713,013 | 3 | true | 0 | 0 | Rather than use a console or terminal window, re-examine your problem. What you are trying to do is create a GUI. There are a number of cross-platform toolkits including Wx and Tkinter that have widgets to do exactly what you want. A text box for output and an entry widget for reading keyboard input. Plus you can w... | 1 | 8 | 0 | I am trying to make a program that will launch both a view window (console) and a command line. In the view window, it would show constant updates, while the command line window would use raw_input() to accept commands that affect the view window. I am thinking about using threads for this, but I have no idea how to la... | Opening a Python thread in a new console window | 1.2 | 0 | 0 | 20,795 |
11,712,767 | 2012-07-29T20:41:00.000 | 2 | 0 | 1 | 0 | python,pipeline | 11,712,946 | 4 | false | 0 | 0 | Two options:
Have configuration somewhere else: have a config module, and use something like the django config system to make that available.
Instead of having the stages import the pipeline class, pass them a pipeline instance on instantiation. | 1 | 13 | 0 | Context: I'm currently using Python to a code a data-reduction pipeline for a large astronomical imaging system. The main pipeline class passes experimental data through a number of discrete processing 'stages'.
The stages are written in separate .py files which constitute a package. A list of available stages is gener... | Designing an extensible pipeline with Python | 0.099668 | 0 | 0 | 6,343 |
11,713,187 | 2012-07-29T21:40:00.000 | 11 | 0 | 1 | 1 | python,virtualenv | 11,713,237 | 2 | true | 0 | 0 | You don't run activate as a script; you need to source it in your shell, since it affects the shell itself.
It probably also doesn't make any sense to run it under sudo. | 1 | 2 | 0 | I'm trying to use virtualenv on my development machine. I successfully created my new environment issuing virtualenv venv in /home/user/. When I try to activate it (from user location) with sudo venv/bin/activate I get venv/bin/activate: command not found. | Problems starting created virtualenv instance | 1.2 | 0 | 0 | 9,585 |
11,713,284 | 2012-07-29T21:53:00.000 | 1 | 0 | 0 | 0 | python,django,image | 11,748,617 | 3 | true | 1 | 0 | You'll first need to parse the html content for img src urls with something like lxml or BeautifulSoup. Then, you can feed one of those img src urls into sorl-thumbnail or easy-thumbnails as Edmon suggests. | 1 | 2 | 0 | I am pretty new to Django so I am creating a project to learn more about how it works. Right now I have a model that contains a URL field. I want to automatically generate a thumbnail from this url field by taking an appropriate image from the webite like facebook or reddit does. I'm guessing that I should store this i... | Need to create thumbnail from user submitted url like reddit/facebook | 1.2 | 0 | 0 | 1,630 |
11,713,588 | 2012-07-29T22:35:00.000 | 3 | 0 | 0 | 0 | python,django,static-files,django-staticfiles | 11,713,704 | 1 | true | 1 | 0 | The static file finders will collocate the contents of all of your static folders under a single root upon collection, which means you can reference static resources relatively.
For instance, if you had a logo in project/commons/static/images/logo.png, you can reuse it in a stylesheet in some other application, say pro... | 1 | 1 | 0 | I have a directory with static files myapp/static/ and within that there are static/css,static/javascript, and static/images How can these files refere to one another? For instants, the css has to use the image files for the background of certain pages. Do you have to hard code the url? Can you do it relatively? | Django: Static files referring to one another. | 1.2 | 0 | 0 | 67 |
11,714,859 | 2012-07-30T02:44:00.000 | 1 | 0 | 1 | 0 | python,python-2.7 | 47,832,414 | 3 | false | 0 | 0 | If you want first 2 letters and last 2 letters of a string then you can use the following code:
name = "India"
name[0:2]="In"
names[-2:]="ia" | 1 | 95 | 0 | Hi I just started learning Python but I'm sort of stuck right now.
I have hash.txt file containing thousands of malware hashes in MD5, Sha1 and Sha5 respectively separated by delimiters in each line. Below are 2 examples lines I extracted from the .txt file.
416d76b8811b0ddae2fdad8f4721ddbe|d4f656ee006e248f2f3a8a93a8... | How to display the first few characters of a string in Python? | 0.066568 | 0 | 0 | 288,488 |
11,716,677 | 2012-07-30T06:58:00.000 | 0 | 1 | 0 | 0 | python,testing,selenium | 11,718,057 | 1 | true | 0 | 0 | Yes, use different browser configurations in the hub, and use two or more programs to contact the grid with different browsers | 1 | 0 | 0 | Can each node of selenium grid run different python script/test?
- how to setup? | Can each node of selenium grid run different script/test? - how to setup? | 1.2 | 0 | 1 | 382 |
11,717,481 | 2012-07-30T08:00:00.000 | 0 | 0 | 1 | 0 | python,python-2.7,urllib2,gevent | 11,718,217 | 2 | false | 0 | 0 | As we still don't know what you exactly do, I can only guess: you are opening many URLs at once, and only then you try to read them. Instead, you should/could open-read-close them and then advance to the next one.
Alternatively, you could create a concurrency capable URL loader: open some urls and try to read them conc... | 1 | 5 | 0 | I have a long list of URLs I need to open for my service. Whenever I attempt to open this entire list, I receive many errors such as this when I initiate the program: [Errno 24] Too many open files. I am using urllib2 and gevent.
Does anyone have any solutions?
Thanks. | Python urllib2 Errors | 0 | 0 | 0 | 817 |
11,718,410 | 2012-07-30T09:11:00.000 | 4 | 0 | 1 | 0 | python,setuptools | 11,718,585 | 1 | true | 0 | 0 | This won't work with setuptools; you cannot override dependencies like that, for good reasons.
What you describe is a broken dependency; you'll have to resolve this manually (probably by pinning package A to v. 2.0). | 1 | 2 | 0 | Let's say I have a setuptools project that depends on
PyPi package A, v. 1.0.
PyPi package B, v. 1.0.
and package B depends on A, v. 2.0.
In Java I would have to exclude transitive dependencies in pom.xml or similar. How does it work in setuptools? Can multiple versions of the same package live together in an install... | How setuptools deals with transitive dependencies? | 1.2 | 0 | 0 | 448 |
11,719,619 | 2012-07-30T10:26:00.000 | 1 | 0 | 0 | 0 | python,user-interface,64-bit,pywinauto | 12,949,711 | 4 | false | 0 | 0 | Azurin, you always can use python32bit + pywinauto on your x64 OS. If you realy need python64 you also can use py2exe to compile a test in .exe and use it everywhere, even on OSes where python is not installed. :) | 2 | 3 | 0 | I am using pywinauto for gui automation for quite a long time already. Now I have to move to x64 OS. There seems to be no official version for 64 bit OS. There are clones which claim they support 64, but in practice they don't.
On installation there are several assertions about wrong win structures size. If commented o... | Looking for a way to use Pywinauto on Win x64 | 0.049958 | 0 | 0 | 2,889 |
11,719,619 | 2012-07-30T10:26:00.000 | -2 | 0 | 0 | 0 | python,user-interface,64-bit,pywinauto | 22,605,499 | 4 | false | 0 | 0 | win32structure.py
ensure HANDLE is c_void_p
redefine other handles like HBITMAP to HANDLE
ensure pointers are pointers and not long | 2 | 3 | 0 | I am using pywinauto for gui automation for quite a long time already. Now I have to move to x64 OS. There seems to be no official version for 64 bit OS. There are clones which claim they support 64, but in practice they don't.
On installation there are several assertions about wrong win structures size. If commented o... | Looking for a way to use Pywinauto on Win x64 | -0.099668 | 0 | 0 | 2,889 |
11,724,257 | 2012-07-30T15:09:00.000 | 3 | 0 | 0 | 1 | python,security,subprocess,chroot,jail | 11,725,863 | 2 | true | 0 | 0 | After creating your jail you would call os.chroot from your Python source to go into it. But even then, any shared libraries or module files already opened by the interpreter would still be open, and I have no idea what the consequences of closing those files via os.close would be; I've never tried it.
Even if this wo... | 1 | 12 | 0 | I'm writing a web server based on Python which should be able to execute "plugins" so that functionality can be easily extended.
For this I considered the approach to have a number of folders (one for each plugin) and a number of shell/python scripts in there named after predefined names for different events that can o... | Python: Securing untrusted scripts/subprocess with chroot and chjail? | 1.2 | 0 | 0 | 7,078 |
11,725,192 | 2012-07-30T16:03:00.000 | 1 | 0 | 1 | 0 | python,multithreading,sockets,asynchronous | 11,725,633 | 1 | true | 0 | 0 | For a group chat application, the general approach will be:
Server side (accept process):
Create the socket, bind it to a well known port (and on appropriate interface) and listen
While (app_running)
Client_socket = accept (using serverSocket)
Spawn a new thread and pass this socket to the thread. That thread handles... | 1 | 2 | 0 | I am developing a group chat application to learn how to use sockets, threads (maybe), and asycore module(maybe).
What my thought was have a client-server architecture so that when a client connects to the server the server sends the client a list of other connects (other client 'user name', ip addres) and then a perso... | Group chat application in python using threads or asycore | 1.2 | 0 | 1 | 1,547 |
11,725,340 | 2012-07-30T16:11:00.000 | 5 | 0 | 1 | 0 | python,multithreading,orphan | 11,725,777 | 2 | true | 0 | 0 | If you can get a handle to the main thread, you can call is_alive() on it.
Alternatively, you can call threading.enumerate() to get a list of all currently living threads, and check to see if the main thread is in there.
Or if even that is impossible, then you might be able to check to see if the child thread is the ... | 2 | 6 | 0 | I have a program using a thread. When my program is closed, my thread is still running and that's normal. I would like to know how my thread can detect that the main program is terminated; by itself ONLY. How would I do that?
My thread is in an infinite loop and process many object in a Queue. I can't define my thread ... | python: How to detect when my thread become orphan? | 1.2 | 0 | 0 | 2,406 |
11,725,340 | 2012-07-30T16:11:00.000 | 0 | 0 | 1 | 0 | python,multithreading,orphan | 11,725,681 | 2 | false | 0 | 0 | Would it work if your manager tracked how many open threads there were, then the children killed themselves when starved of input? So the parent would start pushing data on to the queue, and the workers would consume data from the queue. If a worker found nothing on the queue for a certain timeout period, it would ki... | 2 | 6 | 0 | I have a program using a thread. When my program is closed, my thread is still running and that's normal. I would like to know how my thread can detect that the main program is terminated; by itself ONLY. How would I do that?
My thread is in an infinite loop and process many object in a Queue. I can't define my thread ... | python: How to detect when my thread become orphan? | 0 | 0 | 0 | 2,406 |
11,725,519 | 2012-07-30T16:23:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 67,397,573 | 29 | false | 0 | 0 | I had the same symptoms. In my instance the problem source was that I had set
idea.max.intellisense.filesize=50 in the custom properties.
I could resolve it by setting it to 100.
Help->Edit Custom Properties | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 4 | 0 | 1 | 0 | python,pycharm | 34,501,678 | 29 | false | 0 | 0 | You might try closing Pycharm, deleting the .idea folder from your project, then starting Pycharm again and recreating the project. This worked for me whereas invalidating cache did not. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0.027579 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 13 | 0 | 1 | 0 | python,pycharm | 22,563,427 | 29 | false | 0 | 0 | I find myself removing and re-adding the remote interpreter to fix this problem when Invalidating Caches or Refreshing Paths does not work.
I use vagrant and every once and awhile if I add a new VM to my multi-vm setup, the forwarded port changes and this seems to confuse PyCharm when it tries to use the wrong port for... | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 1 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 7 | 0 | 1 | 0 | python,pycharm | 27,937,500 | 29 | false | 0 | 0 | Sorry to bump this question, however I have an important update to make.
You may also want to revert your project interpreter to to Python 2.7.6 if you're using any other version than that This worked for me on my Ubuntu installation of PyCharm 4.04 professional after none of the other recommendations solved my problem... | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 1 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 12 | 0 | 1 | 0 | python,pycharm | 29,665,019 | 29 | false | 0 | 0 | If none of the other solutions work for you, try (backing up) and deleting your ~/.PyCharm40 folder, then reopening PyCharm. This will kill all your preferences as well.
On Mac you want to delete ~/Library/Caches/Pycharm40 and ~/Library/Preferences/PyCharm40.
And on Windows: C:\Users\$USER.PyCharm40. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 1 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 11 | 0 | 1 | 0 | python,pycharm | 30,163,990 | 29 | false | 0 | 0 | Tested with PyCharm 4.0.6 (OSX 10.10.3)
following this steps:
Click PyCharm menu.
Select Project Interpreter.
Select Gear icon.
Select More button.
Select Project Interpreter you are in.
Select Directory Tree button.
Select Reload list of paths.
Problem solved! | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 1 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 3 | 0 | 1 | 0 | python,pycharm | 57,279,189 | 29 | false | 0 | 0 | None of the answers solved my problem.
What did it for me was switching environments and going back to the same environment. File->Settings->Project interpreter
I am using conda environments. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0.020687 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 36,353,915 | 29 | false | 0 | 0 | I closed all the other projects and run my required project in isolation in Pycharm. I created a separate virtualenv from pycharm and added all the required modules in it by using pip. I added this virtual environment in project's interpreter. This solved my problem. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0.006896 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 39,994,591 | 29 | false | 0 | 0 | Geeze what a nightmare, my amalgamation of different StackOVerflow answers:
Switch to local interpreter /usr/bin/pythonX.X and apply
View paths like above answer
Find skeletons path. Mine was (/home/tim/Desktop/pycharm-community-2016.2.3/helpers/python-skeletons)
Switch back to virt interpreter and add the skeletons p... | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0.006896 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 42,952,046 | 29 | false | 0 | 0 | None of the above solutions worked for me!
If you are using virtual environment for your project make sure to apply the python.exe file that is inside your virtual environment directory as interpreter for the project (Alt + Ctrl + Shift + S)
this solved the issue for me. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0.006896 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 487 | 0 | 1 | 0 | python,pycharm | 11,773,462 | 29 | true | 0 | 0 | File | Invalidate Caches... and restarting PyCharm helps. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 1.2 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 65,300,581 | 29 | false | 0 | 0 | I had to go to File->Invalidate Caches/Restart, reboot Ubuntu 18.04 LTS, then open Pycharm and File-> Invalidate Caches/Restart again before it cleared up. | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0 | 0 | 0 | 235,738 |
11,725,519 | 2012-07-30T16:23:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 65,666,542 | 29 | false | 0 | 0 | For me it helped:
update your main directory "mark Directory as" -> "source root" | 13 | 322 | 0 | I am using PyCharm to work on a project. The project is opened and configured with an interpreter, and can run successfully. The remote interpreter paths are mapped properly. This seems to be the correct configuration, but PyCharm is highlighting my valid code with "unresolved reference" errors, even for built-in Py... | PyCharm shows unresolved references error for valid code | 0 | 0 | 0 | 235,738 |
11,725,645 | 2012-07-30T16:29:00.000 | 5 | 1 | 0 | 0 | python,pdf,latex | 11,725,677 | 3 | true | 1 | 0 | I would suggest using the LaTeX approach. It is cross-platform, works in many different languages and is easy to maintain. Plus it's non-commercial! | 1 | 6 | 0 | I'm trying to develop a small script that generate a complete new pdf, mainly text and tables, file as result.
I'm searching for the best way to do it.
I've read about reportlab, which seems pretty good. It has only one drawback asfar as I can see. It is quiet hard to write a template without the commercial version, ... | Generate a pdf with python | 1.2 | 0 | 0 | 3,407 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.