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 |
|---|---|---|---|---|---|---|---|
2017-01-05 02:34:58.873 | How to join() words from a string? | I want to transform the string 'one two three' into one_two_three.
I've tried "_".join('one two three'), but that gives me o_n_e_ _t_w_o_ _t_h_r_e_e_...
how do I insert the "_" only at spaces between words in a string? | And if you want to use join only , so you can do like thistest="test string".split()
"_".join(test)
This will give you output as "test_string". | 0 | false | 1 | 4,664 |
2017-01-05 12:33:46.877 | Troubleshooting API timeout from Django+Celery in Docker Container | I have a micro-services architecture of let say 9 services, each one running in its own container.
The services use a mix of technologies, but mainly Django, Celery (with a Redis Queue), a shared PostgreSQL database (in its own container), and some more specific services/libraries.
The micro-services talk to each other... | You can shell into the running container and check things out. Is the celery process still running, etc...
docker exec -ti my-container-name /bin/bash
If you are using django, for example, you could go to your django directory and do manage.py shell and start poking around there.
I have a similar setup where I run mult... | 0 | false | 1 | 4,665 |
2017-01-05 12:46:20.063 | Set result of 2 or more Async HTTP calls into named variables | What I want to achieve is :
tasks = [call(url) for url in urls]
call is an async method / coroutine in Python3.5 to perform GET requests , let's say aiohttp.
So basically all calls to call are async. Now I can run asyncio.wait(tasks) and later access the result in futures one by one.
BUT, what I want is, lets assume th... | var1, var2 = loop.run_until_complete(asyncio.gather(task1, task2))
According to the docs, gather retains the order of the sequence it was passed | 1.2 | true | 1 | 4,666 |
2017-01-07 07:56:28.757 | how to clear the screen of the idle3(python3 shell)? | I used some of the codes such as
clear cls clc but none of them gave me the desired result.
Is there any command that can clear the screen of the idle? | Press the key
Ctrl+F6
then you can restart the powershell.
Just like the 'clear' used in terminal, it clears the all variables you've assigned values for. | -0.201295 | false | 1 | 4,667 |
2017-01-08 00:26:39.397 | How to have python interact automatically with a web site | Ok, so I've looked around on how to do this and haven't really found an answer that showed me examples that I could work from.
What I'm trying to do is have a script that can do things like:
-Log into website
-Fill out forms or boxes etc.
Something simple that might help me in that I though of would be for example if... | So after some good answers and further research, I have found that selenium is the thing that best suits my needs. It works not only with python, but supports other languages as well. If anyone else is looking for something that I had been when I asked the my question, a quick Google search for "selenium" should giv... | 1.2 | true | 1 | 4,668 |
2017-01-09 14:21:47.920 | how to create a excel file only with python standard library? | I am new to Python.
I use putty to manage some servers. I want to use Python to create a Excel file on each server, for that I think if I can use some orders like ssh ip "python abc.py" to create the file. It is possible to write a bash script to manage all servers. This is the trouble I meet:
The servers can't use in... | I am not sure if this is what the OP was looking for,but if you have to manipulate data in python without installing any modules (just standard library), you can try the sqlite3 module, which of course allows you to interact with sqlite files (a Relational Database Management System).
These databases are conceptually s... | 0 | false | 1 | 4,669 |
2017-01-10 12:01:42.487 | Manipulating the Terminal Using a Python Script | I have recently started using a program which has command line interfaces accessed through the Mac Terminal.
I am trying to automate the process whereby a series of commands are passed through the terminal using Python.
So far I have found a way to open the Terminal using the subprocess.Popen command but how do I then... | Thanks for the comments guys but I managed to figure it out.
In the end I used a combination of subprocess.Popen() and os.chdir() and it seems to work using Jupyter Notebook. | 0.386912 | false | 1 | 4,670 |
2017-01-10 16:27:43.207 | What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc? | Python 3.3 includes in its standard library the new package venv. What does it do, and how does it differ from all the other packages that seem to match the regex (py)?(v|virtual|pip)?env? | Let's start with the problems these tools want to solve:
My system package manager don't have the Python versions I wanted or I want to install multiple Python versions side by side, Python 3.9.0 and Python 3.9.1, Python 3.5.3, etc
Then use pyenv.
I want to install and run multiple applications with different, conflict... | 0.999998 | false | 1 | 4,671 |
2017-01-10 18:15:34.950 | Large graph processing on Hadoop | I am working on a project that involves a RandomWalk on a large graph(too big to fit in memory). I coded it in Python using networkx but soon, the graph became too big to fit in memory, and so I realised that I needed to switch to a distributed system. So, I understand the following:
I will need to use a graph databas... | My understanding is, you need to process large graphs which are stored on file systems. There are various distributed graph processing frameworks like Pregel, Pregel+, GraphX, GPS(Stanford), Mizan, PowerGraph etc.
It is worth taking a look at these frameworks. I will suggest coding in C, C++ using openMPI like which c... | 0 | false | 1 | 4,672 |
2017-01-11 12:32:43.090 | Changing Database in run time and making the changes reflect in Django in run time | I am developing a Cloud based data analysis tool, and I am using Django(1.10) for that.
I have to add columns to the existing tables, create new tables, change data-type of columns(part of data-cleaning activity) at the run time and can't figure out a way to update/reflect those changes, in run time, in the Django mode... | Django's ORM might not be the right tool for you if you need to change your schema (or db) online - the schema is defined in python modules and loaded once when Django's web server starts.
You can still use Django's templates, forms and other libraries and write your own custom DB access layer that manipulates a DB dyn... | 0 | false | 1 | 4,673 |
2017-01-13 04:08:20.400 | Download data from a jupyter server | I'm using ipython notebook by connecting to a server
I don't know how to download a thing (data frame, .csv file,... for example) programatically to my local computer. Because I can't specific declare the path like C://user//... It will be downloaded to their machine not mine | The download option did not appear for me.
The solution was to open the file (which could not be correctly read as it was a binary file), and to download it from the notebook's notepad. | 0.613357 | false | 1 | 4,674 |
2017-01-13 10:59:16.793 | protect python code from reverse engineering | I'm creating a program in python (2.7) and I want to protect it from reverse engineering.
I compiled it using cx_freeze (supplies basic security- obfuscation and anti-debugging)
How can I add more protections such as obfuscation, packing, anti-debugging, encrypt the code recognize VM.
I thought maybe to encrypt to pay... | There's no way to make anything digital safe nowadays.
What you CAN do is making it hard to a point where it's frustrating to do it, but I admit I don't know python specific ways to achieve that. The amount of security of your program is not actually a function of programsecurity, but of psychology.
Yes, psychology.
Gi... | 0.673066 | false | 2 | 4,675 |
2017-01-13 10:59:16.793 | protect python code from reverse engineering | I'm creating a program in python (2.7) and I want to protect it from reverse engineering.
I compiled it using cx_freeze (supplies basic security- obfuscation and anti-debugging)
How can I add more protections such as obfuscation, packing, anti-debugging, encrypt the code recognize VM.
I thought maybe to encrypt to pay... | Story time: I was a Python programmer for a long time. Recently I joined in a company as a Python programmer. My manager was a Java programmer for a decade I guess. He gave me a project and at the initial review, he asked me that are we obfuscating the code? and I said, we don't do that kind of thing in Python. He said... | 0.386912 | false | 2 | 4,675 |
2017-01-13 12:14:12.317 | In requests-python, when is connection released when using req_json = req.json()? | I read the following on python-requests website:
Note that connections are only released back to the pool for reuse once all body data has been read; be sure to either set stream to False or read the content property of the Response object.
But as I use the object returned by req.json() and doesn't use req thereafte... | You could answer your question quite simpply by reading the source code. But anyway: response.json() does read the response's content, obviously - it's just a convenient shortcut for json.loads(response.content). | 1.2 | true | 1 | 4,676 |
2017-01-14 17:38:35.137 | Tkinter: Set 0, 0 coords on the bottom of a canvas | When I usually create a canvas, the (0, 0) coord is place on the top left corner of it. Now I want to set it on the bottom left corner. I think I have to set the "scrollbarregion" but I can't understand how to do it.
Can someone explain? | You could create a couple of variables that hold the size of the screen. then replace (0,0) with (self.screenWidth-0, self.sceenHeight-0) | 0 | false | 1 | 4,677 |
2017-01-15 15:27:50.953 | How to run python script at startup | I'm trying to make a Python script run as a service.
It need to work and run automatically after a reboot.
I have tried to copy it inside the init.d folder, But without any luck.
Can anyone help?(if it demands a cronjob, i haven't configured one before, so i would be glad if you could write how to do it)
(Running Cento... | There is no intrinsic reason why Python should be different from any other scripting language here.
Here is someone else using python in init.d: blog.scphillips.com/posts/2013/07/… In fact, that deals with a lot that I don't deal with here, so I recommend just following that post. | 0 | false | 1 | 4,678 |
2017-01-15 22:01:41.823 | How does HTTP 206 Partial Content Request works | I have been breaking my head for the pass 2 weeks, and I still can't figure it out.
I'm trying to build a Server-Client based streaming player on Python (Ironpython for the wpf GUI) that streams video files. My problem is when the client requests to seek on a part that he did not load yet. When I try to send him just t... | Before playing an MP4 file the client (e.g. browser) needs to read the header part of the file. An MP4 is broken into 'Atoms' and the Moov atom is the header or index atom for the file.
For MP4 files that will be streamed, a common optimisation is to move this Moov atom to the front of the file.
This allows the client ... | 1.2 | true | 1 | 4,679 |
2017-01-16 01:09:10.693 | TensorFlow: how to determine if we want to break the training dataset into batches | I am learning TensorFlow (as well as general deep learning). I am wondering when do we need to break the input training data into batches? And how do we determine the batch size? Is there a rule of thumb? Thanks! | Generally Deep Learning algorithms are ran on GPUs which has limited memory and thus a limited number of input data samples (in the algorithm commonly defined as batch size) could be loaded at a time.
In general larger batch size reduces the overall computation time (as the internal matrix multiplications are done in a... | 0.386912 | false | 1 | 4,680 |
2017-01-16 08:15:45.227 | How to get hostname from IP? | I'm using python to develop SDN
I also wrote a virtual network function just like DHCP,NAT,Firewall,QoS
But I want to get computer's hostname from IP like 192.168.2.XXX
I try to use arp but it only can find IP and MAC address in packets.
So how should I get hostname from specific IP?
Should I try this in DHCP or NAT?
T... | Try socket.gethostbyaddr() from the module socket | 0 | false | 1 | 4,681 |
2017-01-16 16:17:39.227 | ImportError: No module named newspaper | I am trying to build a python program that will display various headlines from certain news sites. I used pip to install the module newspaper, but when I run the program, I get the error:
ImportError: No module named newspaper
Any ideas on how to fix this? | You can type at the terminal
pip install newspaper3k | 0.201295 | false | 1 | 4,682 |
2017-01-18 02:43:24.693 | Installing PyAutoGui on multiple versions of Python | I, as it will soon be obvious, am a total newb when it comes to Python.
I am running python version 3.5 on Windows 10, 64 bit.
I installed the PyAutoGui module for a small project I am working on. At first, everything worked perfectly. But now it appears that PyAutoGui is crashing when it clicks. I suspect that it's be... | If you have multiple versions of Python installed you need to find your versions and rename them and their Pips.
In windows the path is, C:\\Users\USERNAME\AppData\Local\Programs\Python\Python3x-32. The x should be replaced with the Python version and USERNAME with your username. On Mac it's located in /usr/local/bin/... | 1.2 | true | 1 | 4,683 |
2017-01-18 17:40:24.417 | How tf-idf is relevant in calculating sentence vectors | I am interested to find sentence vectors using word vectors.I read that by multiplying each word's tf-idf weights with their vectors and finding their average we can get whole sentence vector.
Now I want to know that how these tf-idf weights helps us to get sentence vectors i.e how these tf-idf and sentence vector are... | Any aggregative operation on the word vectors can give you a sentence vector.
You should consider what do you want your representation to mean and choose the operation accordingly.
Possible operations are summing the vectors, averaging them, concatenating, etc. | 0 | false | 1 | 4,684 |
2017-01-19 02:12:52.917 | python mechanize Http error 100 | I am having trouble logging in my Microsoft account using python mechanize utility. user-name and password are working fine. Problem comes when submitting the form, I get an interim response page with title: "continue" . and URL: some interim_URL.
Question is how do I move to my intended URL? br.open("intended_URL") d... | First verify if the login is being done by checking the redirected link with
print br.geturl()
If it is logging in and you're have an http error in your console use exceptions for the http error which will redirect you to your page | 0 | false | 1 | 4,685 |
2017-01-19 13:15:10.713 | How solve conversion thing in python that int() can't convert '\x002\x002\x001\x000\x00' into integer? | I have some weird problem with python int function.
I read some file with numeric values and convert these to integers.
When I do this locally it's goes fine, but when I upload it to Google App Engine the conversion fails with error:
invalid literal for int() with base 10: ''
I tried to print the value it's trying to ... | It seems like an encoding issue, but a quick workaround would be to remove '\x00' from each string before converting it. So try int(splitted_line[j].replace('\x00','')) | 1.2 | true | 1 | 4,686 |
2017-01-19 15:02:09.680 | Tensorflow Inception v3 retraining - attach text/labels to individual images | I am using the inception v3 model to retrain my own dataset. I have few folder which represent the classes which contain images for each class. What i would like to do is to 'attach' some text ids to these images so when they are retrained and used to run classification/similarity-detection those ids are retrieved too.... | You have 3 main options - multiply your classes, multi-label learning or training several models.
The first option is the most straight forward - instead of having teachers who belong to John and teachers who belong to Jane you can have teachers whose class is Teachers_John and class whose class is Teachers_John and l... | 0.386912 | false | 1 | 4,687 |
2017-01-19 17:43:24.547 | HTTP POST Data from Arduino to Django Database | I know it is frowned upon to post questions without code, but I have been stuck for days thinking of how to handle this issue and cant think of a solution.
My setup is this:
Arduino Mega w/ 4G + GPS Shield from Cooking Hacks
Django Server set up with Python
Postgresql Database
Because the 4G + GPS shield has the c... | 1)Depends, if your arduino is on the same local network than your Django Server then you don't need a public IP, otherwise you would have to forward your Django Server IP & port so its accesible from internet.
2) Not really, you can do a traditional POST request to a normal view on Django. | 1.2 | true | 1 | 4,688 |
2017-01-19 20:25:37.477 | Jenkins - Store code previous version number, and take actions if version number changes | I'm using Jenkins with python code as follows.
After detecting a change to the GIT dev branch:
Checkout GIT repository dev branch code
Perform Unit tests / code coverage
If build passes, check code into the production branch of the same repo
What I want to add, is the ability to keep track of the previous code versio... | I've made use of the following plugins to achieve this:
Flexible Publish Plugin
Run Condition Plugin | 0 | false | 1 | 4,689 |
2017-01-20 01:52:42.223 | Tableau: How to automate publishing dashboard to Tableau server | I used python scripting to do a series of complex queries from 3 different RDS's, and then exported the data into a CSV file. I am now trying to find a way to automate publishing a dashboard that uses this data into Tableau server on a weekly basis, such that when I run my python code, it will generate new data, and su... | Getting data from excel to Tableau Server:
Setup the UNC path so it is accessible from your server. If you do this, you can then set up an extract refresh to read in the UNC path at the frequency desired.
Create an extract with the Tableau SDK.
Use the Tableau SDK to read in the CSV file and generate a file.
In our ... | 0 | false | 1 | 4,690 |
2017-01-20 20:02:35.223 | Activating Python Virtual Environment in Atom | Don't have much expertise in programming. Only picked up Python last summer.
I have installed both Atom and Conda on my computer. Recently, I've used Atom to edit my scripts in Python, then run the scripts via Command Line. As per standard practice, I created Virtual Environments where I installed packages I needed to ... | One way is to start atom from the activated virtual environment. In this case, executing programs/scripts uses the configured python interpreter and imports the installed in the virtual environment.
EDIT:
It's been long though, it might be useful for people redirected to this question.
By installing atom-python-virtual... | 0.673066 | false | 1 | 4,691 |
2017-01-22 09:10:56.817 | How to count files inside zip in AWS S3 without downloading it? | Case:
There is a large zip file in an S3 bucket which contains a large number of images. Is there a way without downloading the whole file to read the metadata or something to know how many files are inside the zip file?
When the file is local, in python i can just open it as a zipfile() and then I call the namelist()... | As of now, you cannot get such information without downloading the zip file. You can store the required information as the metadata for a zip file when uploading to s3.
As you have mentioned in your question, using the python functions we are able to get the file list without extracting. You can use the same approach ... | -0.081452 | false | 1 | 4,692 |
2017-01-22 17:26:15.707 | Selecting and deselecting tkinter Menu Checkbutton widgets | I have a checkbutton inside of a menu widget in python with tkinter. (Using python 3.5.2). I know that with normal checkbuttons you can select or deselect the checkbuttons using checkbutton.select() and checkbutton.deselect(). I need to know how to do this with the checkbuttons that I have in the menu object.
I have tr... | You should assign an IntVar (or possibly StringVar) to the checkbutton when you create it, via its variable= configuration option. You call .get() on this var to check the button's state, and .set() to change its state. | 1.2 | true | 1 | 4,693 |
2017-01-25 11:22:35.967 | How class_weight emphasis a class in in scikit-learn | I would like to know how scikit-learn put more emphasis on a class when we use the parameter class_weight. Is it an oversampling of the minority sampling ? | I'm not sure if there is a single method of treating class_weight for all the algorithms.
The way Decision Trees (and Forests) deals with this is by modifying the weights of each sample according to its class.
You can consider weighting samples as a more general case of oversampling all the minority class samples (usin... | 0 | false | 1 | 4,694 |
2017-01-25 16:34:10.173 | Reader writer lock with preference to writers | For this question simplictly , I'm having two types of computers: type A and B.
There is one computer of type A, and many of type B.
B are type of hosts which can write and read from ftp.
A is a computer which can just read from ftp.
As you might already guess, ftp is the shared area which need to be protected by rea... | Writer:
Upload a file W. If this fails, wait and try again.
Upload a file R. If this fails, wait and try again.
Do as many writes as desired.
Remove W.
Remove R.
Reader:
Upload a file R. If this fails, wait and try again.
Check for the existence of a file W. If it exists, remove R and return to step 1.
Do one re... | 1.2 | true | 1 | 4,695 |
2017-01-26 04:52:37.817 | Checking result by applying bear on file | when i tried to check the bear results for a python file by using
coala --bears AnnotationBear -f add.py --save
and when it asked for setting language- give "python", then on checking .coafile i didn't find any result that AnnotationBear has to give
so, how to check result? | Hey the AnnotationBear yields, HiddenResult which are results meant to be used by other bears, and not be directly viewed by the user. If you are trying to test coala, you should check bears which actually give results, for eg: PyFlakesBear | 0 | false | 1 | 4,696 |
2017-01-27 08:24:04.380 | clean divide Code and Gui | Hi I know this is a pretty basic design question. But I don't realy get it....
I write it in Python with PySide, but I think this is more a language unrelated question.
A simplified example what I want to do:
I Have a Gui with a button that opens a file dialog.
In this one I choose a folder.
The code scans the suffixe... | Well maybe have the function in the Core module return some specifier that such a thing has happened (found multiple) along with the given names, then display the choice to the user and call a function in the Core module that returns relevant information about that file.
Bear in mind you do not have to be dogmatic rega... | 1.2 | true | 1 | 4,697 |
2017-01-28 17:29:55.017 | PyCharm not recognizing PyQT4 and PyQt4 not allowing me to 'view code' | I am a beginner and have 2 issues, which may be related to each other.
1. I am using PyCharm, and when I put
"from PyQt4 import QtCore, QtGui, uic"
I get a red line under each word (except from & import) saying "unresolved reference".
I have PyQ4/Designer installed (I know it is because I have made a GUI), but whe... | Since you do seem to have PyQt installed my guess is that you have multiple Python versions installed (version 3.4 and version 3.6) and that PyQt is only installed under 3.6, but that PyCharm and the Designer are configured to use 3.4.
I don't know how to change the Python interpreter in the Qt Designer as I never use ... | 1.2 | true | 1 | 4,698 |
2017-01-29 20:21:28.957 | ZeroMQ: publish to many, receive replys in any order | I'm learning about the ZeroMQ patterns, and I need to implement the following:
NodeJS will send messages to many python threads, but it doesn't need to wait for the answers synchronously, they can come in any order. I know that the publish/subscribe pattern solves it in one way: it can send to many, but how do the pyth... | There's no obligation to use a single socket for the two way comms. Two is perfectly fine.
This means you can have PUB/SUB to broadcast from your NodeJS to your Python code. That's the easy part. Then have a separate PUSH/PULL socket back the other way - the Python does the pushing, the NodeJS does the pulling. One PUS... | 0 | false | 1 | 4,699 |
2017-01-30 01:45:52.370 | Book Structure in Django | I am currently trying to implement a book structure in Django in the model.
The structure is as follows
Book Class:
title
pages (this is an array of page objects)
bibliography (a dictionary of titles and links)
Page Class:
title
sections (an array of section objects)
images (array of image urls)
Section Class:
title:... | Each Django model is a class which you import in your app to be able to work with them. To connect models together you can use foreign keys to define relationships, i.e. your Page class will have a foreign key from Book. To store lists in a field, one of the ways of doing it is to convert a list to string using json mo... | -0.201295 | false | 1 | 4,700 |
2017-01-31 18:05:56.577 | If I install modules with pip, how can I make sure other people can run my program without having that module installed? | I'm making a program that uses PyMySql and I'd like people to be able to run my program without going through the manual installation of PyMySql, is there a way I can achieve that?
I've already tried compiling to .pyc but that doesn't seem to work, in fact when I uninstall PyMySql it doesn't work anymore.
PS: There pro... | Use cx_freeze, pyinstaller or virtualenv.
Or copy code and put in your. Read python import | 0 | false | 1 | 4,701 |
2017-02-01 01:46:33.783 | Anaconda 4.3, 64-bit (python 3.6), leaves incorrect truncated paths in windows Start menu | After installing anaconda 4.3 64-bit (python 3.6) on windows, and choosing "install for current user only" and "add to path":
I noticed that the anaconda program shortcuts don't work on my start menu--they are cut off at the end. Does anyone know how the correct entries should read? (or instead, how to repair the lin... | Looks like this was fixed in the newest build of anaconda (4.3.0 .1). Unfortunately looks like it requires uninstall and reinstall as the locations seems to have changed drastically (from some subsubsub folder off of AppData to something higher up, under user directory).
(But that might be the effect of testing 4.3.0... | 1.2 | true | 1 | 4,702 |
2017-02-01 08:21:57.440 | Is it normal that the Django site I recently deployed on Apache is always on? | I recently deployed a Django site on a DigitalOcean droplet through Apache. I did python manage.py runserver through ssh and now the Django site is running. However, it stayed on even after the ssh session expired (understandable because it's still running on the remote server) but how do I shut it down if I need to?
A... | Your question is confusing. If you deployed it with Apache, it's running through Apache and not through runserver. You might have additionally started runserver, but that is not what is serving your site. | 1.2 | true | 1 | 4,703 |
2017-02-02 00:00:52.670 | /usr/bin/python vs /usr/local/bin/python | On Linux, specifically Debian Jessie, should I use /usr/bin/python or should I install another copy in /usr/local/bin?
I understand that the former is the system version and that it can change when the operating system is updated. This would mean that I can update the version in the latter independently of the OS. As I... | 1) You should not modify the system's binaries yourself directly
2) If your $PATH variable doesn't contain /usr/local/bin, the naming of that secondary directory isn't really important. You can install / upgrade independently wherever you have installed your extra binaries.
3) For Python specifically, you could also j... | 0 | false | 1 | 4,704 |
2017-02-02 13:27:41.013 | Bigcommerce Python API, how do I create a product with an image? | how do I upload an image (from the web) using Bigcommerce's Python API?
I've got this so far:
custom = api.Products.create(name='Test', type='physical', price=8.33, categories=[85], availability='available', weight=0)
Thank you! I've tried almost everything! | This will create the product on the BigCommerce website. You create the image after creating the product, by entering the following line. The image_file tag should be a fully qualified URL pointing to an image that is accessible to the BigCommerce website, being found either on another website or on your own webserver.... | -0.964028 | false | 1 | 4,705 |
2017-02-02 15:34:05.463 | Django All-Auth Role Based Signup | Having read many stack overflow questions, tutorials etc on all-auth I keep getting the impression that it only supports the registration of one type of user per project.
I have two usecases
A business user authenticates and registers his business in one step.
A developer user authenticates and just fills in the name ... | @pennersr was kind enough to answer this on the allauth github page:
This truly all depends on how you model things, there is nothing in
allauth that blocks you from implementing the above.
One way of looking at things is that the signup form is not different
at all. It merely contains an additional switch that in... | 0.386912 | false | 1 | 4,706 |
2017-02-04 13:15:12.787 | Why doesn’t 'array' have an in-place sort like list does? | Why doesn’t the array class have a .sort()? I don't know how to sort an array directly.
The class array.array is a packed list which looks like a C array.
I want to use it because only numbers are needed in my case, but I need to be able to sort it. Is there some way to do that efficiently? | A list is a data structure that has characteristics which make it easy to do some things. An array is a very well understood standard data structure and isn't optimized for sorting. An array is basically a standard way of storing the product of sets of data. There hasn't ever been a notion of sorting it. | -0.998178 | false | 1 | 4,707 |
2017-02-05 14:31:45.727 | Python IDLE crashed when saving and all my code disappeared | I was writing my code, then I pressed Ctrl+S. It then started not responding. I closed it and came back on to find the file was now empty!
Anyone know how I can retrieve it? | In the end, I just retyped my code. Luckily, I'd done a backup the previous night, so didn't lose too much.
I am now making sure to do daily backups. | 1.2 | true | 1 | 4,708 |
2017-02-05 21:42:42.327 | How can we use MNIST dataset one class as an input using tensorflow? | I want to find the accuracy of one class in MMNIST dataset .So how can i split it on the basis of classes? | Not sure exactly what you are asking. I will answer about what I understood. In case you want to predict only one class for example digit 5 and rest of the digits. Then first you need to label your vectors in such a way that maybe label all those vectors as 'one' which has ground truth 5 and 'zero' to those vectors who... | 0.386912 | false | 1 | 4,709 |
2017-02-05 23:51:31.183 | log all pip commands in a given virtual environment? | I'd like to keep a record of all pip commands that were executed in a given virtual environment and of the package versions that got installed/updated/removed. Is there an easy way to do that?
Alternatively, how do I get requirements.txt (including --install-option, etc.) out of my virtual environment state, if that's ... | You can use the history command to view the history of all your commands and then grep for pip with out put to a file.
Similar to the comment above. | 0 | false | 1 | 4,710 |
2017-02-06 01:03:20.003 | how to predict only one class in tensorflow | In case you want to predict only one class. Then first you need to label your vectors in such a way that maybe label all those vectors as 'one' which has ground truth 5 and 'zero' to those vectors whose ground truth is not 5.
how can I implement this in tensorflow using puthon | while preparing the data you can use numpy to set all the data points in class 5 as 1 and the others will be set to as 0 using .
arr = np.where(arr!=5,arr,0)
arr = np.where(arr=5,arr,1)
and then you can create a binary classifier using Tensorflow to classifiy them while using a binary_crossentropy loss to optimize the... | 0 | false | 1 | 4,711 |
2017-02-06 04:08:32.420 | gspread get key once opened by title | how do I get the key of the workbook if I know only the name of the workbook? I can use open by title, but once i'm in I didn't find a get.key type method in the documents. Is there a way to get the key by only knowing the title? | You can access a spreadsheet key with mySpreadSheet.id after you have opened it by title. | 1.2 | true | 1 | 4,712 |
2017-02-06 16:16:21.517 | get a list of typeface and sizes used in a docx | I am using Python docx 0.8.5
I can't seem to be able to figure out how to get a list of typeface and sizes used in a document
There is a Font object, accessible on Run.font but I can't handle this problem.
Can somebody please point me to an example?
Thanks | There is no "centralized authority" in a Word document of what Fonts have been used. You'll need to parse through the full document and detect them yourself. Runs are the right place to look, but you'll also need to check styles, both paragraph and character styles. Also, to be thorough, you'll need to check the docume... | 1.2 | true | 1 | 4,713 |
2017-02-07 00:23:57.343 | are there limitations on .pyc files? | I was recently trying to make my own module when I realised a copy of my module had been made but instead of ending in .py like the origional, it ended in .pyc. When I opened it, I could not understand a thing. I was using the import to make a game from pygame and the fact that the .pyc file had a bunch of question mar... | The .pyc files are not readable by humans - the python interpreter compiles the source code to these files, and they are used by the python virtual machine. You can delete these files, and when you run the .py file again, you will see a new .pyc file created. | 0 | false | 1 | 4,714 |
2017-02-07 04:33:43.110 | Pandas dataframe: Listing amount of people per gender in each major | Sorry about the vague title, but I didn't know how to word it.
So I have a pandas dataframe with 3 columns and any amount of rows. The first column is a person's name, the second column is their major (six possible majors, always written the same), and the third column is their gender (always 'Male' or 'Female').
I w... | altering @VaishaliGarg's answer a little,
you can use
df.groupby(['Qgender','Qmajor']).count()
Also if needed a dataframe out of it, we need to add .reset_index()
since it would be a groupbyObject.
df.groupby(['Qgender','Qmajor']).count().reset_index() | 1.2 | true | 1 | 4,715 |
2017-02-07 10:46:05.810 | Spyder IDE environment in Python | I am currently using Spyder and have been for a long time, however I downloaded anaconda recently and started using Spyder for Python 3.5 which gives me several problems.
Whenever I run a script in the Python Console, I have to run it twice and then when I am finished running it and want to run a new I have to kill the... | (Spyder developer here) We're aware of these problems in the Python console, but unfortunately we don't know how to fix them.
Please use the IPython console instead because the Python console is going to be removed in Spyder 3.2. | 0.201295 | false | 1 | 4,716 |
2017-02-07 12:23:56.853 | Python caching attributes in object with __slots__ | I am trying to cache a computationally expensive property in a class defined with the __slots__ attribute.
Any idea, how to store the cache for later use? Of course the usual way to store a dictionary in instance._cache would not work without __dict__ being defined. For several reasons i do not want to add a '_cache' s... | Something like Borg pattern can help.
You can alterate the status of your instance in the __init__ or __new__ methods. | -0.265586 | false | 2 | 4,717 |
2017-02-07 12:23:56.853 | Python caching attributes in object with __slots__ | I am trying to cache a computationally expensive property in a class defined with the __slots__ attribute.
Any idea, how to store the cache for later use? Of course the usual way to store a dictionary in instance._cache would not work without __dict__ being defined. For several reasons i do not want to add a '_cache' s... | There is no magic possible there - ou want to store a value, so you need a place to store your value.
You can't just decide "I won't have an extra entry on my __slots__ because it is not elegant" - you don't need to call it _cached:
give it whatever name you want, but these cached values are something you want to exis... | 1.2 | true | 2 | 4,717 |
2017-02-07 12:30:24.620 | Django: best way to convert data from model to view | My django app displays the objects from database in table view. The problem is that these objects (models) are pretty complex: the have 50+ fields. Nearly for each field I have to do some formatting:
conver phone numbers from int 71234567689 to "+7 (123) 456789"
display long prices with spaces: "7 000 000" instead of ... | If you are using Django Rest Framework, then you can simply use serializers. But I don't think that is a case. What you want to accomplish seems very similar to the role of django forms, but as such they are only used (conventionally) for saving/updating models i.e. POST requests. Now either you can define a new class ... | 1.2 | true | 1 | 4,718 |
2017-02-08 01:58:10.193 | How to change Default Python for Salt in CentOS 7? | I am trying to setup a salt-master/salt-cloud on Centos 7. The issue that I am having is that I need Python 2.7.13 to use salt-cloud to clone vm in vmware vcenter (uses pyvmomi). CentOS comes with Python 2.7.5 which salt has a known issue with (SSL doesn't work).
I have tried to find a configuration file on the machine... | The salt packages are built using the system python and system site-packages directory. If something doesn't work right, file a bug with salt. You should avoid overwriting the stock python, as that will result in a broken system in many ways. | 0.386912 | false | 1 | 4,719 |
2017-02-08 06:03:09.490 | Microservices Communication Design | I would like to know how to create a communication for each services. I am using API Gateway for the outside of the system to communicate with the services within. Is it necessary for a service to call another service through API Gateway or just directly into the service itself ?
Thank You | Api gateway is not needed for Internal service to service communication
But, you need a service registry or some kind of dynamic load balancing mechanism to reach the services | 0 | false | 1 | 4,720 |
2017-02-08 08:40:58.823 | How to know the factor by which a feature affects a model's prediction | I have trained my model on a data set and i used decision trees to train my model and it has 3 output classes - Yes,Done and No , and I got to know the feature that are most decisive in making a decision by checking feature importance of the classifier. I am using python and sklearn as my ML library. Now that I have fo... | In general - no. Decision trees work differently that that. For example it could have a rule under the hood that if feature X > 100 OR X < 10 and Y = 'some value' than answer is Yes, if 50 < X < 70 - answer is No etc. In the instance of decision tree you may want to visualize its results and analyse the rules. With RF ... | 0 | false | 1 | 4,721 |
2017-02-08 16:42:43.060 | How to retrieve the filename of an image with keras flow_from_directory shuffled method? | If I don't shuffle my files, I can get the file names with generator.filenames. But when the generator shuffles the images, filenames isn't shuffled, so I don't know how to get the file names back. | I think the only option here is to NOT shuffle the files. I have been wondering this myself and this is the only thing I could find in the docs. Seems odd and not correct... | 0 | false | 1 | 4,722 |
2017-02-08 19:02:06.060 | Getting what I think is a part of the query string using python 2.7/CGI | I know I am using the wrong search terms and that's why I haven't been able to suss out the answer myself. However, I cannot seem to figure out how to use the CGI module to pull what I think counts as a query string from the url.
given a url www.mysite.com/~usr/html/cgi.py/desired/path/info how would one get the desire... | Thanks for all the help on what was actually not to complicated a question. What I was looking for was a router/dispatcher that is usually handled by a framework fairly simply though an @route or something similar. Opting for a more efficient approach all I had to do was import os and then look at os.environ.get('PATH_... | 0 | false | 1 | 4,723 |
2017-02-10 00:59:19.347 | How to plot data from different runs on one figure in Spyder | What I meant by the title is that I have two different programs and I want to plot data on one figure. In Matlab there is this definition for figure handle which eventually points to a specific plot. Let's say if I call figure(1) the first time, I get a figure named ''1'' created. The second I call figure(1), instead o... | One way that I have figured out is to define a dictionary and then record the results you want individually. Apparently, this is not the most efficient way, but it works. | 0 | false | 1 | 4,724 |
2017-02-10 03:54:25.713 | Is there a way to write over the python code after the interpretation? | This may be a dumb question, but I want to add a line at the very start of the code like
print 'previous runtime' time.time()-tic
Is there a way to do it? Or can I somehow get the previous runtime other than keeping a logfile? | No. It wouldn't be possible unless written somewhere. Simple reason is that once the python process ends, GC cleans up everything. | 0.201295 | false | 1 | 4,725 |
2017-02-10 10:23:40.963 | How to update model parameters with accumulated gradients? | I'm using TensorFlow to build a deep learning model. And new to TensorFlow.
Due to some reason, my model has limited batch size, then this limited batch-size will make the model has a high variance.
So, I want to use some trick to make the batch size larger. My idea is to store the gradients of each mini-batch, for exa... | You can use Pytorch instead of Tensorflow as it allows the user to accumulate gradients during training | -0.067922 | false | 1 | 4,726 |
2017-02-11 01:28:10.350 | Heroku: how to store a variable that mutates? | I have deployed a small application to Heroku. The slug contains, among other things, a list in a textfile. I've set a scheduled job to, once an hour, run a python script that select an item from that list, and does something with that item.
The trouble is that I don't want to select the same item twice in sequence. So... | Have to agree with @KlausD, doing what you are suggesting is actually a bit more complex trying to work with a filesystem that won't change and tracking state information (last selected) that you may need to persist. Even if you were able to store the last item in some environmental variable, a restart of the server wo... | 1.2 | true | 1 | 4,727 |
2017-02-11 18:11:31.733 | Counter Display Design | I am new to Python and took on a small project for the firehouse.
I am looking to make a "Calls YTD" Sign.
The initial thought was a raspberry Pi connected to the a touch screen.
After some playing around and learning how to use python a little I realized one very important fact... I am way over my head.
Looking for so... | For a gui you could always take a look into Tkinter.
You could test the gui without having the actual raspberry pi.
Switching to leds would require an LED matrix, which is more demanding in terms of electrical engineering. Raspberry pi would be my recommendation. | 0 | false | 1 | 4,728 |
2017-02-13 18:55:59.147 | MySQL Workbench can't edit a table that was created using Command Line | I have created a table in MySQL command line and I'm able to interact with it using python really well. However, I wanted to be able to change values in the table more easily so I installed MySQL workbench to do so.
I have been able to connect to my server but when I try to change any values after selecting a table, i... | Editing a table means to be able to write back data in a way that reliably addresses the records that have changed. In MySQL Workbench there are certain conditions which must be met to make this possible. A result set:
must have a primary key
must not have any aggregates or unions
must not contain subselects
When you... | 0 | false | 1 | 4,729 |
2017-02-14 02:02:59.853 | Installing python modules in production meteor app hosted with galaxy | I have a meteor project that includes python scripts in our private folder of our project. We can easily run them from meteor using exec, we just don't know how to install python modules on our galaxy server that is hosting our app. It works fine running the scripts on our localhost since the modules are installed on o... | It really depends on how horrible you want to be :)
No matter what, you'll need a well-specified requirements.txt or setup.py. Once you can confirm your scripts can run on something other than a development machine, perhaps by using a virtualenv, you have a few options:
I would recommend hosting your Python scripts as... | 0 | false | 1 | 4,730 |
2017-02-14 06:00:45.037 | Running python script from Google Apps script | I have a python script (on my local machine) that queries Postgres database and updates a Google sheet via sheets API. I want the python script to run on opening the sheet. I am aware of Google Apps Script, but not quite sure how can I use it, to achieve what I want.
Thanks | you will need several changes. first you need to move the script to the cloud (see google compute engine) and be able to access your databases from there.
then, from apps script look at the onOpen trigger. from there you can urlFetchApp to your python server to start the work.
you could also add a custom "refresh" menu... | 0.386912 | false | 1 | 4,731 |
2017-02-14 16:51:16.223 | How can I rename a conda environment? | I have a conda environment named old_name, how can I change its name to new_name without breaking references? | As the answer from @pkowalczyk mentioned some drawbacks: In my humble opinion, the painless and risk-free (workaround) way is following these steps instead:
Activate & Export your current environment conda env export > environment.yml
Deactivate current conda environment. Modify the environment.yml file and change the... | 0.386912 | false | 1 | 4,732 |
2017-02-14 22:01:29.857 | List dependencies in Python | What is the most efficient way to list all dependencies required to deploy a working project elsewhere (on a different OS, say)?
Python 2.7, Windows dev environment, not using a virtualenv per project, but a global dev environment, installing libraries as needed, happily hopping from one project to the next.
I've kep... | Scan your import statements. Chances are you only import things you explicitly wanted to import, and not the dependencies.
Make a list like the one pip freeze does, then create and activate a virtualenv.
Do pip install -r your_list, and try to run your code in that virtualenv. Heed any ImportError exceptions, match th... | 1.2 | true | 1 | 4,733 |
2017-02-15 01:20:05.417 | django-1.10 still contains deprecated and removed features | I am trying to run an existing django app. The app has been built in django-1.10. I set up a new virtualenv and installed the requirements and everything. However, I get errors like the following:
from django.utils import importlib
ImportError: cannot import name importlib
Now, the above is from the following source - ... | The problem was not with the Django-core but with django-user-accounts app that was included with pinax. Upgrading the django-user-accounts app fixed the issue.
Thanks to @Selcuk for the solution. | 1.2 | true | 1 | 4,734 |
2017-02-16 03:00:27.437 | Truncate PyHandle (win32file) | How do you truncate a PyHandle returned by win32file.CreateFile. I know you can open it with the TRUNCATE_EXISTING flag, but how do you truncate it to a specific size after reading/writing? Note: The reason I cannot use the standard library is because I'm using win32file to restrict simultaneous reading/writing to a fi... | Call win32file.SetEndOfFile(handle) after positioning the file handle to the offset that you want to be the new end of file. This is similar to the ftruncate POSIX system call, or writing 0 bytes in DOS. | 1.2 | true | 1 | 4,735 |
2017-02-16 03:28:07.990 | Apple Swift is overriding Openstack swift package | I have installed OpenStack swift python client (pip install python-swiftclient). However /usr/bin has swift executable (which I can not remove as it is owned by root) and is overriding python swift.
Requirement already satisfied: python-swiftclient in /Library/Python/2.7/site-packages
Requirement already satisfied: req... | For me, Apple Swift is under /usr/bin/swift and python-swiftclient is under /usr/bin/local/swift. Explicitly invoking it as /usr/bin/local/swift works. | 0.201295 | false | 1 | 4,736 |
2017-02-16 07:30:46.433 | How to use the package written by another language in AWS Lambda? | I want to import and use dataset package of python at AWS Lambda. The dataset package is about MySQL connection and executing queries. But, when I try to import it, there is an error.
"libmysqlclient.so.18: cannot open shared object file: No such file or directory"
I think that the problem is because MySQL client packa... | You should install your packages in your lambda folder :
$ pip install YOUR_MODULE -t YOUR_LAMBDA_FOLDER
And then, compress your whole directory in a zip to upload in you lambda. | 0 | false | 1 | 4,737 |
2017-02-16 10:32:31.903 | Running cronjob every 5 minutes but stopped after first execution? | I have python script that checks if the server is up or down, and if it's down it sends out an email along with few system logs.
What I want is to keep checking for the server every 5 minutes, so I put the cronjob as follows:
*/5 * * * * /python/uptime.sh
So whenever the server's down, it sends an email. But I want th... | Simple solution is, you can set some Bash env variable MONITORING=true and let your python script to check that variable using os.environ["MONITORING"]. If that variable is true then check if the server is up or down else don't check anything. Once server down is found, set that variable to false from script like os.en... | 1.2 | true | 2 | 4,738 |
2017-02-16 10:32:31.903 | Running cronjob every 5 minutes but stopped after first execution? | I have python script that checks if the server is up or down, and if it's down it sends out an email along with few system logs.
What I want is to keep checking for the server every 5 minutes, so I put the cronjob as follows:
*/5 * * * * /python/uptime.sh
So whenever the server's down, it sends an email. But I want th... | write an empty While True script that runs forever (ex: "mailtrigger.py")
run it with -nohup mailtrigger.py from shell in infinite loop
once the server is down check if mailtrigger.py is running, if its
not then terminate mailtrigger.py (kill process id)
your next iterations will not send mails since mailtrigger.py is... | 0 | false | 2 | 4,738 |
2017-02-16 13:02:01.840 | How to analyse 3d mesh data(in .stl) by TensorFlow | I try to write an script in python for analyse an .stl data file(3d geometry) and say which model is convex or concave and watertight and tell other properties...
I would like to use and TensorFlow, scikit-learn or other machine learning library. Create some database with examples of objects with tags and in future add... | You have to first extract "features" out of your dataset. These are fixed-dimension vectors. Then you have to define labels which define the prediction. Then, you have to define a loss function and a neural network. Put that all together and you can train a classifier.
In your example, you would first need to extract a... | 0.673066 | false | 1 | 4,739 |
2017-02-18 00:48:27.607 | Adding a vertical bar or other marker to tkinter Text widgets at a particular column | My intention is to add a vertical bar to IDLE to indicate preferred line length at column 80.
I have tried to find a configuration option for the Text tkinter widget that would allow this but have found nothing.
I was hoping it would be a simple configuration option so I could just add a another item the text_options d... | Outline of possible solution:
Create a 1-pixel wide Frame, with a contrasting background color, as a child of the Text.
Use .place() to position the Frame at an appropriate horizontal coordinate.
Possible issues:
I don't see any easy way to get the coordinate for a particular column. Text.bbox("1.80") looks promisi... | 1.2 | true | 1 | 4,740 |
2017-02-20 08:47:36.037 | CNTK 2 sorted minibatch sources | does anyone know how to create or use 2 minibatch sources or inputs a sorted way? My problem is the following:
I have images named from 0 to 5000 and images named 0_mask to 5000_mask. For each image x the coressponding image x_mask is the regression image for a deconvolution output. So i need a way to tell cntk that ea... | You can create two minibatch sources, one for x and one for x_mask, both with randomize=False. Then the examples will be read in the order in which they are listed in the two map files. So as long as the map files are correct and the minibatch sizes are the same for both sources you will get the images and the masks in... | 1.2 | true | 1 | 4,741 |
2017-02-21 02:51:26.793 | Draw rectangle in opencv with length and breadth in cms? | I know how to draw a rectangle in opencv.
But can I choose the length and breadth to be in centi meters? | Its dependent on the pixel-distance ratio. You can measure this by taking an image of a meter-stick and and measuring its pixel width (for this example say its 1000px). The ratio of pixels to distance is 1000px/100cm, or 10. You can now use this constant as a multiplier, so for a given length and width in cm., you will... | 0 | false | 1 | 4,742 |
2017-02-21 15:58:25.523 | Python/openpyxl get conditional format | I'm working on a Project with python and openpyxl.
In a Excel file are some cells with conditional formatting. These change the infillcolor, when the value changes. I need to extract the color from the cell.
The "normal" methode
worksheet["F11"].fill.start_color.index
doesn't work. Excel doesn't interpret the infillco... | This isn't possible without you writing some of your own code.
To do this you will have to write code that can evaluate conditional formatting because openpyxl is a library for the file format and not a replacement for an application like Excel. | 1.2 | true | 1 | 4,743 |
2017-02-24 19:04:13.963 | Allow a python file to add to a different file linux | I'm making a "wargame" like the ones on overthewire.org or smashthestack.org. When you finish the game, the user should get a python program that has extra permissions to edit a file in /var/www/html so that they can sign their name. I want to have a program like this so that they can add text to the html file with... | I'm going to answer your question but also beg you to consider another approach.
The functionality you are looking for is usually handled by a database. If you don't want to use anything more complex, SQLite is often all you need. You would then need a simple web application that connects to the database, grabs the fie... | 1.2 | true | 1 | 4,744 |
2017-02-27 04:42:03.763 | Error 193 %1 is not a valid Win32 application | I found this error [Error 193] %1 is not a valid Win32 application when i run this python command windll.LoadLibrary("C:\Windows\System32\plcommpro.dll")
For this error i found my plcommpro.dll file is not executable file.But I don't know how to make it as a executable file.If someone knows please share me.
Thanks and ... | If you are using a 32 bit Python and the DLL is a 64 bit DLL you will get this error, likewise if the DLL is 32 bit and your Python is 64 bit.
You can check this using the dumpbin /HEADERS <dll filepath> command from a visual studio command prompt. | 0.999988 | false | 1 | 4,745 |
2017-02-27 07:24:16.953 | Implement Gaussian Mixture Model using keras | I am trying to implement Gaussian Mixture Model using keras with tensorflow backend. Is there any guide or example on how to implement it? | Are you sure that it is what you want? you want to integrate a GMM into a neural network?
Tensorflow and Keras are libraries to create, train and use neural networks models. The Gaussian Mixture Model is not a neural network. | 0.995055 | false | 1 | 4,746 |
2017-02-27 10:25:17.957 | Pyautogui commands are working even when no mouse or keyboard is connected | I wrote a script with python-pyautogui to automate mouse and keyboard actions. Mouse and keyboard commands are working as per script when keyboard and mouse are connected. I wondered, it still works even when they are not connected. if so it is as per design, may i know how to set the condition to execute the script on... | PyAutoGUI will still work if there's no keyboard or mouse connected. However, PyAutoGUI does not have any way to detect if a keyboard or mouse are connected to your machine. | 1.2 | true | 1 | 4,747 |
2017-02-27 18:40:18.490 | In Django, is it possible for superusers to have different required fields than non-superusers? | I know that superusers and regular users are both just django's User objects, but how can I write a custom user class that requires some fields for plain users and doesn't require those fields for superusers? | You can have a profile class (say UserProfile) with foreign key to the user that is to be created only when user signs up using the website's registration form. That way, superuser which is created on admin site or through command line wouldn't need an extra profile instance attached to it. | 0.201295 | false | 1 | 4,748 |
2017-02-27 19:16:46.323 | Using Whoosh with a SQLITE3.db (Python) | Could someone give me an example of using whoosh for a sqlite3 database, I want to index my database. Just a simple connect and searching through the database would be great. I searched online and was not able to find an examples for sqlite3. | You need to add a post-save function index_data to your database writers. This post-save should get the data to be written in database, normalize it and index it.
The searcher could be an independent script given an index and queries to be searched for. | 0 | false | 1 | 4,749 |
2017-02-27 23:42:25.790 | PYSVN: how to set local working folder so I can commit a file? | After I get the pysvn client, how can I set the working folder to a specific local working folder belonging to a specific repo?
I'd like to set the working folder so i can then commit changes from there.
I have tried passing in the path to the client but that doesn't work. | The simplest way to call pysvn.Client().checkin() is with the absolute path to the working copy top folder. You should then see from svn log that all the changed files where committed.
By using an absolute path you avoid issues with the current working directory and relative paths.
If this does not help post details of... | 0 | false | 1 | 4,750 |
2017-02-28 04:06:13.170 | Run a python script as a background service in linux | I am currently using linux. I have a python script which I want to run as a background service such as the script should start to run when I start my machine.
Currently I am using python 2.7 and the command 'python myscripy.py' to run the script.
Can anyone give an idea about how to do this.
Thank you. | You can create init script in /etc/init/ directory
Example:
start on runlevel [2345]
stop on runlevel [!2345]
kill timeout 5
respawn
script
exec /usr/bin/python /path/to/script.py
end script
Save with .conf extension | 0 | false | 1 | 4,751 |
2017-02-28 10:47:39.583 | how to get unusual traffic or traffic information in SoftLayer using python API's | I would like to know how traffic flows in SoftLayer between the servers, In course of traffic flow how to detect unusual traffic and how to detect ports that are prone to unusual/malicious traffic. Can we retrieve this information using any SoftLayer python API's ? | that is not possbile using the Softlayer's API even using the Softlayer's control portal that information is not avaiable.
regards | 1.2 | true | 1 | 4,752 |
2017-02-28 17:14:39.963 | How to remove and add completly new db.sqlite3 to django project written in pycharm? | How to remove and add completly new db.sqlite3 database to django project written in pycharm?
I did something wrong and I need completelty new database. The 'flush' command just removes data from databse but it't dosent remove tables schema. So the question is how to get get back my databse to begin point(no data, no s... | A SQLite database is just a file. To drop the database, simply remove the file.
When using SQLite, python manage.py migrate will automatically create the database if it doesn't exist. | 1.2 | true | 1 | 4,753 |
2017-02-28 17:54:01.097 | Python - Selenium: Find / Click YT-Like Button | does anyone of you know how to find / click the YT-Like button in Python using selenium since it doesn't have a real Id, etc...
Thanks for the answers | you can select with CSS Selector like this:
if you want to like:
#watch8-sentiment-actions > span > span:nth-child(1) > button
if you want cancel like:
#watch8-sentiment-actions > span > span:nth-child(2) > button | 1.2 | true | 1 | 4,754 |
2017-03-01 03:30:28.803 | How Python data structure implemented in Spark when using PySpark? | I am currently self-learning Spark programming and trying to recode an existing Python application in PySpark. However, I am still confused about how we use regular Python objects in PySpark.
I understand the distributed data structure in Spark such as the RDD, DataFrame, Datasets, vector, etc. Spark has its own trans... | You can create traditional Python data objects such as array, list, tuple, or dictionary in PySpark.
You can perform most of the operations using python functions in Pyspark.
You can import Python libraries in Pyspark and use them to process data in Pyspark
You can create a RDD and apply spark operations on them | 1.2 | true | 1 | 4,755 |
2017-03-01 05:46:16.500 | how to install geckodriver on a windows system | I am trying to intall webdriver and in order to open firefox i need the geckodriver to be installed and in the correct path.
Firstly the download link to install geckodriver only allows you to install a file that is not an executable. So is there a way to make it an executable?
secondly I have tried to change my path v... | For one make sure you are downloading the one for your OS. Windows is at the bottom of the list it will say win32. Download that file or 64 doesn't matter.
After that you are going to want to extract the file. If you get an error that says there is no file in the Winrar file, this may be because in your Winrar settings... | 1.2 | true | 2 | 4,756 |
2017-03-01 05:46:16.500 | how to install geckodriver on a windows system | I am trying to intall webdriver and in order to open firefox i need the geckodriver to be installed and in the correct path.
Firstly the download link to install geckodriver only allows you to install a file that is not an executable. So is there a way to make it an executable?
secondly I have tried to change my path v... | I've wrestled with the same question for last hour.
Make sure you have the latest version of Firefox installed. I had Firefox 36, which, when checking for updates, said it was the latest version. Mozilla's website had version 54 as latest. So download Firefox from website, and reinstall.
Make sure you have the lat... | 0 | false | 2 | 4,756 |
2017-03-02 02:58:57.437 | how to show variable in Spyder Variable explore while debugging? | Spyder Variable explore only show variables when i run a python script. But while debugging, there is nothing in Spyder Variable explore.
how to set? | This was fixed in Spyder 3.2, which was released in July of 2017. | 1.2 | true | 1 | 4,757 |
2017-03-03 15:39:08.370 | Creating a online photo editor in Python | I am going to build an online photo editor using python, but I don't know how to start. My plan is to create a platform online. Users can upload their photos and the system can transform their photos into a style like Ukioyoe from Japan, the ancient wood printing, so the photo outcomes are similar to that. Is there any... | Online photo editor means that most of the processing will be done on the client side (i.e. in browser). Python is mostly a server-side language, so I would suggest using some other, more browser-friendly, language (perhaps, JavaScrip?) | 0 | false | 1 | 4,758 |
2017-03-03 15:46:27.173 | how to switch python interpreter in cmd? | I have installed both versions of python that is python 2.7 and python 3.5.3. When I run python command in command prompt, python 3.5.3 interpreter shows up. How can I switch to python 2.7 interpreter? | As has been mentioned in other answers to this and similar questions, if you're using Windows, cmd reads down the PATH variable from the top down. On my system I have Python 3.8 and 3.10 installed. I wanted my cmd to solely use 3.8, so I moved it to the top of the PATH variable and the next time I opened cmd and used p... | 0 | false | 5 | 4,759 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.