Q_CreationDate stringlengths 23 23 | Title stringlengths 11 149 | Question stringlengths 25 6.53k | Answer stringlengths 15 5.1k | Score float64 -1 1.2 | Is_accepted bool 2
classes | N_answers int64 1 17 | Q_Id int64 0 6.76k |
|---|---|---|---|---|---|---|---|
2016-06-08 06:29:11.117 | How to install an "add-on" like Send2Trash to be used in Python? | I am a beginner in python programming and I am working on a project that I want to send files to the recycle bin using python. I heard of this "add-on" called Send2Trash which is what I wanted but I don't really know how to install it. I tried on the python website, other websites and from the author and it really didn... | Answer
If you are getting the error while using Python 3 on Mac OS X, try these commands in Terminal: pip3 install Send2Trash or pip3 install send2trash
I am on Mac OS X using Python 3, and this worked for me.
Explanation
I have read that most Mac OS X users have both Python 2 and Python 3 installed. Using pip3 (inste... | 0 | false | 1 | 4,336 |
2016-06-08 16:07:13.297 | Why does the find function return -1 in python when searching a string and failing to find a match? | I would expect a return of 0. Is -1 simply the equivalent of false? For a moment I thought it was because 0 is a position (index?) in the string, but so is -1. While I know it is enough to simply memorize that this is how the find operation works, I was wondering if there was a deeper explanation or if this is somethin... | The objective of the find method is to return the index value, which (for all practical purposes) programmers want as positive. In this case, any negative value means that the function could not find the particular element.
The reason why True or False is NOT used is just to avoid thousands of TypeErrors | 0.201295 | false | 2 | 4,337 |
2016-06-08 16:07:13.297 | Why does the find function return -1 in python when searching a string and failing to find a match? | I would expect a return of 0. Is -1 simply the equivalent of false? For a moment I thought it was because 0 is a position (index?) in the string, but so is -1. While I know it is enough to simply memorize that this is how the find operation works, I was wondering if there was a deeper explanation or if this is somethin... | @jonrsharpe I believe your comment answered my question best. While -1 is an index, the find function always returns a non-negative index when successful and -1 otherwise. | 0 | false | 2 | 4,337 |
2016-06-09 08:07:55.487 | Rounding in Python | round(1.4 999 999 999 999 999) (without the spaces) gets rounded to 2
but
round(1.4 99 999 999 999 999) (without the spaces) gets rounded to 1.
I suppose this has to do with imprecise floating point representations, but fail to understand how does it come that the first representation is interpreted as closer to 2 tha... | Because 1.4 999 999 999 999 999 when parsed is exactly 1.5, the difference between them is too small to represent at that magnitude.
But 1.4 99 999 999 999 999 is low enough to parse to "less than 1.5", actually 1.4999999999999988897769753748434595763683319091796875, which is clearly less than 1.5 | 0.999909 | false | 1 | 4,338 |
2016-06-09 08:56:53.973 | how to indent the code block in Python IDE: Spyder? | Is there any shortcut key in Spyder python IDE to indent the code block?
For example, Like ctr+[ in Matlab, I want to indent the code block together. | Select your code and press Tab for indent and Shift+Tab to un-indent.
or go to Edit -> Indent/Unindent
Edit section also contains some other tools for editing your code. | 1.2 | true | 2 | 4,339 |
2016-06-09 08:56:53.973 | how to indent the code block in Python IDE: Spyder? | Is there any shortcut key in Spyder python IDE to indent the code block?
For example, Like ctr+[ in Matlab, I want to indent the code block together. | Spyder 4 select the lines and then press TAB or CTRL+] For indent and shift+TAB or CTRL+] for un-indent | 0 | false | 2 | 4,339 |
2016-06-09 09:06:23.340 | Visual Studio Python Environments window does not display | I have installed Win10, Visual Studio 2015, Python 2.7, Python 3.5 and PTVS 2.2.3.
Unfortunately PTVS does not work at all. I can not load any Python projects that were loading previously in Visual Studio. It worked before I installed Python 3.5. I tried to uninstall Python 2.7 and get an error saying that the uninstal... | Thanks for your posts.
My problem was fixed after I installed VS 2015 update 3 which included a new release of PTVS (June 2.2.40623). | 0 | false | 3 | 4,340 |
2016-06-09 09:06:23.340 | Visual Studio Python Environments window does not display | I have installed Win10, Visual Studio 2015, Python 2.7, Python 3.5 and PTVS 2.2.3.
Unfortunately PTVS does not work at all. I can not load any Python projects that were loading previously in Visual Studio. It worked before I installed Python 3.5. I tried to uninstall Python 2.7 and get an error saying that the uninstal... | I`m also having similar issues, first installation path:
Visual Studio 2015 Pro with Update 1
Installed PTVS using the VS2015 installation setup later on
Everything work fine
The issues started:
Installed a DEV version of PTVS from their github page
My pyproj stopped loading saying a migration needed
Noticed that af... | 0 | false | 3 | 4,340 |
2016-06-09 09:06:23.340 | Visual Studio Python Environments window does not display | I have installed Win10, Visual Studio 2015, Python 2.7, Python 3.5 and PTVS 2.2.3.
Unfortunately PTVS does not work at all. I can not load any Python projects that were loading previously in Visual Studio. It worked before I installed Python 3.5. I tried to uninstall Python 2.7 and get an error saying that the uninstal... | You'll need to open the ActivityLog.xml (%APPDATA%\Microsoft\VisualStudio\14.0\ActivityLog.xml) and see if there's any exceptions there related to PTVS.
It sounds like you have a pretty messed up configuration at this point. You could try uninstalling PTVS and re-installing it, but my guess is your messed up Python ... | 0 | false | 3 | 4,340 |
2016-06-09 17:48:01.297 | Install RPi module on Pycharm | I've been using IDLE with my raspberry for a while, it's nice at the beginning, but Pycharm provides lots more of features and I'm used to them since I've been also using Android Studio.
The problem is I couldn't figure out how to install the RPi module to control the pins of my Raspberry. Does anyone know how to do th... | You can run Pycharm directly on your Raspberry Pi:
- Using your Raspberry Pi, download the installation file directly from the Pycharm website (JetBrains). It will be a tarball, i.e., a file ending in ".tar.gz".
- Extract the file to a folder of your choice.
- Browsing through the extracted files and folders, you will... | -0.386912 | false | 1 | 4,341 |
2016-06-10 14:10:02.323 | error on installing language-check packages to python 2.7 environment | I am having problem of installing python package language-check to my python 2.7 environment.
I tried the pip install language-check --upgrade command but it was no avail. It gave my error saying "Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/fn/g0nd0gb54d5c__5fjhb7rp0w0000gn/T/pip... | I found alternative: pip install --user --upgrade grammar-check | 0.386912 | false | 1 | 4,342 |
2016-06-10 17:05:41.917 | How to take a word from a dictionary by its definition | I am creating a code where I need to take a string of words, convert it into numbers where hi bye hi hello would turn into 0 1 0 2. I have used dictionary's to do this and this is why I am having trouble on the next part. I then need to compress this into a text file, to then decompress and reconstruct it into a strin... | TheLazyScripter gave a nice workaround solution for the problem, but the runtime characteristics are not good because for each reconstructed word you have to loop through the whole dict.
I would say you chose the wrong dict design: To be efficient, lookup should be done in one step, so you should have the numbers as k... | 1.2 | true | 1 | 4,343 |
2016-06-10 21:12:07.610 | Scrapy installed, but won't run from the command line | I'm trying to run a scraping program I wrote for in python using scrapy on an ubuntu machine. Scrapy is installed. I can import until python no problem and when try pip install scrapy I get
Requirement already satisfied (use --upgrade to upgrade): scrapy in /system/linux/lib/python2.7/dist-packages
When I try to run... | I tried the following sudo pip install scrapy , however was promtly advised by Ubuntu 16.04 that it was already installed.
I had to first use sudo pip uninstall scrapy, then sudo pip install scrapy for it to successfully install.
Now you should successfully be able to run scrapy. | 0.307209 | false | 5 | 4,344 |
2016-06-10 21:12:07.610 | Scrapy installed, but won't run from the command line | I'm trying to run a scraping program I wrote for in python using scrapy on an ubuntu machine. Scrapy is installed. I can import until python no problem and when try pip install scrapy I get
Requirement already satisfied (use --upgrade to upgrade): scrapy in /system/linux/lib/python2.7/dist-packages
When I try to run... | I had the same issue. sudo pip install scrapy fixed my problem, although I don't know why must use sudo. | 0 | false | 5 | 4,344 |
2016-06-10 21:12:07.610 | Scrapy installed, but won't run from the command line | I'm trying to run a scraping program I wrote for in python using scrapy on an ubuntu machine. Scrapy is installed. I can import until python no problem and when try pip install scrapy I get
Requirement already satisfied (use --upgrade to upgrade): scrapy in /system/linux/lib/python2.7/dist-packages
When I try to run... | I faced the same problem and solved using following method. I think scrapy is not usable by the current user.
Uninstall scrapy.
sudo pip uninstall scrapy
Install scrapy again using -H.
sudo -H pip install scrapy
Should work properly. | 0.135221 | false | 5 | 4,344 |
2016-06-10 21:12:07.610 | Scrapy installed, but won't run from the command line | I'm trying to run a scraping program I wrote for in python using scrapy on an ubuntu machine. Scrapy is installed. I can import until python no problem and when try pip install scrapy I get
Requirement already satisfied (use --upgrade to upgrade): scrapy in /system/linux/lib/python2.7/dist-packages
When I try to run... | I had the same error. Running scrapy in a virtual environment solved it.
Create a virtual env : python3 -m venv env
Activate your env : source env/bin/activate
Install Scrapy with pip : pip install scrapy
Start your crawler : scrapy crawl your_project_name_here
For example my project name was kitten, I just did the f... | 0.620381 | false | 5 | 4,344 |
2016-06-10 21:12:07.610 | Scrapy installed, but won't run from the command line | I'm trying to run a scraping program I wrote for in python using scrapy on an ubuntu machine. Scrapy is installed. I can import until python no problem and when try pip install scrapy I get
Requirement already satisfied (use --upgrade to upgrade): scrapy in /system/linux/lib/python2.7/dist-packages
When I try to run... | make sure you activate command that is
"Scripts\activate.bat" | 0 | false | 5 | 4,344 |
2016-06-11 19:33:25.763 | Scikit-learn KNN(K Nearest Neighbors ) parallelize using Apache Spark | I have been working on machine learning KNN (K Nearest Neighbors) algorithm with Python and Python's Scikit-learn machine learning API.
I have created sample code with toy dataset simply using python and Scikit-learn and my KNN is working fine. But As we know Scikit-learn API is build to work on single machine and henc... | Well according to discussions https://issues.apache.org/jira/browse/SPARK-2336 here MLLib (Machine Learning Library for Apache Spark) does not have an implementation of KNN.
You could try https://github.com/saurfang/spark-knn. | 0.386912 | false | 1 | 4,345 |
2016-06-13 08:50:40.740 | Sync Choregraphe and Matlab | I have a Wizard of Oz experiment using Choregraphe to make a NAO perform certain tasks running on machine A. The participant interacting with the NAO also interacts with a machine B. When I start the experiment (in Choregraphe on machine A) I want a certain MATLAB script to start on machine B. I.e. Choregraphe will ini... | Using NAO C++ SDK, it may be possible to make a MEX-FILE in Matlab that "listens" to NAO. Then NAO just has to raise an event in its memory (ALMemory) that Matlab would catch to start running the script. | 0 | false | 1 | 4,346 |
2016-06-13 20:27:01.410 | Downloading xlwt to Python 3.5.1 | I'm trying to download the package xlwt to my Python 3.5.1 but typing 'pip install xlwt' isn't working and gives me an error at the word install that says invalid syntax, though all the websites I've checked told me to do exactly this.
I mostly have a theoretical knowledge of Python and can code pretty decently, but do... | Sounds like you are typing pip install ... into a Python prompt and not a shell command prompt. This is not a Python statement but a shell command that has to be executed at the command-line prompt. | 0 | false | 1 | 4,347 |
2016-06-13 21:03:14.283 | Dataflow Python SDK Avro Source/Sync | I am looking to ingest and write Avro files in GCS with the Python SDK. Is this currently possible with Avro leveraging the Python SDK? If so how would I do this? I see TODO comments in the source regarding this so I am not too optimistic. | You are correct: the Python SDK does not yet support this, but it will soon. | 1.2 | true | 1 | 4,348 |
2016-06-15 09:03:50.397 | how to close trace 32 application itself through cmm command? | I load and execute a cmm script inside trace32 application using bmm commands.
when the execution is over i need to close the entire t32 application window itself (similar to File -> Exit) using cmm command ? | To close the PowerView main window use TRACE32 command QUIT | 1.2 | true | 1 | 4,349 |
2016-06-15 12:53:54.727 | Odoo python fileopendialog | does anybody knows how to open a filedialog on Odoo? I've add a button on a custom view, now I would like to browse for a file on THE CLIENT when this button is clicked.
Any ideas?
Thanks! | You can define binary fields in Odoo, like other fields. Look into ir.attachment model definition and its view definitions to get a good hint, how do it for such fields. | 0.201295 | false | 1 | 4,350 |
2016-06-15 20:42:02.830 | Get a queryset from a queryset | I have a queryset from Picture.objects.filter(user_ID=user). The Picture model has "contest_ID" as a foreign key.
I'm looking to get a queryset of Contests which have Pictures, so from the queryset I already have, how do I pull a list of Contest objects? | I assume that your models look something like this
class Contest(Model):
... something ...
class Picture(Model):
user = ForeignKey(User)
contest = ForeignKey(Contest)
... something ...
So, Picture.objects.filter(user=user) gives you pictures by a particular user (don't have to specify _id, filters op... | 0 | false | 1 | 4,351 |
2016-06-16 04:55:19.567 | Odoo website, Creating a signup page for external users | How can I create a signup page in odoo website. The auth_signup module seems to do the job (according to their description). I don't know how to utilize it.
In the signup page there shouldn't be database selector
Where should I store the user data(including password); res.users or res.partner | you can turn off db listing w/ some params in in odoo.cfg conf
db_name = mydb
list_db = False
dbfilter = mydb
auth_signup takes care of the registration, you don't need to do anything. A res.user will be created as well as a partner related to it.
The pwd is stored in the user. | 1.2 | true | 2 | 4,352 |
2016-06-16 04:55:19.567 | Odoo website, Creating a signup page for external users | How can I create a signup page in odoo website. The auth_signup module seems to do the job (according to their description). I don't know how to utilize it.
In the signup page there shouldn't be database selector
Where should I store the user data(including password); res.users or res.partner | User Signup is a standard feature provided by Odoo, and it seems that you already found it.
The database selector shows because you have several PostgresSSQL databases.
The easiest way is to set a filter that limits it to the one you want:
start the server with the option --dbfilter=^MYDB$, where MYDBis the database na... | 0.201295 | false | 2 | 4,352 |
2016-06-16 09:24:58.713 | Why does accumulate work for numpy.maximum but not numpy.argmax | These two look like they should be very much equivalent and therefore what works for one should work for the other? So why does accumulate only work for maximum but not argmax?
EDIT: A natural follow-up question is then how does one go about creating an efficient argmax accumulate in the most pythonic/numpy-esque way? | Because max is associative, but argmax is not:
max(a, max(b, c)) == max(max(a, b), c)
argmax(a, argmax(b, c)) != argmax(argmax(a, b), c) | 1.2 | true | 1 | 4,353 |
2016-06-17 09:00:55.687 | pycharm not using virtualenv from vagrant box when 'go to declaration' instead uses some outdated stuff from its remote_sources | I setuup Project Interpreter pointing virtualenv on vagrant virtual machine (Settings / Project Interpreter / Add Remote), but when I click ctrl+B or use 'go to definition' I always end up in location like this: /home/<my_user_name>/.PyCharm50/system/remote_sources/1174787026/154306353/django/...
how to avoid such pych... | I also had this issue setting up a remote interpreter with Vagrant.
It appears that for a remote interpreter you need to mark Python source root folders as "Source Folders" under Project Structure in Preferences. They should then show up as blue in your Project browser. You don't need to mark all the sub folders, just ... | 0.999909 | false | 1 | 4,354 |
2016-06-17 10:42:23.983 | Creating a 3D grid using X,Y,Z coordinates at cell centers | I have a question, I have been given x,y,z coordinate values at cell centers of a grid. I would like to create structured grid using these cell center coordinates.
Any ideas how to do this? | If you grid is regular:
You have calculate dx = x[i+1]-x[i], dy = y[i+1]-y[i], dz = z[i+1]-z[i].
Then calculate new arrays of points:
x1[i] = x[i]-dx/2, y1[i] = y[i]-dy/2, z1[i] = z[i]-dz/2.
If mesh is irregular you have to do the same but dx,dy,dz you have to define for every grid cell. | 1.2 | true | 1 | 4,355 |
2016-06-18 12:39:55.643 | Tweepy Get Tweets in reply to a particular tweet | So I've been doing a lot of work with Tweepy and Twitter data mining, and one of the things I want to do is to be able to get all Tweets that are replies to a particular Tweet. I've seen the Search api, but I'm not sure how to use it nor how to search specifically for Tweets in reply to a specific Tweet. Anyone have an... | I've created a workaround that kind of works. The best way to do it is to search for mentions of a user, then filter those mentions by in_reply_to_id . | 1.2 | true | 1 | 4,356 |
2016-06-20 08:51:28.627 | Using python with Anaconda in Windows | I have just installed Anaconda on my computer because I need to use Numpy.
Well, when I use python I for some reason have to be in the same folder as python.exe and, of course, now that I want to use Anaconda I have to be in the Anaconda3\Scripts folder where python.exe isn't. This is a nightmare, how can I use anacond... | I think you are referring to the command-line use of python?
If you have admin priviliges on your machine you can add python to your environment variables, making it available in the console anywhere. (Sorry for different spellings, I am not on an english machine)
Press Shift+Pause ("System")
Click "Advanced System Op... | 0.496174 | false | 1 | 4,357 |
2016-06-20 14:48:50.977 | Running Scrapy on Dokku using a Digital Ocean server | Not sure how to describe this but I am running a Scrapy spider on a Digital Ocean server ($5 server), the Scrapy project is deployed as a Dokku app.
However, it runs very slowly compared to the speed on my local computer and on a Heroku free tier dyno. On Dokku it crawls at a speed of 30 pages per minute while locally ... | I 'fixed' this issue by not using a Digital Ocean server. The website that I am trying to crawl, which is craigslist.org, just did not respond well to a DO server. It takes a long time to respond to a request. Other websites like Google or Amazon work just fine with DO.
My scraper works just fine on craigslist when usi... | 0.386912 | false | 1 | 4,358 |
2016-06-21 06:47:40.340 | how to make inverted index? | how do I update an inverted index efficiently if documents are inserted, deleted or updated ? also should i use index file to store index or should I store index in a database table ? | Python does allow you to constrcut classes that implement dictionary-like interface and thatc ould maintain any inverted indexes you would wish -
But you are too broad on your question. The "extradict" Python package (pip install extradict), for example have a "BijectiveDict" that just exposes any values as keys and v... | 1.2 | true | 1 | 4,359 |
2016-06-21 20:42:10.897 | Tab indent in Linux and Jedit | Ive been using Jedit for programming for a few days and I wonder how I can change the tab indent in Jedit. Or can I change the Indent for whole Linux? My second question: I use Python and I would like to have an Indent in the next line after colons. where are the settings for this? | Indentation can be configured by navigating to Utilities > Global Options > Editing > Tab width. You said you are coding in python so I strongly recommend that you leave the indentation as it is as python only accepts indentation with standard tabs (4 spaces long).
Obs: I see no reason why you would use Jedit, you'd be... | 0 | false | 1 | 4,360 |
2016-06-21 21:55:50.867 | Python 3 For loop vs next() iterator | I'm learning Python 3 (my first language since BASIC), and I have a general question:
If I want to iterate over something, how do I determine if the best way is to use a For loop or a generator? They appear to be closely related. | Use a for-loop if you can. It's simple, and it uses iterators behind the scenes. One of the great things about python's iterator system is that you don't need to think about them most of the time. It is quite rare that you'll need to explicitly call next() on something.
This is kind of general, but so is your question.... | 1.2 | true | 1 | 4,361 |
2016-06-22 20:09:38.183 | Google API Domain Admin Access | I'm working on a script using Python that will access all students' Google calendars using their Google accounts and then add their school schedule into their calendar. I have figured out adding and deleting events and calendars using the API, but my question is how do I add a specific event to a specific calendar unde... | Solved:
The issue was that my client_secrets.json file for oauth 2.0 was set to my personal google account and not the admin account. I cleared the storage.json file where credentials were stored, re ran the program with the admin account logged in, and it worked! Hoped this helps. | 1.2 | true | 1 | 4,362 |
2016-06-23 01:41:18.343 | How to prevent tab characters from being converted to spaces in console output when using IPython in Spyder | In IDLE Python if I do print "a\tb" I get an output that looks like: a[TAB]b.
If I do the same in IPython in Spyder, then I get an output that looks like: a[7 spaces]b
I like to output tables of data as tab delimited text to make it easier to copy from the console and paste it to Excel. If the tabs get converted to sp... | (Spyder maintainer here) For the record, this problem was solved in our 4.1.0 version, released in March 2020. | 0 | false | 1 | 4,363 |
2016-06-24 16:26:00.070 | How to install pygame, cv2, anaconda, pip etc to any one version of python in ubuntu 14.04 | I have Ubuntu 14.04 LTS. I guess different versions of python are pre-installed in Ubuntu 14.04. Right now when I type 'python' in terminal it opens python 2.7.11, but I guess the default version of Ubuntu 14.04 is 2.7.6. When I type /usr/bin/python it opens the default version. I know this can be done with making alia... | First of all I want to thanks Bennet for responding to my question so that I was able to figure out what the problem was. Actually the problem was with aliasing. When I installed cv2 or pygame using apt-get, they were installed for default version but when I installed any package by downloading the installer first (lik... | 0 | false | 1 | 4,364 |
2016-06-25 18:34:58.547 | How to create AWS Lambda deployment package that uses Couchbase Python client | I'm trying to use AWS Lambda to transfer data from my S3 bucket to Couchbase server, and I'm writing in Python. So I need to import couchbase module in my Python script. Usually if there are external modules used in the script, I need to pip install those modules locally and zip the modules and script together, then up... | Following two things worked for me:
Manually copy /usr/lib64/libcouchbase.so.2 into ur project folder
and zip it with your code before uploading to AWS Lambda.
Use Python 2.7 as runtime on the AWS Lambda console to connect to couchbase.
Thanks ! | 0.545705 | false | 1 | 4,365 |
2016-06-26 21:25:34.900 | Key bindings for interrupt execution in Python Sublime REPL | I'm using REPL extension for Sublime text 3 for my python projects. Currently when I want to interrupt a running script I have to close to close the REPL window to stop execution and all computations are so far are lost.
I was wondering if anybody knows how to interrupt an execution and have a short cut or key binding... | As mentioned above (a long time ago) the key bindings aren't present for Windows. However, one can Mouse Right Click to open a context menu. From here there are menu options for Kill and Restart. You can also open a sub-menu which allows you send those and other signals including SIGINT. | 0 | false | 1 | 4,366 |
2016-06-27 03:46:11.687 | Pythonanywhere Loading data from local files | I'm new to pythonanywhere. I wonder how to load data from local csv files (there are many of them, over 1,000) into a mysql table. Let's say the path for the folder of the csv files is d:/data. How can I write let pythonanywhere visit the local files? Thank you very much! | You cannot get PythonAnywhere to read the files directly off your machine. At the very least, you need to upload the file to PythonAnywhere first. You can do that from the Files tab. Then the link that Rptk99 provided will show you how to import the file into MySQL. | 1.2 | true | 1 | 4,367 |
2016-06-27 14:34:13.353 | Adding bytes in python 2.7 | Hi I've been trying to iterate through a bytearray, add up all the bytes and then append the result back into the same bytearray. The bytearray looks like this:
key = bytearray([0x12, 0x10, 0x32])
However, when I call sum(key) I get the decimal representation of 84. Any idea how I can change the decimal representation... | A bytearray is always a list of integers. How they are displayed is only their representation. The same applies to the way you entered them. Python understand the 0x?? (hexadicimal) and 0?? (octal) notation for integers but it will display the decimal notation.
To convert an integer to a string in the 0x?? format use h... | 0.386912 | false | 1 | 4,368 |
2016-06-28 03:21:55.840 | Sorting Input from Multiple HIDs in Windows | I have found a number of answers in pulling information from HIDs in Linux, but not many in Windows.
I have created a system where a person can scan an ID badge when entering a briefing that logs their attendance into a database. It utilizes a Python 3.4 front end which queries and then updates a MongoDB database.
Cur... | In this scenario I will suggest using scanners/readers that can emulate serial (COM) port. As HID device writes to same bus then there is a huge probability that output from two or more devices could by mixed-up.
More over I will add a device id string to a prefix like dev01. Binding to a com port can be used by pySeri... | 0 | false | 1 | 4,369 |
2016-06-28 10:45:59.020 | How do I rename a (work)sheet in a Google Sheets spreadsheet using the API in Python? | I have been trying/looking to solve this problem for a long while.
I have read the documentation for gspread and I cannot find that there is a way to rename a worksheet.
Any of you know how to? I would massively appreciate it!
There is indeed worksheet.title which gives the name of the worksheet, but I cannot find a wa... | For those whose solving this renaming using NodeJS. Just use the batchRequest API. Indicate in the sheetID the sheet id youre editing and the title field the new title. Then indicate "title" in the fields. | 0 | false | 1 | 4,370 |
2016-06-28 17:58:44.917 | Python 3.5.1 Unable to import numpy after update | I'm running Python 3.5.1 on a Windows 7 machine. I've been using Anaconda without issue for several months now. This morning, I updated my packages (conda update --all) and now I can't import numpy (version 1.11.0) or pandas(version 0.18.1).
The error I get from Python is:
Syntax Error: (unicode error) 'unicodeescape' ... | I was able to resolve this issue using conda to remove and reinstall the packages that were failing to import. I will leave the question marked unanswered to see if anyone else has a better solution, or guidance on how to prevent this in the future. | 0 | false | 1 | 4,371 |
2016-06-29 02:19:27.577 | pyinstaller 3.2 build pyqt4/python2.7 to onefile exe, can not run missing msvcr100.dll? | As title,
Build successful, but the exe can't run. can not found msvcr100.dll.
I can put msvcr100.dll with exe in the same dir, the exe can run.
But I just want only one exe file.
Anyone know how to do? | Has solved. This is a bug of pyinstaller3.2, the new one in the git has solved this bug. Down the newest source in the GitHub, everything works fine.
This is correct, I cant tell you how much that answer helped me out. I have been trying to build a single exe Exploit to execute on Windows XP with-out it crashing for m... | 0.386912 | false | 2 | 4,372 |
2016-06-29 02:19:27.577 | pyinstaller 3.2 build pyqt4/python2.7 to onefile exe, can not run missing msvcr100.dll? | As title,
Build successful, but the exe can't run. can not found msvcr100.dll.
I can put msvcr100.dll with exe in the same dir, the exe can run.
But I just want only one exe file.
Anyone know how to do? | Has solved. This is a bug of pyinstaller3.2, the new in the git has solved this bug. Down the newest source in the github, erverything works fine. | 0.386912 | false | 2 | 4,372 |
2016-06-29 15:01:00.750 | How to make GtkListView items flow from top to bottom, like in Thunar or Nautilus Compact View Mode? | I'm now practicing with Gtk by developing a file manager application similar to Thunar, and I simply can't figure out how to make the IconView items flow vertically instead of horizontally, like in Thunar or Nautilus' Compact View mode, as well as in Windows Explorer's List View Mode. Should I use TreeView istead?
I'm ... | It finally seems that IconView has not such a feature right now, as Thunar uses its own control from libexo, while Caja/Nautilus use their own controls from other libraries. | 1.2 | true | 1 | 4,373 |
2016-06-30 10:17:12.550 | How to get Webkit for Mac OS X | I want to make a browser with Python GTK and Webkit for education purposes. I have GTK and it works, but I can't find how to get webkit for Mac OS X. I tried brew, pip3, easy_install. And I'm not sure if PyQT webkit port is the same as webkit. | For GTK3
brew install pygobject3
Otherwise
brew install pygobject | 0 | false | 1 | 4,374 |
2016-06-30 18:12:41.230 | Error while installing Airflow using pip in windows- Unable to find vcvarsall.bat | I was trying to install Airflow in windows through command prompt using pip.
The python is 3.4.2, pip included. I am getting the below error.
distutils.errors.DistutilsError: Setup script exited with error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).
I have installed Visual studio 2012 but Py... | Instead of setting VS100COMNTOOLS=%VS110COMNTOOLS% in cmd, i did
SET VS100COMNTOOLS=C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\ and it was picking correctly but again thrown another pile of errors as VS11 compiler is different and cannot compile Python 3.4 code properly.
I uninstalled VS11, Installed V... | 0 | false | 1 | 4,375 |
2016-07-01 10:35:14.763 | How to parse and retrieve diameter AVPs in python? | I have a diameter packet capture pcap file (using tcpdump) containing some AVPs. I'd like to parse the pcap file and access/retrieve the AVPs.
I'm using python3.5.1. The dpkt library apparently supports diameter well but it's not yet available for python3. I tried converting it via 2to3-3.5 script but the conversion is... | I would suggest you to use tshark. Using tshark you can convert the pcap files to text files containing the AVPs that you are interested in. Once you have the text file, I believe it would be easy to extract the information using python. | 0 | false | 1 | 4,376 |
2016-07-01 12:08:18.643 | Database Connection SQL Server / Oracle | i have been trying to connect to SQL Server (I have SQL Server 2014 installed on my machine and SQL Native Client 11.0 32bit as driver) using Python and specifically pyodbc but i did not manage to establish any connection.
This is the connection string i am using:
conn = pyodbc.connect('''DRIVER={SQL Server Native Cli... | I may be missing something here. Why don't you connect to your Oracle database as a SQL Server linked server (or the other way around) ? | 0 | false | 1 | 4,377 |
2016-07-02 13:15:31.377 | Graceful exit server when using Django's autoreloader | I am using a custom Django runserver command that is supposed to run a bunch of cleanup functions upon termination. This works fine as long as I don't use the autoreloader: by server catches the KeyboardInterrupt exception properly and exits gracefully.
However, if I use Django's autoreloader, the reloader seems to sim... | Try using the atexit module to catch the termination. It should work for everything which acts like SIGINT or SIGTERM, SIGKILL cannot be interrupted (but should not be sent by any auto-restart script without sending SIGTERM before). | 1.2 | true | 1 | 4,378 |
2016-07-02 13:17:44.853 | Python in Knime: Downloading files and dynamically pressing them into workflow | I'm using Knime 3.1.2 on OSX and Linux for OPENMS analysis (Mass Spectrometry).
Currently, it uses static filename.mzML files manually put in a directory. It usually has more than one file pressed in at a time ('Input FileS' module not 'Input File' module) using a ZipLoopStart.
I want these files to be downloaded dynam... | There are multiple options to let things work:
Convert the files in-memory to a Binary Object cells using Python, later you can use that in KNIME. (This one, I am not sure is supported, but as I remember it was demoed in one of the last KNIME gatherings.)
Save the files to a temporary folder (Create Temp Dir) using Py... | 0.201295 | false | 1 | 4,379 |
2016-07-08 11:43:40.360 | Import Vlc module in python | I am trying to create a media player using vlc and python but it throws an Error which is No module named vlc. how to fix this? | I had a same issue. You should try sudo pip install python-vlc | 1.2 | true | 2 | 4,380 |
2016-07-08 11:43:40.360 | Import Vlc module in python | I am trying to create a media player using vlc and python but it throws an Error which is No module named vlc. how to fix this? | The answer didn't work for me, using Mu 1.0.2 on a Raspberry Pi, this did however:
sudo pip3 install vlc | 0 | false | 2 | 4,380 |
2016-07-09 05:16:53.793 | How do I stop a script that is running in the background in Qpython3? | I am using Qpython3 on my Android tablet. I have a Python script for a talking alarm clock that I would like to run in the background and then go off at the time the user sets. The problem is, once I set the console running in the background, I can't figure out how to get back to it to stop the script (i.e. get the mes... | Open the "qpython3" app then touch "Console" and in the top left corner touch "No. 1" or "No. 2" or ... then select your background running scripts and by touching "X" sing you can kill them. | 1.2 | true | 1 | 4,381 |
2016-07-09 10:30:45.280 | Django forms in ReactJs | Is there any way I can use Django forms inside a ReactJS script, like include {{ form }} in the JSX file?
I have a view which displays a from and it is rendered using React. When I load this page from one page the data in these fields should be empty, but when I hit this view from another page I want date to be prefil... | The {{ form }} statement is relative to Django template. Django templates responsible for rendering HTML and so do React, so you don't have to mix the two together.
What you probably want to do is to use the Django form validation mechanism server side, let React render the form client-side. In your Django view, simply... | 1.2 | true | 1 | 4,382 |
2016-07-10 11:29:32.937 | Dynamic css import with Jinja2 | I am trying to make my stylesheets dynamic with django (jinja2) and I want to do something like this:
<link rel="stylesheet" href="{% static 'home/css/{{ block css }}{{ endblock }}.css' %}">
Apparently, I can't use Jinja in Jinja :), and I don't know how to make this work another way. | I found a solution that works out pretty well.
I use
<link rel="stylesheet" href="{% block css %}{% endblock %}"> in the template
and then: {% block css%}{% static 'home/css/file.css' %}{% endblock % in each page | 1.2 | true | 1 | 4,383 |
2016-07-11 07:09:21.487 | How to run kivy after 1.9.1 on windows? | After the installation of Kivy 1.9.1 on Windows using the commands of Kivy installation tutorials, I can't run the program using "kivy ***.py". I don't know how to set up the environment variables, and I can't find it on the official websites.
Kivy: 1.9.1
Python: 3.4.4
Windows 10
Please HELP!
Thanks | Make sure you're running the command from the folder where the *.py file is located, "kivy *.py" should run from there. | 0.201295 | false | 1 | 4,384 |
2016-07-11 22:55:58.287 | Should I use Threads or multiple processess? | I wanted to get some help with an application... Currently I have a script that saves certain information to a database table, well call this table "x". I have another script that gets and saves other info to a different database table, well call this one "y". I also have a script that runs formulas on the information ... | Based on Harp's second comment to his original post (which was posted after your answer), I suspect that you would now agree with me that processes are probably called-for here, based on this newly-supplied information.
However, I find myself questioning just how much "truly effective concurrency" is likely to be found... | 0 | false | 1 | 4,385 |
2016-07-12 06:15:11.273 | how to use dot production on batch data? | I am trying to apply tanh(dot(x,y));
x and y are batch data of my RNN.
x,y have shape (n_batch, n_length, n_dim) like (2,3,4) ; 2 samples with 3 sequences, each is 4 dimensions.
I want to do inner or dot production to last dimension. Then tanh(dot(x,y)) should have shape of (n_batch, n_length) = (2, 3)
Which functio... | This expression should do the trick:
theano.tensor.tanh((x * y).sum(2))
The dot product is computed 'manually' by doing element-wise multiplication, then summing over the last dimension. | 0.386912 | false | 1 | 4,386 |
2016-07-12 06:49:24.367 | Python SSH Server(twisted.conch) change the password prompt | I wrote a SSH server with Twisted Conch. When I execute "ssh username@xx.xx.xx.xx" command on the client side. My twisted SSH server will return a prompt requesting password that like "username@xx.xx.xx.xx's password: ".
But now I want to change this password prompt that like "your codes is:". Dose anyone know how t... | The password prompt is part of keyboard-authentication which is part of the ssh protocol and thus cannot be changed. Technically, the prompt is actually client side. However, you can bypass security (very bad idea) and then output "your codes is"[sic] via the channel | 0 | false | 1 | 4,387 |
2016-07-12 13:47:03.460 | Sublime Text: How do you exit the multiple row layout | I was wondering how you exit the multiple row layout on Sublime Text. I switched to a 3 row layout when editing one of my Django projects, but how do I exit from it (remove the extra rows I have added).
Thanks,
Henry | In the menu bar: View > Layout > Single
Or from the keyboard (on Windows): Alt + Shift + 1
To find your default shortcuts, Preferences > Key Bindings - Default, and search for "set_layout". | 0.386912 | false | 2 | 4,388 |
2016-07-12 13:47:03.460 | Sublime Text: How do you exit the multiple row layout | I was wondering how you exit the multiple row layout on Sublime Text. I switched to a 3 row layout when editing one of my Django projects, but how do I exit from it (remove the extra rows I have added).
Thanks,
Henry | Use View -> Layout menu. If you choose View -> Layout -> Single, other rows will be removed. Short keys depends on OS. | 1.2 | true | 2 | 4,388 |
2016-07-12 14:04:29.100 | PyCharm Directly Open Python File | I switched to PyCharm a couple of months ago, but I can't figure out how to get rid of the welcome screen when I open files.
More specifically, I've set up my mac to open all .py files using PyCharm. However, when I double click on a .py file, it's the Welcome screen that opens up and not the .py file.
How do I get PyC... | PyCharm displays the Welcome screen when no project is open. From this screen, you can quickly access the major starting points of PyCharm. The Welcome screen appears when you close the current project in the only instance of PyCharm. If you are working with multiple projects, usually closing a project results in closi... | 0 | false | 1 | 4,389 |
2016-07-13 15:44:54.973 | Diamond Shaped Radiobuttons in Python Tkinter | I am creating a GUI for an application, modeled off of one I have seen. This other application uses diamond-shaped radiobutton indicators from Python Tkinter, and I can't seem to find out how to use a diamond-shaped radiobutton in my program. All of my attempts at creating a radiobutton result in a circular shaped radi... | The forms toolkit offers precisely the components that it offers. If you are not happy with round radio buttons, then code in OSF/Motif, which offers diamond-shaped radio buttons. Either that, or you could hack the internals of the widget (sorry, "control": I am so accustomed to professional [= UNIX] terminology). T... | -0.905148 | false | 1 | 4,390 |
2016-07-13 16:44:34.003 | Move .keras directory in Ubuntu | When I'm in ipython and try to import keras, I get the error No space left on device: /home/username/.keras. How can I change this so that Keras does not use my HOME directory, and instead use /data/username/? I did the same for the directory ~/.ipython. I moved it to the desired location and then did export IPYTHONDIR... | I don't think keras is the only problem. If you are using theano as a backend, it will create $HOME/.theano/ as well.
One dirty trick is to export HOME=/data/username/, but other program than keras or ipython will also treat /data/username/ as $HONE. To avoid that, you can do this locally by calling HOME=/data/username... | 0.673066 | false | 1 | 4,391 |
2016-07-14 00:59:47.360 | How to access SAS dataset (available both n local derive and SAS server) from Python code? | I am writing some code in Python with all the data available in SAS datasets both on Local hard drive and SAS server. The problem is how to access / import these datasets directly in my python program and then write back? Can anybody help. I have seen recommendation for python package "Sas7bdat" but not sure about it. ... | With the help of sas7bdat package you can access all sas datasets normally in local drive, and to use datasets from server use FTP or SFTP connections to read the file as a object and it's easy to access. | 1.2 | true | 1 | 4,392 |
2016-07-14 01:31:42.983 | in python, how do you denote required parameters and optional parameters in code? | especially when there are so many parameters (10+ 20+).
What are good ways of enforcing required/optional parameters to a function?
What are some good books that deal with this kind of questions for python?
(like effective c++ for c++)
** EDIT **
I think it's very unpractical to list def foo(self, arg1, arg2, arg3, ... | One way is to have your required parameters be named like func(a, b, c=1) and this would denote required because the code will error out at runtime if missing any. Then for the optional parameters you would then use Python's args and kwargs.
Of course anytime you use Python's args and kwargs means additional code to pu... | 0.201295 | false | 1 | 4,393 |
2016-07-14 02:30:40.737 | Dynamic scenario dispatcher for Python Behave | I am running multiple scenarios and would like to incorporate some sort of dynamic scenario dispatcher which would allow me to have specific steps to execute after a test is done based on the scenario executed. When I was using PHPUnit, I used to be able to subclass the TestCase class and add my own setup and teardown ... | What I've been doing might give you an idea:
In the before_all specify a list in the context (eg context.teardown_items =[]).
Then in the various steps of various scenarios add to that list (accounts, orders or whatever)
Then in the after_all I login as a superuser and clean everything up I specified in that list.
Coul... | 0 | false | 1 | 4,394 |
2016-07-14 14:08:44.670 | Changing the scale of a tensor in tensorflow | Sorry if I messed up the title, I didn't know how to phrase this. Anyways, I have a tensor of a set of values, but I want to make sure that every element in the tensor has a range from 0 - 255, (or 0 - 1 works too). However, I don't want to make all the values add up to 1 or 255 like softmax, I just want to down scale ... | sigmoid(tensor) * 255 should do it. | 0.327599 | false | 1 | 4,395 |
2016-07-15 04:03:38.507 | While Mac OSX has the say command to speak, or so to say, is there any command that is similar for Python? | While Mac OSX 10.11.5 (El Capitan) has the "say" command to speak in a system generated voice, or so to say, is there any command that is similar for Python that can be used in Python? If Subprocess is utilized, please explain on how to use that. | Thank you everyone for the quick replies. I have been playing with the subprocess module, and I have gotten this to work:import subprocess
m=subprocess.Popen(["say","hello"])
print(m)
The .Popen command is also a quick way to get this to work. However, this is only working on my Mac and I need it to work on my Raspber... | 0 | false | 1 | 4,396 |
2016-07-15 05:57:44.393 | Sort A list of Strings Based on certain field | Overview: I have data something like this (each row is a string):
81:0A:D7:19:25:7B, 2016-07-14 14:29:13, 2016-07-14 14:29:15, -69, 22:22:22:22:22:23,null,^M
3B:3F:B9:0A:83:E6, 2016-07-14 01:28:59, 2016-07-14 01:29:01, -36, 33:33:33:33:33:31,null,^M
B3:C0:6E:77:E5:31, 2016-07-14 08:26:45, 2016-07-14 08:26:47, -65, 33:... | you can use string.split(),string.split(',')[1] | 0.135221 | false | 1 | 4,397 |
2016-07-15 16:23:39.533 | Do classes in Python work the same way as classes in Java? | My background in programming is mostly Java. It was the first language I learned, and the language I spent the most amount of time with (I then moved on to C# for a little, and eventually C in school). A while back I tried dabbling with Python, and it seemed so different to me (based on my experience with Java). Anyway... | The short answer is yes and no.
One of the key differences I see in Python compared to Java and C# is that in Python, functions don't have to be in a class. In fact, operations don't even have to be in a function.
Java and C# both have two main rules:
All code must be in a class.
Operations are generally required to b... | 0.673066 | false | 1 | 4,398 |
2016-07-15 21:36:37.450 | How to loop through multiple cells in Jupyter / iPython Notebook | I've got a Jupyter Notebook with a couple hundred lines of code in it, spread across about 30 cells. If I want to loop through 10 cells in the middle (e.g. using a For Loop), how do you do that? Is it even possible, or do you need to merge all the code in your loop into one cell? | The only way I can see to do it would be to join the cells, and then put the entire thing in a for/while loop. | 1.2 | true | 1 | 4,399 |
2016-07-15 21:48:29.073 | Intel Distribution for Python and Spyder IDE | I've just installed the new Intel Distribution for Python because I need some performance improvements with my Skull Canyon NUC, but I don't understand how to use all the packages/modules modified by Intel.
I usually use Anaconda Spyder as my main IDE, how can I "tell" to Spyder to not use the Anaconda standard/include... | In Spyder menu choose Preferences then click console and click to Advanced settings tab. From there choose the Python interpreter, which came with Intel Distribution. | 1.2 | true | 1 | 4,400 |
2016-07-16 14:45:43.883 | xml + xslfo to PDF python | Is there a simple way to get a PDF from a xml with an xsl-fo?
I would like to do it in python.
I know how to do an html from an xml&xsl, but I haven't find a code example to get a PDF.
Thanks | XSL FO requires a formatting engine to create print output like PDF from XSL FO input. Freely available one is Apache FOP. There are several other commercial products also. I know of no XSL FO engines written in Python though some have Python interfaces. | 0.201295 | false | 1 | 4,401 |
2016-07-17 05:18:03.770 | How do I control a python script through a web interface? | For a college project I'm tasked with getting a Raspberry Pi to control an RC car over WiFi, the best way to do this would be through a web interface for the sake of accessibility (one of the key reqs for the module). However I keep hitting walls, I can make a python script control the car, however doing this through a... | I can suggest a way to handle that situation but I'm not sure how much will it suit for your scenario.
Since you are trying to use a wifi network, I think it would be better if you can use a sql server to store commands you need to give to the vehicle to follow from the web interface sequentially. Make the vehicle to r... | 0 | false | 1 | 4,402 |
2016-07-18 05:38:55.980 | Python/Flask : psutil date ranges | I'm currently writing a web application using Flask in python that generates the linux/nix performances(CPU, Disk Usage, Memory Usage). I already implemented the python library psutil.
My question is how can I get the values of each util with date ranges. For example: Last 3 hours of CPU, Disk Usage, Memory usage.
Sorr... | For future need, I found a way to this. Using ElasticSearch and Psutil.
I indexed the psutil values to elasticsearch then used the date-range and date-histogram aggs.
Thanks! | 0 | false | 1 | 4,403 |
2016-07-18 08:20:09.890 | Running openmdao 1.7.0 GUI | Is openmdao GUI available on 1.7.0 version? And if yes, how to run it? I have found, how to run the GUI on the 0.10.7 version, but it doesn't work on the 1.7. | Worked for me after updating to 1.7.1 via pip on Fedora v20. The command with conventional naming is:
view_tree(top) | 0 | false | 1 | 4,404 |
2016-07-18 09:49:25.960 | Python - Plotting vertical line | I have a curve of some data that I am plotting using matplotlib. The small value x-range of the data consists entirely of NaN values, so that my curve starts abruptly at some value of x>>0 (which is not necessarily the same value for different data sets I have). I would like to place a vertical dashed line where the ... | Assuming you know where the curve begins, you can just use:
plt.plot((x1, x2), (y1, y2), 'r-') to draw the line from the point (x1, y1) to the point (x2, y2)
Here in your case, x1 and x2 will be same, only y1 and y2 should change, as it is a straight vertical line that you want. | 1.2 | true | 1 | 4,405 |
2016-07-20 08:41:47.277 | How can I get IntelliJ to index libraries in my Python Conda environment? | I am using Python with Conda to manage my environment and libraries. Does anyone know how to get IntelliJ (with the Python plugin) or PyCharm to add the libraries in my Conda environment to my project?
It only pulls in site packages even when I select ~/anaconda/bin/python as my Python Interpreter. | You ned to change your Project Interpreter to point to $CONDA_PREFIX/bin/python where $CONDA_PREFIX is the location of your conda env. The $CONDA_PREFIX environment location you're looking for should be in the second column of the output from conda info --envs. | 1.2 | true | 1 | 4,406 |
2016-07-20 11:54:24.440 | Wait and complete processes when Python script is stopped from PyCharm console? | Basically I am writing a script that can be stopped and resumed at any time. So if the user uses, say PyCharm console to execute the program, he can just click on the stop button whenever he wants.
Now, I need to save some variables and let an ongoing function finish before terminating. What functions do I use for thi... | Solved it using a really bad workaround. I used all functions that are related to exit in Python, including SIG* functions, but uniquely, I did not find a way to catch the exit signal when Python program is being stopped by pressing the "Stop" button in PyCharm application. Finally got a workaround by using tkinter to ... | 0.201295 | false | 1 | 4,407 |
2016-07-20 19:12:19.397 | how can i restore the backup.py plugin data of errbot running in a docker container | I'm running errbot in a docker container, we did the !backup and we have the backup.py, but when i start the docker container it just run /app/venv/bin/run.sh
but i cannot pass -r /srv/backup.py to have all my data restored.
any ideas?
all the data is safe since the /srv is a mounted volume | I think the best if you run Errbot in a container is to run it with a real database for the persistence (redis for example).
Then you can simply run backup.py from anywhere (including your dev machine).
Even better, you can just do a backup of your redis directly. | 1.2 | true | 1 | 4,408 |
2016-07-21 00:53:25.167 | Python 2.7 Pip module not installing or setting paths via cmd? | I've been having some really odd issues with trying to install and use the Python "Pip" module. Firstly, I've installed the pip module by downloading the getpip.py file and running it which has replaced my pre existing pip which seemed to work fine. However whenever I try to use pip it always comes up with "pip is not ... | You're using the wrong path, Pip should reside in the Scripts sub directory, set PATH to C:\Python27\Scripts then you should restart cmd. | 0 | false | 1 | 4,409 |
2016-07-21 06:01:42.270 | Converting a PDF file to a Text file in Python | I've been on it for several days + researching the internet on how to get specific information from a pdf file.
Eventually I was able to fetch all information using Python from a text file(which I created by going to the PDF file -----> File ------> Save as Text).
The question is how do I get Python to accomplish those... | You can use "tabula" python library. which basically uses Java though so you have to install Java SDK and JDK.
"pip install tabula"
and import it to the python script then you can convert pdf to txt file as:
tabula.convert_into("path_or_name_of_pdf.pdf", "output.txt", output_format="csv", pages='all')
You can see other... | 0 | false | 1 | 4,410 |
2016-07-22 04:09:00.377 | Date field in SAS imported in Python pandas Dataframe | I have imported a SAS dataset in python dataframe using Pandas read_sas(path)
function. REPORT_MONTH is a column in sas dataset defined and saved as DATE9. format. This field is imported as float64 datatype in dataframe and having numbers which is basically a sas internal numbers for storing a date in a sas dataset. N... | I don't know how python stores dates, but SAS stores dates as numbers, counting the number of days from Jan 1, 1960. Using that you should be able to convert it in python to a date variable somehow.
I'm fairly certain that when data is imported to python the formats aren't honoured so in this case it's easy to work aro... | 0 | false | 1 | 4,411 |
2016-07-22 04:33:22.803 | Can Excel Dashboards update automatically? | I need to create a dashboard based upon an excel table and I know excel has a feature for creating dashboards. I have seen tutorials on how to do it and have done my research, but in my case, the excel table on which the dashboard would be based is updated every 2 minutes by a python script. My question is, does the da... | If the "dashboard" is in Excel and if it contains charts that refer to data in the current workbook's worksheets, then the charts will update automatically when the data is refreshed, unless the workbook calculation mode is set to "manual". By default calculation mode is set to "automatic", so changes in data will imme... | 0.386912 | false | 1 | 4,412 |
2016-07-22 08:09:44.123 | OpenERP - Odoo - How to have the percentage of quote that become a sale orders | Is it possible to have easily the percentage of sales orders / quotes per users?
The objective it is to know what the percentage of quote that become a sale order per user.
I have not a clue how I can do it.
I am using OpenERP 7 | Yes it is possible by using status bar.
In order for you to compute the percentage of sales order, you should determine how much is the quota for each sale order. | 0 | false | 1 | 4,413 |
2016-07-22 13:18:17.267 | Jenkins with Windows slave with Python - Setting environment variables while building and using them when running a python script | I'm currently using a Jenkins build to run a bash command that activates a Python script. The build is parametrised, and i need to be able to set environment variables containing those parameters on the Windows slave to be used by the Python script.
So, my question is: How do i set temporary env. variables for the curr... | What I usually do is going on the build output, on the left you will find "Build environment Variables" or something similar and check if you can see them there, but the solution cited on the other SO post works usually for me as well | 0 | false | 1 | 4,414 |
2016-07-22 16:51:11.483 | Open a Jupyter notebook within running server from command line | My Jupyter/IPython notebooks reside in various directories all over my file system. I don't enjoy navigating hierarchies of directories in the Jupyter notebook browser every time I have to open a notebook. In absence of the (still) missing feature allowing to bookmark directories within Jupyter, I want to explore if I ... | Option 1: Run multiple jupyter notebook servers from your project directory root(s). This avoids navigating deeply nested structures using the browser ui. I often run many notebook servers simultaneously without issue.
$ cd path/to/project/; jupyter notebook;
Option 2: If you know the path you could use webbrowser mo... | 0.673066 | false | 1 | 4,415 |
2016-07-23 10:04:11.547 | Anyone know how to set group volume in soco (python)? | I am trying to set group volume in soco (python) for my Sonos speakers. It is straightforward to set individual speaker volume but I have not found any way to set volume on group level (without iterating through each speaker setting the volume individually). Any idea to do this? | you can easily iterate over the group, and change all their volumes, for example to increate the volume on all speakers by 5:
for each_speaker in my_zone.group:
each_speaker.volume += 5
(assuming my_zone is you speaker object) | 1.2 | true | 1 | 4,416 |
2016-07-25 00:59:59.523 | flask serving byte-order-mark  | I am trying to use Flask and for some reason it is rendering with a byte-order mark that's a quirk of something using UTF8 (the mark is  in particular for people googling the same issue).
I do not know how to get rid of it or if it is a source of some of my problems. I am using Flask on Windows 10.
I wish I knew how... | The string (BOM) is most likely included in your template file. Open/save it in some editor which doesn't include unnecessary symbols in UTF-8 files. For example Notepad++. | 0.673066 | false | 1 | 4,417 |
2016-07-26 09:43:50.893 | How to execute an entire Javascript program from within a Python script | So I am currently working on a project that involves the google maps API. In order to display data on this, the file needs to be in a geojson format. So far in order to accomplish this, I have been using two programs, 1 in javascript that converts a .json to a CSV, and another that converts a CSV to a geojson file, whi... | I was able to write a conversion script, and it's working now, thanks! | 0 | false | 1 | 4,418 |
2016-07-26 09:59:50.780 | Celery: How to get the task completed time from AsyncResult | I need to trace the status for the tasks. i could get the 'state', 'info' attribute from the AsyncResult obj. however, it looks there's no way to get the 'done_date'. I use MySQL as result backend so i could find the date_done column in the taskmeta table, but how could i get the task done date directly from AysncResul... | You can get it from the _cache object of the AsyncResult after you have called res.result
for example
res._cache['date_done'] | 1.2 | true | 1 | 4,419 |
2016-07-26 17:56:24.920 | Reading From Google Sheets Periodically | I'm trying to read from a Google sheet say every 2 hours. I have looked at both the API for Google sheets and also the Google Apps Script.
I'm using Python/Flask, and what I'm specifically confused about is how to add the time trigger. I can use the Google Sheets API to read from the actual file,but I'm unsure of how ... | If you want to do this with only manipulating your Python program, you would have to run it all day. This would waste CPU resources.
It's best to use cron to schedule your unix system to run a command for you every 2 hours. In this case, it'd be your python program. | 1.2 | true | 1 | 4,420 |
2016-07-27 03:59:09.580 | PyInstaller/Py2exe - include os.system call with third party scripts in single file compilation | I'm using tkinter and pyinstaller/py2exe (either one would be fine), to create an executable as a single file from my python script. I can create the executable, and it runs as desired when not using the bundle option with py2exe or -F option with pyinstaller. I'm running third party python scripts within my code with ... | After a couple of days of some tests, I was able to figure out how to work around this problem. Instead of os.system, I am using subprocess.call("script.py arg1 arg2 ..., shell=True) for each script I need to run. Also, I used chmod +x (in linux) before transferring the scripts to windows to ensure they're an executabl... | 1.2 | true | 1 | 4,421 |
2016-07-27 12:21:53.237 | Suggestions to make website fast by breaking a request in two parts | I am trying to speed up my website. So at the moment, controller fetches data from database, do calculation on data and display on view.
what I plan to do is, controller/action fetches half the data and display to the view. Than come back to different controller/action and do calculation on data and display data on sc... | Why don't you use ajax function , post data to the server and when proccess to the server is done display the result to the html page | 0.673066 | false | 1 | 4,422 |
2016-07-27 13:58:16.793 | Tf-Idf vectorizer analyze vectors from lines instead of words | I'm trying to analyze a text which is given by lines, and I wish to vectorize the lines using sckit-learn package's TF-IDF-vectorization in python.
The problem is that the vectorization can be done either by words or n-grams but I want them to be done for lines, and I already ruled out a work around that just vectorize... | You seem to be misunderstanding what the TF-IDF vectorization is doing. For each word (or N-gram), it assigns a weight to the word which is a function of both the frequency of the term (TF) and of its inverse frequency of the other terms in the document (IDF). It makes sense to use it for words (e.g. knowing how often ... | 1.2 | true | 1 | 4,423 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.