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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30,814,133 | 2015-06-13T01:03:00.000 | 0 | 0 | 1 | 0 | python,contour | 30,814,337 | 1 | false | 0 | 0 | You can save each layer into a PNG file with a transparent background and overlay them in Photoshop, Gimp or ImageMagick. | 1 | 0 | 1 | Using Python, how to create two(or more) color contour plots, each with their own color map, but overlaid into a single image with the same x and y axes? | How to make overlaid contour plots with python? | 0 | 0 | 0 | 67 |
30,814,615 | 2015-06-13T02:53:00.000 | 2 | 0 | 1 | 0 | python,c++,c,gdb | 30,814,798 | 1 | false | 0 | 0 | parse_and_eval does not always do exactly what you want. Unlike some other operations, it is exposed to the user's current language setting, and sometimes other things like set print object. And, if you already have a gdb.Value from some other computation, using parse_and_eval means that you must convert it to a stri... | 1 | 1 | 0 | I am not able to understand the utility of the two GDB-Python APIs, Value.cast() and Value.dereference(). I feel gdb.parse_and_eval() can do exactly the same thing that these 2 guys do ( and more ).
For example, I can achieve Value.cast("int*") with gdb.parse_and_eval('(int*)Value') and I can achieve Value.dereference(... | GDB Python APIs: Doesn't .parse_and_eval() make .cast() and .dereference() redundant? | 0.379949 | 0 | 0 | 335 |
30,815,480 | 2015-06-13T05:36:00.000 | 4 | 0 | 1 | 0 | python,cryptography | 30,815,622 | 1 | true | 0 | 0 | The answer is yes for a given size of integer - by default python integers that get big become long and then have potentially infinite length - the compare time then grows with the size. If you restrict the size of the integer to a ctypes.c_uint64 or ctypes.c_uint32 this will not be the case.
Note that compare with 0 ... | 1 | 4 | 0 | is integer comparison in Python constant time? Can I use it to compare a user-provided int token with a server-stored int for crypto in the way I would compare strings with constant_time_compare from django.utils.crypto, i.e. without suffering timing attacks?
Alternatively, is it more secure to convert to a string and ... | Is integer comparison in Python constant time? | 1.2 | 0 | 0 | 730 |
30,816,730 | 2015-06-13T08:40:00.000 | 0 | 0 | 0 | 1 | image,google-app-engine,google-app-engine-python,serving | 30,824,576 | 1 | false | 1 | 0 | Try specifying size=0 in the images.get_serving_url method call.
eg. images.get_serving_url(blob_key, size=0) | 1 | 0 | 0 | I have created a Google App Engine project where it's possible to upload photos. Uploading part is working fine and all the photos are uploaded in proper size. But when I try getting images.get_serving_url , it returns me serving_url appended with lh3.googleusercontent.com but according to GoogleAppEngine documentation... | Google App Engine : Wrong Serving Url | 0 | 0 | 0 | 50 |
30,818,792 | 2015-06-13T12:41:00.000 | 0 | 0 | 0 | 0 | python,django,read-write | 30,820,665 | 1 | false | 1 | 0 | Django Group and Permission applies on model itself. So for a specific entry of document if you want to give access to user in that case you need to change your schema of Document model. Just add a users_who_can_read=ManyToMany(Users), users_who_can_write=ManyToMany(Users), and at your view.py when a user is trying to ... | 1 | 0 | 0 | I have a 'Document' model which has many-to-many relationship with User model.There is a separate web page in my project which displays the Document instance in a text editor.
Now suppose user who created one document wants to invite other users to this document.But he wants to give read-only permission to some and rea... | How to permissions to a group in Django 1.8? | 0 | 0 | 0 | 323 |
30,818,814 | 2015-06-13T12:44:00.000 | 0 | 0 | 1 | 0 | python | 30,818,989 | 2 | false | 0 | 0 | Not built-in.
remove(elem)
remove(elem)
Remove element elem from the set. Raises KeyError if elem is not contained in the set.
Try to catch the exception in your own function maybe?
When exception caught return your element b. | 1 | 0 | 0 | Is there a deleting method for deleting an element of a set that takes a parameter to return if there is no element to delete that matches the parameter you gave it to delete?
So it would be something like set.discard(a,b) where a is the parameter that you want to delete and b is the parameter that gets returned if a ... | Is there a python set deleting method that returns a value if the value you want to delete is not in the set? | 0 | 0 | 0 | 456 |
30,820,896 | 2015-06-13T16:23:00.000 | 1 | 0 | 0 | 0 | python | 30,821,067 | 1 | true | 0 | 0 | Step in the function using pdb.
use pdb.set_trace() some where before you are calling train method.
Something like this
import pdb; pdb.set_trace()
classifier = NaiveBayesClassifier.train(training_set)
When you debug. Stop at the line where you are calling train method.
press s to step in the function. This will take y... | 1 | 0 | 1 | I am calling a function like this:
classifier = NaiveBayesClassifier.train(training_set)
and I would like to debug the code inside the train() function. The problem is that if I add print statements or pdb calls nothing changes.
I am importing this:
from nltk.classify.naivebayes import NaiveBayesClassifier
but even if... | How to find out what function I am calling | 1.2 | 0 | 0 | 50 |
30,821,218 | 2015-06-13T16:55:00.000 | 1 | 1 | 1 | 0 | python,git,github | 30,821,244 | 4 | false | 0 | 0 | Considering storing this kind of data in a config file that isn't tracked by git. | 1 | 0 | 0 | I'm creating a code to demonstrate how to consume a REST service in Python, but I don't want my API keys to be visible to people when I push my changes to GitHub. How can I hide such information? | How can I hide sensitive data before commiting to GitHub (or any other Git repo)? | 0.049958 | 0 | 1 | 2,480 |
30,821,848 | 2015-06-13T17:59:00.000 | 0 | 0 | 1 | 0 | python,spectral | 71,106,530 | 2 | false | 0 | 0 | you can use "pip install spectral"on terminal to install the spectral package.
you can refer to "https://pypi.org/project/spectral/". | 1 | 0 | 0 | I have already installed all the SPy dependencies and trying to import the spectral module in ipython version3.0 and getting this error : no module named spectral. what could possibly be wrong? | import error: no module named spectral | 0 | 0 | 0 | 3,186 |
30,825,162 | 2015-06-14T01:25:00.000 | 0 | 0 | 1 | 1 | python,shell,command-line | 30,831,720 | 1 | true | 0 | 0 | Put the python files in a folder and then put this folder into an installation directory (may be in /usr/local/foldername).
Use chdir in script/s to change directory to the file containing folder (may be os.path.dirname(os.path.realpath(sys.argv[0]))) to import dependencies from there, or use absolute path.
Now make a... | 1 | 0 | 0 | I know that if my program were just one python script file, I could just start it with the shebang and put it in /usr/local/bin so that I could invoke it at any time from the command prompt.
However, what if my program were multiple files, but I only want one to be invokable from the command line? For example, if I've... | How can I put a python program with multiple files in /usr/local/bin? | 1.2 | 0 | 0 | 494 |
30,826,123 | 2015-06-14T05:07:00.000 | 6 | 0 | 0 | 0 | python,scapy,dpkt | 37,963,958 | 2 | false | 0 | 0 | Scapy is a better performer than dpkt.
You can create, sniff, modify and send a packet using scapy. While dpkt can only analyse packets and create them. To send them, you need raw sockets.
As you mentioned, Scapy can sniff live. It can sniff from a network as well as can read a .pcap file using the rdpcap method or of... | 1 | 6 | 0 | I am trying to analyse packets using Python's Scapy from the beginning. Upon recent searching, I found there is another module in python named as dpkt. With this module I can parse the layers of a packet, create packets, read a .pcap file and write into a .pcap file. The difference I found among them is:
Missing of li... | Python Scapy vs dpkt | 1 | 0 | 0 | 9,574 |
30,827,316 | 2015-06-14T08:25:00.000 | 12 | 0 | 1 | 0 | python | 30,827,361 | 2 | true | 0 | 0 | os.path.relpath(path1, path2) # that's it | 1 | 8 | 0 | I would like to find the relative path between two directories on my system.
Example:
If I have pathA == <pathA> and pathB == <pathA>/dir1/dir2, the relative path between them will be dir1/dir2.
How could I find it in python? Is there a tool I could use?
If pathB is contained in pathA, I could just do pathB.replace(pat... | How to find the relative path between two directories? | 1.2 | 0 | 0 | 3,409 |
30,833,264 | 2015-06-14T18:54:00.000 | -1 | 0 | 0 | 0 | python,windows,command-line,pyqt4,qstring | 30,833,435 | 2 | false | 0 | 1 | I think that this problem happens because the command line parameters are actually byte arrays and not strings, strings are encoded in Unicode, but byte arrays are not. Calling str(cmd) return the content of cmd as a string. | 1 | 1 | 0 | Using PyQt 4, Python 2.7, Windows 7 on a x64 machine.
I have been developing a bit of code using a Python console with PyQt4 and passing strings from QLineEdit() widgets to OS commands with no issues using os.system(cmd)
But when I tried running from the command line in Windows I get the following error,
TypeError: se... | PyQt Qstring not accepted when script run from WIndows command line, why? | -0.099668 | 0 | 0 | 288 |
30,833,432 | 2015-06-14T19:11:00.000 | 0 | 0 | 1 | 1 | python,shell,installation,package | 30,833,498 | 3 | false | 0 | 0 | Click Windows(button)+R then type cmd. In there type pip -V, what version does it show?
If you get pip 6.1.1 from C:\Python32\lib\site-packages <python 3.4> (depending on your directory) then you're good, simply make your installations from there. | 2 | 1 | 0 | I am trying to install some python packages from the python shell but I get syntaxError. I am using python 3.4.3 which supposed to come with pip installed and I can see pip3 pip3.4, pip, easy_install, and easy_install-3.4 under scripts but whenever I run the command in the shell I get syntax error.
Am I not supposed ... | Can't install any python package from the python command prompt | 0 | 0 | 0 | 4,366 |
30,833,432 | 2015-06-14T19:11:00.000 | 3 | 0 | 1 | 1 | python,shell,installation,package | 30,833,440 | 3 | false | 0 | 0 | Am I not supposed to use the python shell for package installation?
No. Commands like pip are to be run on the operating system command line (i.e., the "DOS prompt" on Windows). | 2 | 1 | 0 | I am trying to install some python packages from the python shell but I get syntaxError. I am using python 3.4.3 which supposed to come with pip installed and I can see pip3 pip3.4, pip, easy_install, and easy_install-3.4 under scripts but whenever I run the command in the shell I get syntax error.
Am I not supposed ... | Can't install any python package from the python command prompt | 0.197375 | 0 | 0 | 4,366 |
30,833,978 | 2015-06-14T20:06:00.000 | 0 | 0 | 1 | 0 | python,module | 30,834,175 | 2 | true | 0 | 0 | Since it is supposed to be used commonly among modules, use should create a file called constants inside your package and initialize the variable with file contents in it. As an afterthought, init file of package is also good candidate for such kind of data. | 1 | 1 | 0 | I have written some Python libraries and structured them as a module. All files within the module require some data from a text file to work. The easiest solution would be to let each library read the file whenever they need it. However, reading the same file several times seems inefficient.
I would prefer to read the ... | Sharing data within a Python module | 1.2 | 0 | 0 | 76 |
30,835,522 | 2015-06-14T23:11:00.000 | -2 | 0 | 1 | 1 | python,environment-variables | 60,003,845 | 2 | false | 0 | 0 | you can get all the variables by
import os
print(os.environ)
this will return you the dictionary type of output with keys as enviornment variables and values as the values of the enviornment variables.
to get the current username:
print(os.environ['USERNAME'])
Look for yourself what you want in the dictionary. | 1 | 6 | 0 | Is there way to determine which environment variables returned by os.environ belongs to current user and which one - to all users? I do not want to change it, only get.
UPD: I am using Microsoft Windows 7. | Get environment variable for current user and for all users in Python | -0.197375 | 0 | 0 | 4,434 |
30,835,547 | 2015-06-14T23:16:00.000 | 32 | 0 | 0 | 1 | python,automation | 30,835,954 | 3 | true | 0 | 0 | You can use cron for this if you are on a Linux machine. Cron is a system daemon used to execute specific tasks at specific times.
cron works on the principle of crontab, a text file with a list of commands to be run at specified times. It follows a specific format, which can is explained in detail in man 5 crontab
For... | 1 | 25 | 0 | I have two Python scripts on my machine that I want to execute two times a day on specific time period. How do I automate this task? Since I will be away from home and thus my computer for a while, I want to upload them to a site and be executed from there automatic without me doing anything.
How can I do this? | How to execute script on schedule? | 1.2 | 0 | 0 | 56,111 |
30,838,479 | 2015-06-15T06:20:00.000 | 1 | 0 | 0 | 0 | python,compression,tar,tarfile | 31,104,811 | 2 | false | 0 | 0 | You can pipe the result of the tar command directly to the lz4 utility. This will avoid usage of any intermediate file. Here is an example (assuming you have both tar and lz4 installed on your system) :
tar cvf - * | lz4 > mypack.tar.lz4
The - here tells to output the result from tar to stdout. Of course, you can chan... | 1 | 3 | 0 | I'm trying to set up a code to pack a few big files (from tens to hundreds of gigabytes) into one archive. The compression methods that supported in tarfile module are a bit slow for such a big amount of data, so I would like to use some external compress module like lz4 to achive better speed of compression. Unfortuna... | Python: how to create tar file and compress it on the fly with external module, using different compression methods not available in tarfile module? | 0.099668 | 0 | 0 | 2,015 |
30,838,875 | 2015-06-15T06:48:00.000 | 1 | 0 | 0 | 0 | python,python-3.x,requirements | 30,839,105 | 2 | false | 0 | 0 | The pattern makes sense in some cases, but for me it's when you want to be able to run each module as a self sustained executeable.
I.E. Should you want to use the script from within FORTRAN or similar language, it is the easiest way, to build the python module to an executeable, and then call it from FORTRAN.
That wou... | 1 | 0 | 0 | How would the output of one script be passed as the input to another? For example if a.py outputs format.xml then how would a.py call b.py and pass it the argument format.xml? I think it's supposed to work like piping done on the command line.
I've been hired by a bunch of scientists with domain specific knowledge but ... | output of one file input to next | 0.099668 | 0 | 0 | 360 |
30,847,948 | 2015-06-15T14:36:00.000 | 0 | 0 | 0 | 0 | python,search,search-engine,pyramid | 30,852,953 | 2 | false | 1 | 0 | I could see this being posted to the UX SE (ux.stackexchange.com I think?) site, or they might already have a question there touching on something like this. But personally I would probably lean toward either a dropdown selector with different types, or keeping the separate searches as-is. And I think I'd lean more t... | 2 | 0 | 0 | Not sure if this question is better suited for a different StackExchange site but, here goes:
I have a search page that searches a number of different type of things. All (at the moment) requiring a different input field for each type of search. For example, one might search for a school or district name, a class name,... | Search box/field design with multiple search locations | 0 | 0 | 0 | 171 |
30,847,948 | 2015-06-15T14:36:00.000 | 0 | 0 | 0 | 0 | python,search,search-engine,pyramid | 30,860,645 | 2 | true | 1 | 0 | What happens to your search interface if the application changes? This is a very important aspect. Do you add another search type?
A search returns matches on the query string. A result set can contain different entities from different types. Then your search/resultset interface could apply filtering based on entity ty... | 2 | 0 | 0 | Not sure if this question is better suited for a different StackExchange site but, here goes:
I have a search page that searches a number of different type of things. All (at the moment) requiring a different input field for each type of search. For example, one might search for a school or district name, a class name,... | Search box/field design with multiple search locations | 1.2 | 0 | 0 | 171 |
30,854,395 | 2015-06-15T20:27:00.000 | 0 | 0 | 0 | 0 | python,django,django-models | 30,856,157 | 1 | false | 1 | 0 | Wouldn't there be security issues at letting an external site dictate what your db's structure looks like? A problem of any kind (or a man in the middle attack) could completely modify (or destroy) your database without you doing anything.
I'd say it's better to have API versions than what you're asking for. I'd prefer... | 1 | 1 | 0 | I am setting up a public API for my app. I want to segregate my API code from my application code, so I am putting it in a new django project and am using "Django REST Framework" to build the scaffolding for the public API services.
I'm struggling with how to keep models in sync between my main application project, and... | Importing models from a different Django project | 0 | 0 | 0 | 92 |
30,856,274 | 2015-06-15T22:53:00.000 | 0 | 0 | 1 | 0 | python,windows,directory,project,virtualenv | 30,856,299 | 2 | false | 0 | 0 | testenv/bin/pip and testenv/bin/python
I'd check it in a local repository and check it out in the virtualenv.
No, you have not. | 1 | 1 | 0 | I am new to python development using virtualenv. I have installed python 2.7, pip, virtualenv, virtualenvwrapper in windows and I am using windows PS. I have referred lots of tutorials for setting this up. Most of them contained the same steps and almost all of them stopped short of explaining what to do after the vir... | Run an existing python web application inside a virtalenv | 0 | 0 | 0 | 192 |
30,857,579 | 2015-06-16T01:46:00.000 | 0 | 0 | 1 | 0 | python,windows,background | 30,857,715 | 2 | false | 0 | 0 | Sure you can. You just hide the window without destroying it. It will run for ever until you kill the mainloop itself. Your questing is too broad. | 1 | 1 | 0 | To be more specific: Is there a way for a python program to continue running even after it's closed (like automatic open at a certain time)? Or like a gmail notification? This is for an alarm project, and I want it to ring/open itself even if the user closes the window. Is there a way for this to happen/get scripted? I... | Is there a way for a python program to continue running even after it's closed (like automatic open at a certain time)? | 0 | 0 | 0 | 111 |
30,861,956 | 2015-06-16T08:03:00.000 | 1 | 0 | 0 | 0 | python,python-2.7,ubuntu,pandas | 30,865,729 | 2 | true | 0 | 0 | So, the solution was essentially to create a virtual environment and install the needed packages independently. Some issues with dependencies on my system, I believe. | 2 | 0 | 1 | I'm doing a data science course on udemy using python 2.7, running Anaconda. My OS is Ubuntu 14.04.
I'm getting the following error running with the pandas module:
Traceback (most recent call last):
File "/home/flyveren/PycharmProjects/Udemy/15_DataFrames.py", line 13, in <module>
nfl_frame = pd.read_clipboard()
... | Python 2.7 Anaconda Pandas error(Ubuntu 14.04) | 1.2 | 0 | 0 | 332 |
30,861,956 | 2015-06-16T08:03:00.000 | 1 | 0 | 0 | 0 | python,python-2.7,ubuntu,pandas | 40,701,927 | 2 | false | 0 | 0 | I watch same lecture at udemy and face same problem.
I change my browser from internet explorer to chrome. (I'm using windows7 & VS2013 with PTVS)
Then, error does not occur.
However, delimeter has some problem.
Space should not be used as delimeter according to lecture, however, it does.
So, result is not perfect. | 2 | 0 | 1 | I'm doing a data science course on udemy using python 2.7, running Anaconda. My OS is Ubuntu 14.04.
I'm getting the following error running with the pandas module:
Traceback (most recent call last):
File "/home/flyveren/PycharmProjects/Udemy/15_DataFrames.py", line 13, in <module>
nfl_frame = pd.read_clipboard()
... | Python 2.7 Anaconda Pandas error(Ubuntu 14.04) | 0.099668 | 0 | 0 | 332 |
30,867,061 | 2015-06-16T12:04:00.000 | 1 | 0 | 0 | 0 | python | 30,867,329 | 2 | false | 0 | 0 | You should use git.
Commit your code to git repo and update on your VPS.
You could add the update logic into your crontab script. | 2 | 0 | 0 | I'm pretty new at coding, and Python in general. I've written a python script that scrapes data from several sites and saves it to a sqlite3 db. I put it on a digital ocean VPS and it runs several times a day using cron. I currently use dropbox to sync files from the computer I'm doing the coding on to the server an... | What's the best way to push code updates to a server while using Python? | 0.099668 | 0 | 0 | 73 |
30,867,061 | 2015-06-16T12:04:00.000 | 0 | 0 | 0 | 0 | python | 30,867,403 | 2 | false | 0 | 0 | I know these options:
Git (Already mentioned)
(S)FTP (Better if you work on the code alone)
Samba Share (Also better if you're alone) | 2 | 0 | 0 | I'm pretty new at coding, and Python in general. I've written a python script that scrapes data from several sites and saves it to a sqlite3 db. I put it on a digital ocean VPS and it runs several times a day using cron. I currently use dropbox to sync files from the computer I'm doing the coding on to the server an... | What's the best way to push code updates to a server while using Python? | 0 | 0 | 0 | 73 |
30,868,980 | 2015-06-16T13:27:00.000 | 2 | 0 | 0 | 0 | python,nltk,n-gram,sentence | 30,869,829 | 2 | true | 0 | 0 | If I'm getting it right and if the purpose is to test yourself on the vocabulary you already have learned, then another approach could be taken:
Instead of going through the difficult labor of NLG (Natural Language Generation), you could create a search program that goes online, reads news feeds or even simply Wikipedi... | 1 | 3 | 1 | I am writing a program that should spit out a random sentence of a complexity of my choosing. As a concrete example, I would like to aid my language learning by spitting out valid sentences of a grammar structure and using words that I have already learned. I would like to use python and nltk to do this, although I am ... | Generate Random Sentence From Grammar or Ngrams? | 1.2 | 0 | 0 | 1,204 |
30,870,391 | 2015-06-16T14:21:00.000 | 0 | 1 | 0 | 0 | python,python-2.7,raspberry-pi | 30,873,178 | 1 | false | 0 | 0 | Maybe an easier way would be to use the shell to kill the process in question? Each process in linux has a number assigned to it, which you can see by typing
pstree -p
In your terminal. You can then kill the process by typing in
sudo kill process number
Does that help, or were you thinking of something a bit more compl... | 1 | 0 | 0 | i am using 2 python programs with rc.local for my raspberry, first program is my main program and the other is the second program. The second program is shutdown the raspberry, but when i do the second program my first program is still running and will stopped until raspberry truly shutdown.
I want to make the second ... | how to kill a python programs using another python program on raspberry? | 0 | 0 | 0 | 526 |
30,871,384 | 2015-06-16T15:03:00.000 | 0 | 0 | 1 | 0 | python | 30,871,586 | 3 | false | 0 | 0 | Raw strings are helpful as they save you from adding escape characters just to escape 'escape characters'. For example r'url\1' is equivalent to 'url\\1' | 1 | 3 | 0 | I know the raw string operator r or R suppresses the meaning of escape characters but in what situation would this really be helpful? | How is a raw string useful in Python? | 0 | 0 | 0 | 108 |
30,872,599 | 2015-06-16T15:57:00.000 | 3 | 0 | 0 | 0 | python,django,database,naming-conventions | 30,872,816 | 1 | false | 1 | 0 | The default convention is better and cleaner to use :
It avoids any table naming conflict ( As It's a combination of App name and Model name)
It creates well organized database (Tables are ordered by App names)
So until you have any special case that needs special naming convention , use the default. | 1 | 0 | 0 | What is the convention/best practices for naming database tables in Django... using the default database naming scheme (appname_classname) or creating your own table name (using your own naming conventions) with the meta class? | Django database table naming convention | 0.53705 | 1 | 0 | 1,656 |
30,875,143 | 2015-06-16T18:15:00.000 | 1 | 0 | 0 | 0 | python,sockets,networking,tcp,udp | 30,875,280 | 3 | true | 0 | 0 | Answering your last question: no. Because:
If client is behind NAT, and the gateway (with NAT) has more than one IP, every connection can be seen by you as connection from different IP.
Another problem is when few different clients that are behind the same NAT will connect with your server, you will have more than on... | 3 | 1 | 0 | I've made a server (python, twisted) for my online game. Started with TCP, then later added constant updates with UDP (saw a big speed improvement). But now, I need to connect each UDP socket client with each TCP client.
I'm doing this by having each client first connect to the TCP server, and getting a unique ID. The... | UDP and TCP always use same IP for one client? | 1.2 | 0 | 1 | 1,578 |
30,875,143 | 2015-06-16T18:15:00.000 | 1 | 0 | 0 | 0 | python,sockets,networking,tcp,udp | 30,876,002 | 3 | false | 0 | 0 | 1- Can I just take the IP address of a new TCP client, and send them data over UDP to that IP? NO in the general case, but ...
2- is it necessary for the client to connect twice, once for TCP and once for UDP ? NO, definitively
3- will the same client have the same IP address when connecting over UDP vs TCP (from the s... | 3 | 1 | 0 | I've made a server (python, twisted) for my online game. Started with TCP, then later added constant updates with UDP (saw a big speed improvement). But now, I need to connect each UDP socket client with each TCP client.
I'm doing this by having each client first connect to the TCP server, and getting a unique ID. The... | UDP and TCP always use same IP for one client? | 0.066568 | 0 | 1 | 1,578 |
30,875,143 | 2015-06-16T18:15:00.000 | 1 | 0 | 0 | 0 | python,sockets,networking,tcp,udp | 32,045,545 | 3 | false | 0 | 0 | First of all when you send data with TCP or UDP you have to give the port.
If your client connect with TCP and after your server send a response with UDP the packet will be reject by the client.
Why? Because you have to register a port for connection and you can not be sure the port is correctly open on the client.
So ... | 3 | 1 | 0 | I've made a server (python, twisted) for my online game. Started with TCP, then later added constant updates with UDP (saw a big speed improvement). But now, I need to connect each UDP socket client with each TCP client.
I'm doing this by having each client first connect to the TCP server, and getting a unique ID. The... | UDP and TCP always use same IP for one client? | 0.066568 | 0 | 1 | 1,578 |
30,875,263 | 2015-06-16T18:22:00.000 | 1 | 0 | 0 | 0 | python,gevent,epoll | 30,926,961 | 1 | true | 1 | 0 | Gevent does not provide their own epoll implementation yet.
If you don't monkeypatch select it will block the entire process instead of just one greenlet. | 1 | 0 | 0 | I'm working on GPIO stuff in Python, need to register the fd on epoll, since gevent monkey patched the python select library, there will not be select.epoll if monkey.patch_all(select=True), so here comes two questions:
Will be consequence that the monkey.patch_all(select=False)?
Or does Gevent provide its own epoll r... | Python select epoll in Gevent | 1.2 | 0 | 0 | 1,187 |
30,878,666 | 2015-06-16T21:35:00.000 | 13 | 0 | 1 | 0 | matplotlib,ipython,ipython-notebook | 46,445,873 | 4 | false | 0 | 0 | plt.ioff() and plt.ion() works like a charm in my Jupyter notebook with the notebook as backend (assuming the usual import matplotlib.pyplot as plt). | 2 | 68 | 0 | If I start an ipython notebook with matplotlib inlined, is there a way to subsequently plot a figure so that it shows in the "standard", non-inlined, way, without having to reload the notebook without the inline command? I'd like to be able to have some figures inlined int he notebook, but others in the traditional in... | matplotlib python inline on/off | 1 | 0 | 0 | 82,957 |
30,878,666 | 2015-06-16T21:35:00.000 | 10 | 0 | 1 | 0 | matplotlib,ipython,ipython-notebook | 30,884,922 | 4 | false | 0 | 0 | It depends on the exact configuration of your matplotlib,
but you can switch between inline and one of 'osx', 'qt4', 'qt5', 'gtk3', 'wx', 'qt', 'gtk', 'tk' (some are aliases of other). just use %matplotlib <the one you want> to switch. Depending on conditions you migh have only access to one of these. | 2 | 68 | 0 | If I start an ipython notebook with matplotlib inlined, is there a way to subsequently plot a figure so that it shows in the "standard", non-inlined, way, without having to reload the notebook without the inline command? I'd like to be able to have some figures inlined int he notebook, but others in the traditional in... | matplotlib python inline on/off | 1 | 0 | 0 | 82,957 |
30,879,556 | 2015-06-16T22:47:00.000 | 1 | 0 | 1 | 0 | python,python-2.7 | 30,879,636 | 1 | false | 0 | 0 | Typically on a Mac you would expect to find:
/System/Library/Frameworks/Python.framework
/Library/Python
You should never touch the first, so the second exists to add local libraries.
What problem are you trying to solve by moving libraries? | 1 | 0 | 0 | My mac has two versions of Python,
one installed in /Library/Frameworks/Python.framework/Versions/2.7/bin/pip
and the other /Library/Python/2.7/site-packages/
I have plenty of packages installed in the second directory. How do I move all those packages under the first python ?
Also How do I force my mac to use the firs... | Shifting packages between different versions of python | 0.197375 | 0 | 0 | 27 |
30,880,102 | 2015-06-16T23:47:00.000 | 1 | 0 | 0 | 0 | python,import | 30,880,320 | 1 | true | 1 | 0 | You can't simply execute main.py from dir2; you'll need a script of sorts that lives outside your whole app package, and then if you import app.dir2.main, you'll get app.dir1.utils as well through the relative import.
Create a script that does from app.dir2 import main, then run that outside the app package. And use t... | 1 | 0 | 0 | Hi I use Django frequently and am constantly using relative imports along the lines of from .models import XXX for XXX in a models folder or from . import views for a file named views.py in same directory and it works fine there. But when I create my own Python application with a directory structure such as:
app/ con... | Python Relative Imports Only Work With Django | 1.2 | 0 | 0 | 112 |
30,880,392 | 2015-06-17T00:25:00.000 | 0 | 0 | 0 | 0 | python,sockets | 30,880,515 | 1 | true | 0 | 0 | could you make your server log for heartbeats? and also post heartbeats to the clients on the socket?
if so, have a monitor check for the server heartbeats and restart the server application if the heartbeats exceed the threshold value.
also, check for heartbeats on the client and reestablish connection when you did n... | 1 | 0 | 0 | I was trying to implement a multiuser chat (group chat) with socket on python.
It basically works like this: Each messages that a user send is received by the server and the server sends it back to the rest of the users.
The problem is that if the server close the program, it crashes for everyone else.
So, how can yo... | Creating Multi-user chat with sockets on python, how to handle the departure of the server? | 1.2 | 0 | 1 | 560 |
30,881,489 | 2015-06-17T02:46:00.000 | 1 | 0 | 0 | 0 | python,pandas | 30,881,760 | 2 | true | 0 | 0 | Variable = ?
The variable set would be equal to a pandas.core.frame.DataFrame object.
Format?
The pandas.core.frame.DataFrame format is a collection of numpy ndarrays, dicts, series, arrays or list-like structures that make up a 2 dimensional (typically) tabular data structure.
Pandas Object Type?
A pandas.core.frame.... | 2 | 0 | 0 | If I ftp into a database and use pandas.read_sql to read in a huge file, what data type would the variable set equal to this be? And, if applicable, what kind of format would it be in? What object type is a pandas data frame? | Data type using Pandas | 1.2 | 1 | 0 | 160 |
30,881,489 | 2015-06-17T02:46:00.000 | 0 | 0 | 0 | 0 | python,pandas | 30,881,700 | 2 | false | 0 | 0 | The function pandas.read_sql returns a DataFrame.
The type of a DataFrame in pandas is pandas.core.frame.DataFrame. | 2 | 0 | 0 | If I ftp into a database and use pandas.read_sql to read in a huge file, what data type would the variable set equal to this be? And, if applicable, what kind of format would it be in? What object type is a pandas data frame? | Data type using Pandas | 0 | 1 | 0 | 160 |
30,886,340 | 2015-06-17T08:35:00.000 | 0 | 0 | 0 | 0 | python,apache-spark | 30,887,058 | 2 | false | 0 | 0 | I think when you only use map action on FIRST_RDD(logs) you will get SECOND_RDD count of new this SECOND_RDD will be equal to count of FIRST_RDD.But if you use distinct on SECOND_RDD, count will decrease to number of distinct tuples present in SECOND_RDD. | 1 | 0 | 1 | I was working with Apache Log File. And I created RDD with tuple (day,host) from each log line. Next step was to Group up host and then display the result.
I used distinct() with mapping of first RDD into (day,host) tuple. When I don't use distinct I get different result as when I do. So how does a result change when u... | How does result changes by using .distinct() in spark? | 0 | 0 | 0 | 172 |
30,896,343 | 2015-06-17T15:44:00.000 | 0 | 0 | 1 | 0 | python,installation,ldap,python-2.6,gssapi | 52,655,111 | 3 | false | 0 | 0 | For me, the issue got resolved after installing the package "krb5-libs" in Centos.
Basically we need to have libgssapi_krb5.so file for installing gssapi. | 2 | 16 | 0 | I am trying to install the GSSAPI module through pip but I receive this error that I don't know how to resolve.
Could not find main GSSAPI shared library. Please try setting
GSSAPI_MAIN_LIB yourself or setting ENABLE_SUPPORT_DETECTION to
'false'
I need this to work on Python 2.6 for LDAP3 authentication. | How to install GSSAPI Python module? | 0 | 0 | 0 | 20,242 |
30,896,343 | 2015-06-17T15:44:00.000 | 14 | 0 | 1 | 0 | python,installation,ldap,python-2.6,gssapi | 50,410,443 | 3 | false | 0 | 0 | sudo apt install libkrb5-dev
actually installs /usr/bin/krb5-config and /usr/lib/libgssapi_krb5.so
so none of the symlinking was needed, just install libkrb5-dev and you should be good. | 2 | 16 | 0 | I am trying to install the GSSAPI module through pip but I receive this error that I don't know how to resolve.
Could not find main GSSAPI shared library. Please try setting
GSSAPI_MAIN_LIB yourself or setting ENABLE_SUPPORT_DETECTION to
'false'
I need this to work on Python 2.6 for LDAP3 authentication. | How to install GSSAPI Python module? | 1 | 0 | 0 | 20,242 |
30,896,713 | 2015-06-17T16:01:00.000 | 1 | 0 | 0 | 0 | python,python-imaging-library,pycuda | 31,172,404 | 1 | false | 0 | 0 | The shapely interface to GEOS may be the library for which you are looking, but I have never used it for this purpose.
It may be easier to roll your own, in this case. The algorithm is a straightforward sweep-line algorithm, with an average complexity per rectangle proportional to log(N).
A) Each rectangle is character... | 1 | 2 | 0 | I have a set of rectangles overlapping each other. I need to detect that overlaps exist in a set of rectangles. If overlaps exist, then I need to update the coordinates so the set of rectangles do not overlap anymore. I wonder if there are existing python libraries suited for this task.
This operation will be applied ... | Efficient library to detect and clip overlapping rectangles with python | 0.197375 | 0 | 0 | 628 |
30,902,045 | 2015-06-17T20:44:00.000 | 1 | 0 | 1 | 0 | python | 30,902,169 | 4 | false | 0 | 0 | You can loop though the csv.reader(). It will return you rows. Rows consist of lists. Compare the first element of the list ie row[0]. If it is what you want, add the row to an output list. | 1 | 3 | 1 | I have a CSV file with over 4,000 lines formatted like...
name, price, cost, quantity
How do I trim my CSV file so only the 20 names I want remain? I am able to parse/trim the CSV file, I am coming up blank on how to search column 1. | How to parse CSV file and search by item in first column | 0.049958 | 0 | 0 | 145 |
30,906,633 | 2015-06-18T04:47:00.000 | 4 | 0 | 1 | 0 | python | 30,906,651 | 1 | true | 0 | 0 | The bytes are the encoding. You need to decode them in order to get the text they encode. How Python encodes the text as bytes internally is... not your problem. | 1 | 1 | 0 | In Python 3 there are str and bytes types. To convert a bytes type into a str type, one would call the decode() method on an instance and vice versa. I am confused as to why this is, why is it not encode()? As I understand it, internally the actual bytes in memory are being encoded into an encoding (UTF-8 in Python's c... | Python 3's encode() and decode() methods | 1.2 | 0 | 0 | 80 |
30,909,195 | 2015-06-18T07:34:00.000 | 6 | 0 | 1 | 0 | python,cassandra | 30,916,615 | 1 | false | 0 | 0 | execute() will run one statement as a blocking call that will not return until the statement is finished executing.
execute_async() will submit one statement as an asynchronous call that will return immediately with a response_future object you can use to retrieve the results with at a later time. By calling execute_a... | 1 | 4 | 0 | I want to know the difference between execute_async() and execute_concurrent() in python for Cassandra queries. | Difference between execute_async() and execute_concurrent() | 1 | 0 | 0 | 1,325 |
30,911,872 | 2015-06-18T09:42:00.000 | 1 | 0 | 1 | 0 | python,pandas,sas | 30,916,191 | 7 | false | 0 | 0 | When you have the option to download a SAS dataset you will often also have the option to download a Stata dataset (this is indeed the case for PSID btw). In that case, the easiest way will likely be to import with read_stata (this might change in the future, but I believe is a very accurate statement as of today).
Le... | 1 | 6 | 0 | I'm working on a data set (PSID) that gives data in a SAS format (a .txt and another file containing instructions to interpret the data). I cannot find anything in Python to read this type of data.
Does anyone know of a pre-existing module/script to read SAS data?
Edit (added from a comment to an answer): The data is... | Import SAS data file into python data frame | 0.028564 | 0 | 0 | 19,271 |
30,920,656 | 2015-06-18T16:16:00.000 | 0 | 0 | 0 | 0 | python,database,python-3.x,io | 30,922,498 | 1 | false | 0 | 0 | Answering my own question: bytes(file) | 1 | 0 | 0 | I'm using Python 3.4. I have a binary column in a my postgresql database with some files and I need to retrieve it from the database and read it... the problem is that for this to work, I first have to (1) open a new file in the filesystem with 'wb', (2) write the contents of the binary column and then (3) read() the f... | Reading a file from database binary column (postgresql) in memory without having to save and open the file in the filesystem | 0 | 1 | 0 | 176 |
30,921,986 | 2015-06-18T17:31:00.000 | 2 | 0 | 1 | 0 | python | 30,922,275 | 1 | true | 0 | 0 | Creating a class with counter as one of its attribute will be a good solution.
Since the current functions will be explicitly called in the future, making counter an attribute will save the callee of variable passing and you of probably additional error checking.
Also the counter variable can be abstracted from the ca... | 1 | 2 | 0 | I have a Python module with a few functions. At the moment, these functions are only called from main(), but I expect to import the module from other files in the future.
I have a counter variable that is used and modified by most of these functions. At the moment I am passing it around as a parameter, and returning it... | Passing a variable back and forth vs. using a python constant | 1.2 | 0 | 0 | 139 |
30,926,097 | 2015-06-18T21:27:00.000 | 1 | 0 | 0 | 0 | python,pyqt4,stdin,raw-input,qwebpage | 30,926,485 | 1 | true | 0 | 1 | raw_input uses synchronous/blocking IO without giving Qt a chance to continue processing events in the background. Qt isn't really prepared for it's processing to be halted in this way. In theory it should just resume when raw_input is finished. But maybe in the meantime a timeout occurred or something like that. You r... | 1 | 1 | 0 | I'm using PyQt4 to enter credentials into a domain login page and pull data from several additional pages in the domain. Everything works exactly as expected when supplying login or search credentials from within the code. When I open up raw_input to allow the user to enter information, it causes hang-ups trying to dow... | Using raw_input causes problems with PyQt page loading | 1.2 | 0 | 1 | 285 |
30,926,669 | 2015-06-18T22:09:00.000 | 0 | 0 | 1 | 1 | python,windows,pdf,file-io | 30,985,046 | 1 | true | 0 | 0 | So, yes, Windows passes the file name into the script as one of the sys.argvs. It is (so far as I can tell from printing the value) a file name without the path, that I used to open the file, so that tells me that Windows starts my program with the working directory set to the directory of the file it's called on.
One ... | 1 | 2 | 0 | I want to set up my python program to process all pdfs that are opened on my system, and then hand the processed pdf off to a standard reader.
So I register my program with windows as the default handler for .pdf files and windows presumably will run my program on the pdf file.
How within the script do I access this ... | How to handle the File hand-off from windows in a python program | 1.2 | 0 | 0 | 68 |
30,927,270 | 2015-06-18T23:04:00.000 | 0 | 0 | 1 | 0 | python,subprocess,pexpect | 30,994,197 | 1 | false | 0 | 0 | I tried myprogram.expect('\r\n'), but it seems to contain the input along with the output.
Does this mean the "\n" in input is considered?If yes, thereis a way to suppress the echo by setting set echo to false. You can try that.
Also can you paste the code that you are trying? | 1 | 1 | 0 | With pexpect.spawn , I have a program running in the background that sends back a line for each input line sent.
What would be the appropriate expect expression for getting the whole lines as output?
(after waiting until the line is there in the output)
I do not want to use any specific string (like a prompt), other th... | How to properly use pexpect for this case? | 0 | 0 | 0 | 65 |
30,928,017 | 2015-06-19T00:21:00.000 | 2 | 0 | 1 | 0 | python,encryption,aes | 30,928,115 | 1 | true | 0 | 0 | AES is only defined for key sizes of 128, 192 and 256 bit. The is no way to use some other key size and still call it AES. If you want to be compatible with other implementations, you will have to stick to the defined key sizes.
Two common ways to get a key of the correct size are:
Simply slice only a part of your key... | 1 | 0 | 0 | Anyone have a way to encrypt/decrypt using Python to handle AES in CBC mode with a key of 1024 bits (128 bytes)? All the AES pkgs found so far seem to be limited to 256 bit keys. My crypto background is limited.... | How to use AES CBC using a key longer than 256 bits in Python | 1.2 | 0 | 0 | 693 |
30,928,370 | 2015-06-19T01:12:00.000 | 0 | 0 | 0 | 0 | php,python,rest,authentication | 30,932,400 | 2 | false | 1 | 0 | Actually I doesn't make great sense. From my experience I know that mobile apps and web pages even if use the same backend very often require completely different set of data, and - (I know premature optimization is the root of all evil) - number of calls should be minimized for mobile applications to make them running... | 1 | 0 | 0 | My next project requires me to develop both a mobile and a website application. To avoid duplicating code, I'm thinking about creating an API that both of these applications would use.
My questions regarding this are:
Is this approach sensible?
Are there any frameworks to help me with this?
How would I handle authe... | Creating a centric REST API for a mobile and website application | 0 | 0 | 1 | 288 |
30,928,713 | 2015-06-19T01:55:00.000 | 1 | 0 | 0 | 0 | python,mysql,insert,sql-insert,large-data | 53,005,996 | 3 | false | 0 | 0 | Having tried to do this recently, I found a fast method, but this may be because I'm using an AWS Windows server to run python from that has a fast connection to the database. However, instead of 1 million rows in one file, it was multiple files that added up to 1 million rows. It's faster than other direct DB method... | 1 | 4 | 0 | I have a txt file with about 100 million records (numbers). I am reading this file in Python and inserting it to MySQL database using simple insert statement from python. But its taking very long and looks like the script wouldn't ever finish. What would be the optimal way to carry out this process ? The script is usin... | Inserting millions of records into MySQL database using Python | 0.066568 | 1 | 0 | 13,099 |
30,931,897 | 2015-06-19T06:59:00.000 | 0 | 0 | 0 | 0 | python-2.7,openerp,odoo,openerp-8,odoo-8 | 31,235,475 | 2 | false | 1 | 0 | Inherit the write method of the model and give it a raise when your condition (in this case the not owned products) is met. This way the user will receive a warning message and they cannot save the changed values. | 1 | 2 | 0 | How to restrict the users to edit only the product attributes for non owned products in odoo/openerp?
Can this be achieved through record rules or coding? | Access control in odoo/openerp | 0 | 0 | 0 | 176 |
30,935,500 | 2015-06-19T10:09:00.000 | 0 | 0 | 0 | 0 | python,windows,selenium,phantomjs,chocolatey | 30,966,232 | 2 | false | 1 | 0 | What version of choco did you use to install PhantomJS (and what version of PhantomJS)? I believe we corrected this issue in most cases, but it is on newer versions of choco - and you need the shim to be generated in that newer version (which means install or upgrade, but we are adding a shim regen command). | 1 | 1 | 0 | I have some Python Selenium nose tests running on Windows 8 with PhantomJS. I installed Chutzpah (PhantomJS) via Chocolatey.
When I run the nose tests, a "ShimGen" process appears and lots of "PhantomJS is a headless WebKit with JavaScript API (32 bit)" processes appear and use 50+mb of memory and never close. This ca... | Why are nose tests leaving orphaned PhantomJS processes on Windows 8? | 0 | 0 | 0 | 131 |
30,936,625 | 2015-06-19T11:07:00.000 | 0 | 1 | 1 | 0 | python,python-2.7,installation | 30,939,196 | 1 | false | 0 | 0 | just run setup.py with the wrong python version. Solved. | 1 | 0 | 0 | I installed python module unidecode: downloaded it, run setup.py. Exactly as I did for any other python module.
Then tried import unidecode: It works only in the downloaded directory. What's wrong? | Installing unidecode python module | 0 | 0 | 0 | 3,372 |
30,937,667 | 2015-06-19T12:01:00.000 | 3 | 0 | 0 | 0 | python,scikit-learn,gaussian,naivebayes | 30,938,653 | 2 | true | 0 | 0 | Yes, you will need to convert the strings to numerical values
The naive Bayes classifier can not handle strings as there is not a way an string can enter in a mathematical equation.
If your strings have some "scalar value" for example "large, medium, small" you might want to classify them as "3,2,1",
However, if your... | 1 | 1 | 1 | I am trying to implement Naive Bayes classifier in Python. My attributes are of different data types : Strings, Int, float, Boolean, Ordinal
I could use Gaussian Naive Bayes classifier (Sklearn.naivebayes : Python package) , But I do not know how the different data types are to be handled. The classifier throws an err... | NaiveBayes classifier handling different data types in python | 1.2 | 0 | 0 | 3,764 |
30,939,165 | 2015-06-19T13:16:00.000 | 6 | 1 | 0 | 1 | python,text | 30,939,390 | 1 | true | 0 | 0 | Yes,
you are right,
you can only read
where you cannot write. | 1 | 0 | 0 | I need to change text documents. The way I've been doing it is making a new file, copying everything line by line from the old file and making changes on the way, then saving the new file as the old file's name. This becomes a problem when I only have read permission on the file. First I get OSErrno 30, not letting me ... | Changing a read-only file | 1.2 | 0 | 0 | 253 |
30,943,690 | 2015-06-19T17:12:00.000 | 1 | 0 | 1 | 1 | python,filenames | 30,944,299 | 1 | false | 0 | 0 | It's your shell, not Python, that's doing the expansion. Python always sees a single flat list of arguments.
In case you want to parse arguments, which basically turns this flat list into a more complex data structure, you can use the argparse module, or use more extensive third party projects like click. | 1 | 0 | 0 | I want to run something like:
python command.py -i -c "f*.xxx" "search"
This fine since "file-set" is not expanded" but:
python command.py -i -c f*.xxx "search"
This is expanded so
sys.argv = ['command.py','-i', '-c', 'f1.xxx','f2.xxx','search']
Why couldn't it be ['command.py','-i', '-c', ['f1.xxx','f2.xxx'],'... | For the life of me I cannot make a file-set argument the next to last one | 0.197375 | 0 | 0 | 52 |
30,947,172 | 2015-06-19T20:58:00.000 | 4 | 0 | 1 | 0 | python,eclipse | 30,955,933 | 1 | true | 0 | 0 | I'm assuming you're using PyDev. I don't know if there are other alternatives but that's what I use for Python in Eclipse.
Right-click on your project folder in the Package Explorer view and select "Properties".
Select "PyDev - Interpreter/Grammar"
Select the appropriate Grammar Version and Interpreter, if those optio... | 1 | 4 | 0 | I've installed Python 3.4 and am currently using Python 2.7. I want to create a Project in Python 3.4, but, when I go to Run-->Run Configurations and then look to make a new entry under Python Run , I see that C:\Python34 doesn't show up. Also, when I try to create a new Project, the "Grammar Version" goes only up to 3... | Trouble trying to run Python 2.7 and 3.4 in Eclipse | 1.2 | 0 | 0 | 1,700 |
30,948,736 | 2015-06-19T23:34:00.000 | 1 | 0 | 0 | 0 | python,json,unicode,utf-8,scrapy | 30,964,853 | 2 | false | 1 | 0 | As I don't have your code to test, Can you try to use codecs
Try:
import codecs
f = codecs.open('yourfilename', 'your_mode', 'utf-8')
f.write('whatever you want to write')
f.close() | 1 | 1 | 0 | I'm having problem on json output of scrapy. Crawler works good, cli output works without a problem. XML item exporter works without a problem and output is saved with correct encoding, text is not escaped.
Tried using pipelines and saving the items directly from there.
Using Feed Exporters and jsonencoder from json l... | Unicode on Scrapy Json output | 0.099668 | 0 | 1 | 2,012 |
30,948,885 | 2015-06-19T23:56:00.000 | 1 | 0 | 0 | 0 | python,mysql,pyramid,mysql-python | 30,969,950 | 1 | true | 0 | 0 | What @AlexIvanov is trying to say is that when you're starting your Pyramid app in console it is served using Pyramid's built-in development server. This server is single-threaded and serves requests one after another, so if you have a long request which takes, say, 15 seconds - you won't be able to use your app in ano... | 1 | 0 | 0 | I am writing a web tool using Python and Pyramid. It access a MySQL database using MySQLdb and does queries based on user input. I created a user account for the tool and granted it read access on the tables it uses.
It works fine when I open the page in a single tab, but if I try loading it in second tab the page won... | Accessing MySQL from multiple views of a web site | 1.2 | 1 | 0 | 69 |
30,950,198 | 2015-06-20T04:16:00.000 | 6 | 0 | 1 | 0 | python,datetime,pandas | 54,027,432 | 3 | false | 0 | 0 | This workaround gets you closer.
round((df["Accident Date"] - df["Iw Date Of Birth"]).dt.days / 365, 1) | 1 | 14 | 1 | In Pandas, why does a TimedeltaProperties object have no attribute 'years'?
After all, the datetime object has this property.
It seems like a very natural thing for an object that is concerned with time to have. Especially if it already has an hours, seconds, etc attribute.
Is there a workaround so that my column, wh... | AttributeError: 'TimedeltaProperties' object has no attribute 'years' in Pandas | 1 | 0 | 0 | 19,665 |
30,950,925 | 2015-06-20T06:13:00.000 | 8 | 0 | 0 | 0 | python,tkinter | 30,954,325 | 3 | true | 0 | 1 | If you want to make a GUI that is "platform independent and screen size independent", you definitely do not want to be measuring sizes yourself. Unless, by saying you want something platform independent, you're saying you want a button to be X pixels regardless of pixel density or screen resolution (which seems like a ... | 1 | 2 | 0 | I'm using Tkinter to design a UI for an application. I'm using grid geometry and while specifying button width (or any widget width), I realized that width should be specified in text units and not pixels. Since I want to make it platform independent and screen size independent Is there any method to get max text unit ... | Tkinter : Getting screen text unit width. (Not pixels) | 1.2 | 0 | 0 | 10,473 |
30,954,484 | 2015-06-20T13:23:00.000 | 0 | 0 | 1 | 0 | python,pygame,pip | 30,955,474 | 2 | false | 0 | 0 | If you feel comfortable with Linux, you could use a live USB drive to boot into Linux and work there (without installing anything to the actual hard drive), or you could set up a new OS inside of a virtual machine. Good luck. | 1 | 0 | 0 | Hi I am going interstate and will only have my laptop with me, I do not have admin rights on it and the use of Cmd is banned. I want to be able to use Pygame on my laptop. How can I install the module without command line? | Installing modules in Python without command line | 0 | 0 | 0 | 481 |
30,954,589 | 2015-06-20T13:36:00.000 | 2 | 0 | 1 | 1 | python,c++ | 30,954,837 | 2 | false | 0 | 1 | Look For python.net which is cable of making a call to the interfaces written in .net supported languages.
What all you need to do is
Steps:
Download and put it two files Python.Runtime.dll and clr.pyd in your DLLs folder.
From you >>>(triple greater than prompt )Python prompt Try
>>>import clr
if it doesn't gives a... | 1 | 0 | 0 | I need to execute C++ code to acquire images to process in python.
I need to use these commands from python:
make and
./name_of_the_executable
Could anybody please help know me how to do it? | Excuting cpp file from Python | 0.197375 | 0 | 0 | 70 |
30,957,671 | 2015-06-20T18:49:00.000 | 1 | 0 | 1 | 0 | python,windows,pip,anaconda | 30,958,087 | 2 | true | 0 | 0 | Just change your PATH environment variable to put C:\PythonXX\Scripts (where XX is the version of Python, usually 27 or 34) at the beginning.
Click on My Computer -> Properties -> System Properties -> Advanced -> Environment Variables, then select Path in either the System Variables section (if you have Administrator a... | 1 | 1 | 0 | I have been using Anaconda python on Windows 7, but a package I need isn't supported by Anaconda python, so I installed CPython from python.org. I'd like to install the package to CPython, but pip still installs everything to C:\Anaconda\ ...\site-packages. How can I change this? | Installing packages with pip with multiple python installs | 1.2 | 0 | 0 | 544 |
30,960,617 | 2015-06-21T02:07:00.000 | 2 | 1 | 0 | 0 | python,c,matlab,lzw,lz77 | 30,961,062 | 1 | false | 0 | 0 | Reconsider your choice of the LZ 77/78 algorithms. ECG waves look similar but they are not binary identical so the dictionary-based compression algorithms don't provide ideal results.
Complicated algorithms can hardly be expressed in few lines of code. | 1 | 1 | 1 | I am interested to implement LZ algorithms for the compression of ECG signal and want to optimized the code with relevant to Micro controller.
So that it would Entropy efficient and take less time to compress and decompress the ECG signal. I am totally stuck how I go through to achieve this. I am open to any programmi... | LZ 77, 78 algorithm for ECG Compression | 0.379949 | 0 | 0 | 339 |
30,969,031 | 2015-06-21T20:30:00.000 | 0 | 0 | 1 | 0 | python | 30,969,299 | 2 | false | 0 | 0 | Printing that many elements will take a non-trivial amount of time, even if it's in fact a small fraction of the total. If your numbers are extremely large (e.g., hundreds of digits), the overhead of converting them to decimal is also going to be a factor. Certainly, if you want to optimize a loop it won't hurt to tak... | 2 | 1 | 0 | I have a very large list of around 40 items. I am finding and printing its power set. So, the complexity of my code is n*2n. Undoubtedly, it is taking a long time. But, if I remove the print statement, will it bring any significant improvement to the runtime of code. In other words, is print adding a significant overhe... | Does adding a print statement in a loop add a significant overhead for large numbers? | 0 | 0 | 0 | 222 |
30,969,031 | 2015-06-21T20:30:00.000 | 0 | 0 | 1 | 0 | python | 30,969,246 | 2 | false | 0 | 0 | Printing isn't very CPU consuming itself, but a lot of OSes has got an artificial limit on the speed of printing characters to the command line, so I think it will be very significant (maybe even a hundred times slower). | 2 | 1 | 0 | I have a very large list of around 40 items. I am finding and printing its power set. So, the complexity of my code is n*2n. Undoubtedly, it is taking a long time. But, if I remove the print statement, will it bring any significant improvement to the runtime of code. In other words, is print adding a significant overhe... | Does adding a print statement in a loop add a significant overhead for large numbers? | 0 | 0 | 0 | 222 |
30,974,575 | 2015-06-22T07:48:00.000 | 1 | 0 | 0 | 0 | python,xlrd,openpyxl | 30,974,768 | 1 | false | 0 | 0 | xlrd can read both xlsx and xls files, so it's probably simplest to use that. Support for xlsx isn't as extensive as openpyxl but should be sufficient.
There's a risk of losing information in converting xlsx to xls because xlsx files can be much larger. | 1 | 0 | 0 | I have a web application (based on Django 1.5) wherein a user uploads a spreadsheet file.
I've been using xlrd for manipulating xls files and looked into openpyxl which claims to support xlsx/xlsm files.
So is there a common way to read/write both xls and xlsx files?
Another option could be to convert the uploaded f... | How do I read/write both xlsx and xls files in Python? | 0.197375 | 1 | 0 | 1,651 |
30,975,327 | 2015-06-22T08:34:00.000 | 0 | 0 | 1 | 0 | python,linux,pip,python-venv | 31,356,654 | 2 | false | 0 | 0 | This is perhaps not the best solution. Having the same issue on Fedora 22, I managed to install python3 packages using pip this way:sudo pip3 install --install-option="--prefix=/usr/lib/python3.4/site-packages" package_name | 1 | 1 | 0 | Ask: I can't install or upgrade any lib for python 3.4 because pip, pip3, pip3.4 not working or connected to python2.7.
I tried to set alias python=python3 and use just pip:
sudo pip install selenium
Requirement already satisfied (use --upgrade to upgrade): selenium in /usr/local/lib/python2.7/dist-packages
I tried p... | python&linux pip always try to use python2.7 instead of 3.4 | 0 | 0 | 0 | 1,996 |
30,976,120 | 2015-06-22T09:13:00.000 | 0 | 0 | 0 | 0 | python,scikit-learn,tf-idf | 56,899,773 | 3 | false | 0 | 0 | @kinkajou, No, TF and IDF are not same but they belong to the same algorithm- TF-IDF, i.e Term frequency Inverse document Frequency | 1 | 7 | 1 | I have code that runs basic TF-IDF vectorizer on a collection of documents, returning a sparse matrix of D X F where D is the number of documents and F is the number of terms. No problem.
But how do I find the TF-IDF score of a specific term in the document? i.e. is there some sort of dictionary between terms (in their... | Find the tf-idf score of specific words in documents using sklearn | 0 | 0 | 0 | 11,861 |
30,981,249 | 2015-06-22T13:29:00.000 | 1 | 0 | 1 | 0 | python,packages | 30,981,746 | 6 | false | 0 | 0 | You can try to install pytabix to different folder pip install --target="/path/to/your_new_path" pytabix and add this new path to sys.path:
import sys
sys.path.insert(0, "/path/to/your_new_path")
and then import like import your_new_path.tabix | 3 | 12 | 0 | There is, apparently, a package loaded in our Python/2.7.2 environment named CrossMap which has, as a subpackage, tabix. When I start this version of python and import tabix, tabix shows: /hpcf/apps/python/install/2.7.2/lib/python2.7/site-packages/CrossMap-0.1.6-py2.7-linux-x86_64.egg/tabix/__init__.pyc Indicating that... | How can I keep python from loading the 'wrong' package? | 0.033321 | 0 | 0 | 10,184 |
30,981,249 | 2015-06-22T13:29:00.000 | 4 | 0 | 1 | 0 | python,packages | 31,118,453 | 6 | false | 0 | 0 | You may be able to use a .pth file in the python version's site-packages folder to manually sort the sys.path for a user. easy_install uses this to add an eggs contents to your path as well. | 3 | 12 | 0 | There is, apparently, a package loaded in our Python/2.7.2 environment named CrossMap which has, as a subpackage, tabix. When I start this version of python and import tabix, tabix shows: /hpcf/apps/python/install/2.7.2/lib/python2.7/site-packages/CrossMap-0.1.6-py2.7-linux-x86_64.egg/tabix/__init__.pyc Indicating that... | How can I keep python from loading the 'wrong' package? | 0.132549 | 0 | 0 | 10,184 |
30,981,249 | 2015-06-22T13:29:00.000 | 1 | 0 | 1 | 0 | python,packages | 31,208,210 | 6 | false | 0 | 0 | I would suggest you use a virtualenv for your project. Virtualenv is an excellent way to avoid namespace pollution and contentions like you are having.
To debug a situation where you do not know where a specific module is hiding, you can try to import the specific module in an interactive Python shell and print the __f... | 3 | 12 | 0 | There is, apparently, a package loaded in our Python/2.7.2 environment named CrossMap which has, as a subpackage, tabix. When I start this version of python and import tabix, tabix shows: /hpcf/apps/python/install/2.7.2/lib/python2.7/site-packages/CrossMap-0.1.6-py2.7-linux-x86_64.egg/tabix/__init__.pyc Indicating that... | How can I keep python from loading the 'wrong' package? | 0.033321 | 0 | 0 | 10,184 |
30,985,379 | 2015-06-22T16:40:00.000 | 1 | 0 | 0 | 1 | python,linux,elf,readelf | 31,053,673 | 1 | true | 0 | 0 | using pyelftools:
tag = section.get_tag(n)
gives the nth tag of a specific section | 1 | 1 | 0 | I want to get information about the dynamic section of an ELF file. Basically the same information I get using the command line:
readelf -d elfFile | How can I read the dynamic section of an ELF file in python | 1.2 | 0 | 0 | 1,452 |
30,985,798 | 2015-06-22T17:04:00.000 | 0 | 0 | 0 | 0 | python,django | 30,986,554 | 1 | false | 1 | 0 | Definitely go for "way #1". Keeping an independent layer for your service(s) API will help a lot later when you have to enhance that layer for reliability or extending the API.
Stay away from singletons, they're just global variables with a new name. Use an appropriate life cycle for your interface objects. The obvi... | 1 | 1 | 0 | I am building my first Django web application and I need a bit of advice on code layout.
I need to integrate it with several other applications that are exposed through RESTful APIs and additionally Django's internal data. I need to develop the component that will pull data from various sources, django's DB, format it... | Python Module in Django | 0 | 0 | 0 | 765 |
30,987,425 | 2015-06-22T18:40:00.000 | 0 | 0 | 0 | 0 | python,networkx | 31,006,818 | 1 | false | 0 | 0 | I ended up with forking the spring layout with a hold_dim parameter, so during updating the positions only x or y is being changed. | 1 | 0 | 1 | I wonder if it is implemented in networkx.drawing to hold one dimension during the layout optimization with a predefined position array.
Lets say you want to optimize the layout of a graph and have the x dimension of the positions already given, so you only want to optimize the y directions of the vertices.
So far I'v... | Drawing layout with constraints in networkx | 0 | 0 | 0 | 380 |
30,988,075 | 2015-06-22T19:17:00.000 | 2 | 0 | 1 | 0 | python,ipython,ipython-notebook | 63,175,447 | 8 | false | 0 | 0 | If some stumbles here as of 2020, it's now possible to move .ipynb or other kind of files by simply checking it and clicking move.
Nevertheless, for .ipynb files you must be sure that the notebook isn't running (gray icon). If it's running it should be green and you must shut it down before moving. | 4 | 14 | 0 | After creating a .ipynb file in the root directory /, how can you move that .pynb file into a deeper directory ie: /subdirectory using the web UI? | Move .ipynb using the IPython Notebook Web Interface | 0.049958 | 0 | 0 | 23,019 |
30,988,075 | 2015-06-22T19:17:00.000 | 0 | 0 | 1 | 0 | python,ipython,ipython-notebook | 40,560,790 | 8 | false | 0 | 0 | Ran into this issue and solved it by :
Create a new folder in jupyter notebooks.
Go to the folder/directory and click the "Upload "button which is next to the "New" button.
Once you click "Upload", your pc file explorer window will pop-up, now simply find where you have your jupyter notebooks saved on your local mach... | 4 | 14 | 0 | After creating a .ipynb file in the root directory /, how can you move that .pynb file into a deeper directory ie: /subdirectory using the web UI? | Move .ipynb using the IPython Notebook Web Interface | 0 | 0 | 0 | 23,019 |
30,988,075 | 2015-06-22T19:17:00.000 | 0 | 0 | 1 | 0 | python,ipython,ipython-notebook | 43,175,463 | 8 | false | 0 | 0 | Duplicate the notebook and delete the original, was my workaround. | 4 | 14 | 0 | After creating a .ipynb file in the root directory /, how can you move that .pynb file into a deeper directory ie: /subdirectory using the web UI? | Move .ipynb using the IPython Notebook Web Interface | 0 | 0 | 0 | 23,019 |
30,988,075 | 2015-06-22T19:17:00.000 | 1 | 0 | 1 | 0 | python,ipython,ipython-notebook | 46,796,512 | 8 | false | 0 | 0 | Ipython 5.1:
1. Make new folder -- with IPython running, New, Folder, select 'Untitled folder' just created, rename (and remember the name!)
2. Go to the file you want to move, Move, write new directory name at prompt
Note: If the folder exists, skip 1.
Note: If you want to leave a copy in the original directory, Dupli... | 4 | 14 | 0 | After creating a .ipynb file in the root directory /, how can you move that .pynb file into a deeper directory ie: /subdirectory using the web UI? | Move .ipynb using the IPython Notebook Web Interface | 0.024995 | 0 | 0 | 23,019 |
30,990,501 | 2015-06-22T21:54:00.000 | 1 | 0 | 0 | 0 | python,matplotlib,3d,data-visualization | 31,486,223 | 2 | true | 0 | 0 | I actually was able to do this using the matplotlib.patches library, creating a patch for every data point, and then making it whatever shape I wanted with the help of mpl_toolkits.mplot3d.art3d. | 1 | 0 | 1 | In a standard 3D python plot, each data point is, by default, represented as a sphere in 3D. For the data I'm plotting, the z-axis is very sensitive, while the x and y axes are very general, so is there a way to make each point on the scatter plot spread out over the x and y direction as it normally would with, for ex... | How to make data points in a 3D python scatter plot look like "discs" instead of "spheres" | 1.2 | 0 | 0 | 612 |
30,991,181 | 2015-06-22T22:54:00.000 | 1 | 0 | 1 | 0 | ipython,ipython-notebook,postscript | 30,995,920 | 1 | true | 0 | 0 | PostScript isn't a 'file format', its a programming language. In order to render PostScript you will need a complete PostScript interpreter.
Presumably you could write one in Python, the last time I saw an estimate for the amount of time required to write a full PostScript interpreter it was 5 man years, its probably a... | 1 | 2 | 0 | How can we render postscript documents in IPython notebook?
I saw there is support for other file formats such as jpg, png, pdf and svg but couldn't find any mention about postscript. | IPython notebook embed postscript | 1.2 | 0 | 0 | 711 |
30,991,451 | 2015-06-22T23:18:00.000 | 1 | 0 | 0 | 0 | python,user-interface,automation | 34,939,080 | 1 | false | 0 | 1 | Please try to run your script with administrative privileges. If you are using Powershell then run powershell as administrator | 1 | 0 | 0 | I am currently trying to write a script to automate the ATTO disk benchmark GUI. I can use the script to successfully locate images in the GUI, but I can not get any clicks generated by the script to register in the application. I have modified the script to test if I could use the PyAutoGUI package to click things i... | PyAutoGUI click() function will not register in certain applications | 0.197375 | 0 | 0 | 1,086 |
30,992,964 | 2015-06-23T02:38:00.000 | 0 | 0 | 0 | 0 | python,file,python-2.7 | 30,993,345 | 2 | false | 0 | 0 | Open 10 files.
Read 1 record from each file (or 10, the question is not clear).
Use these records.
Wait until the current 5 second interval elapses.
Go to 2. | 1 | 0 | 1 | I have 10 CSV files with million records. I want to read the 10 files in parallel, but with a specific rate (10 records per 5 sec). What is the efficient way to do so ?. I am using Windows in case someone will suggest to use OS scheduler | Read many files in parallel with a specific sample rate | 0 | 0 | 0 | 90 |
30,993,221 | 2015-06-23T03:13:00.000 | 1 | 1 | 1 | 0 | java,python,c,calculator,ti-basic | 30,993,515 | 4 | false | 0 | 1 | You would need a compiler that will translate whatever language you're writing in (in the case of Java, an implementation of the JVM as well) to the assembly used by the calculator's CPU, it's probably not likely you will find an easy to use solution as calculators like the TI-84 are pretty archaic. | 3 | 6 | 0 | I am interested into programming with different languages besides Ti-Basic (like Java, C, and Python) on my Ti-84 plus calculator. Does my calculator support this, and if not, are there any calculators on the market that would be able to do this? Thanks in advance!
(The idea is that when I don't have access to my compu... | Multiple Language Programming on Ti-Calculator | 0.049958 | 0 | 0 | 3,809 |
30,993,221 | 2015-06-23T03:13:00.000 | 1 | 1 | 1 | 0 | java,python,c,calculator,ti-basic | 69,366,466 | 4 | false | 0 | 1 | The TI-84 Plus CE Python allows you to code in Python but it is a barebones implementation. But it has been pretty useful for me. | 3 | 6 | 0 | I am interested into programming with different languages besides Ti-Basic (like Java, C, and Python) on my Ti-84 plus calculator. Does my calculator support this, and if not, are there any calculators on the market that would be able to do this? Thanks in advance!
(The idea is that when I don't have access to my compu... | Multiple Language Programming on Ti-Calculator | 0.049958 | 0 | 0 | 3,809 |
30,993,221 | 2015-06-23T03:13:00.000 | 3 | 1 | 1 | 0 | java,python,c,calculator,ti-basic | 31,085,450 | 4 | true | 0 | 1 | After a little research, I found some some hand-held "pocket" devices.
The Palm m500 has a JVM to program java on. There apparently was a website that had an SDK for C, but the website was removed.
In regards to calculators:
TI-82, 83, 84, 85, 86, and related models all support TI-BASIC and z80 ASM.
TI-92, Voyage 200... | 3 | 6 | 0 | I am interested into programming with different languages besides Ti-Basic (like Java, C, and Python) on my Ti-84 plus calculator. Does my calculator support this, and if not, are there any calculators on the market that would be able to do this? Thanks in advance!
(The idea is that when I don't have access to my compu... | Multiple Language Programming on Ti-Calculator | 1.2 | 0 | 0 | 3,809 |
30,994,391 | 2015-06-23T05:18:00.000 | 0 | 0 | 1 | 0 | python,tuples | 30,994,460 | 2 | false | 0 | 0 | Accessing element like this in a collection is wrong -
K[0[0]]
In this case, you are indexing the 0th element of 0 itself, which definitely causes an error. Try doing k[0][0] | 1 | 0 | 0 | I have a list that is a combination of a tuple and integer
ex: K = [(7,8),8]
How do I access the first element of the tuple, 7?
I tried K[0[0]] and was not successful. | Python: List containing tuple and integer | 0 | 0 | 0 | 55 |
30,997,900 | 2015-06-23T08:42:00.000 | 0 | 0 | 0 | 1 | python,automation,chef-infra,orchestration | 31,379,600 | 2 | true | 0 | 0 | I applied the following steps to solve my problem
Found the directory which gets created after installation of the independent software
waited for the directory to get created(using ruby block code for sleeping) and initiated the installation of dependent software thereafter to ensure the dependency is satisfied.
sol... | 1 | 0 | 0 | As part of a platform setup orchestration we are using our python package to install various software packages on a cluster of machines in cloud.
We have the following scenario:
Our python package initiates installation of certain software packages(say A,B,C) then simultaneously initiates installation of certain other... | chef cookbook dependency on system software not on another cookbook | 1.2 | 0 | 0 | 60 |
31,003,551 | 2015-06-23T13:02:00.000 | 0 | 0 | 0 | 0 | python,matplotlib | 31,004,307 | 2 | false | 0 | 1 | One solution is to make MatPlotLib react to key events immediately.
Another solution is print a 'Cursor' or marker line on the plot, and change its coordinates with the mouse events. Eg. draw a vertical line, and update its X coordinates with the left and right keys. You can then add a label with the X coordinate along... | 1 | 1 | 0 | I would like to move the cursor in a Python matplotlib window by a (data) pixel at a time (I'm displaying a 2D image), using the keyboard arrow keys. I can trap the keyboard keypress events, but how do I reposition the cursor based on these events? | move cursor in matplotlib window with keyboard stroke | 0 | 0 | 0 | 533 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.