Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47,963,083 | 2017-12-24T18:22:00.000 | 0 | 0 | 1 | 0 | python,pandas,installation,anaconda,data-science | 50,020,866 | 4 | false | 0 | 0 | I have tried those options answered above. I think there was some problem with with Anaconda python 3.x versions. I used 2.7 and it worked fine there for me | 2 | 0 | 0 | Solving environment: failed
UnsatisfiableError: The following specifications were found to be in
conflict:
- wordcloud
- xlsxwriter Use "conda info " to see the dependencies for each package
.
Initially i get conflict with python 3.4 and python 3.6 so update python to 3.6 but still getting above erroe. Pls ... | Can't install wordcloud in anaconda | 0 | 0 | 0 | 1,411 |
47,963,083 | 2017-12-24T18:22:00.000 | -1 | 0 | 1 | 0 | python,pandas,installation,anaconda,data-science | 49,322,558 | 4 | false | 0 | 0 | In console :
conda install -c conda-forge wordcloud
First activate your python environment ! | 2 | 0 | 0 | Solving environment: failed
UnsatisfiableError: The following specifications were found to be in
conflict:
- wordcloud
- xlsxwriter Use "conda info " to see the dependencies for each package
.
Initially i get conflict with python 3.4 and python 3.6 so update python to 3.6 but still getting above erroe. Pls ... | Can't install wordcloud in anaconda | -0.049958 | 0 | 0 | 1,411 |
47,964,765 | 2017-12-24T23:52:00.000 | 0 | 0 | 0 | 0 | python,tensorflow,machine-learning,deep-learning | 48,297,553 | 1 | false | 0 | 0 | Are the cloud and local machines running the same Python/Tensorflow versions? Sometimes checkpoints produced by a specific Tensorflow version are not backward compatible due to internal variables renaming. | 1 | 0 | 1 | I've tried to create a custom object detector in the paperspace cloud desktop, then I tried it on Jupyter Notebook and it works.
Now, I've uploaded the whole models-master folder and downloaded it on my local machine.
I ran it using Jupyter Notebook and it now gives an InvalidArgumentError. I've tried re-exporting th... | Tensorflow trained model works on cloud machine but gives an error when used in my local pc | 0 | 0 | 0 | 665 |
47,965,021 | 2017-12-25T01:08:00.000 | 1 | 0 | 0 | 0 | python-3.x,opencv,cascade,assertion | 47,965,130 | 2 | false | 0 | 0 | I solved it haha. Even though I specified in the command the width and height to be 20x20, it changed it to 20x24. So the opencv_traincascade command was throwing an error. Once I changed the width and height arguments in the opencv_traincascade command it worked. | 1 | 1 | 1 | I keep getting this error
OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in get, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/apps/traincascade/imagestorage.cpp, line 157
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/apps/traincasc... | OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) | 0.099668 | 0 | 0 | 2,068 |
47,966,082 | 2017-12-25T05:57:00.000 | 0 | 0 | 0 | 0 | python,django,web-applications,video-embedding | 47,990,584 | 2 | true | 1 | 0 | Handling video files is much more complicated than dealing with images. There are two ways you can do it: you let users embed videos uploaded to other sites (like youtube) or you let them upload photos to your website. The first option is easier: most of the video websites offer some way to copy&paste a code to embed t... | 1 | 0 | 0 | I have a Django site that I want to add videos. Currently users can upload their photos and I want each user to be able to add their videos as well. I am not sure how to do this, since I am a beginner programmer. Can you please direct me to right way? | Video embedding | 1.2 | 0 | 0 | 93 |
47,966,943 | 2017-12-25T08:22:00.000 | 0 | 0 | 0 | 1 | python,console,pycharm | 47,967,440 | 1 | false | 0 | 0 | Because the console uses the port 51562 and 51563. So you might didnt exit a program correctly to cause the ports are still using. | 1 | 0 | 0 | More details:
Macbook Air 10.12.6 (16G1036);
Python version: python3.6
IDE: Pycharm 2017.3.1
Error:
Users/lrh/PycharmProjects/TensorFlowDemo/venv/bin/python /Applications/PyCharm.app/Contents/helpers/pydev/pydev_run_in_console.py 51562 51563 /Users/lrh/PycharmProjects/TensorFlowDemo/demo1.py
Error starting server with ... | When I use pycharm to run code, the error "OSError: [Errno 49] Can't assign requested address" happended. | 0 | 0 | 0 | 675 |
47,967,093 | 2017-12-25T08:46:00.000 | 1 | 0 | 1 | 0 | python-2.7,sympy,equation,equation-solving | 47,971,357 | 1 | false | 0 | 0 | Be aware that sympy.solve giving [] doesn't necessarily mean the equation has no solution. It only means it could not find any. Some equations have solutions but they cannot be expressed in closed form (like cos(x) = x). sympy.solveset will give you the full solutions but in cases where it can't tell it will just retur... | 1 | 1 | 0 | I want to know whether equation set has a solution, and I use solve(f)!=[] (python sympy) to achieve it. But I only need to know that whether there is a solution so I do not need to find all the solutions which will consume a lot of time. Is there any way to do it efficiently? | How to find out whether the equations have solutions effectively? | 0.197375 | 0 | 0 | 313 |
47,968,040 | 2017-12-25T11:09:00.000 | 2 | 1 | 0 | 0 | android,python,android-activity | 48,065,914 | 2 | false | 0 | 1 | Consider Jython, Jython is an implementation of the high-level, dynamic, object-oriented language Python seamlessly integrated with the Java platform. The predecessor to Jython, JPython, is certified as 100% Pure Java.
mbedded scripting - Java programmers can add the Jython libraries to
their system to allow end users... | 1 | 16 | 0 | I am collecting some data from my android application. How to run a python script in my android application that uses the collected data as input and generates some output? | Running Python Script from Android Activity | 0.197375 | 0 | 0 | 4,957 |
47,968,124 | 2017-12-25T11:20:00.000 | 0 | 0 | 1 | 0 | python,pip,installation | 47,968,167 | 1 | false | 0 | 0 | There might be a conflict with environment variables.
Try this
python2.7 -m pip install | 1 | 1 | 0 | how do I go about installing for python2.7 version only?
Right now when I run this : python -m pip install requests tweepy python-bittrex
It's only for python 3
I'd like to install for python 2
(I have both versions installed)
THanks | Python Pip Install For Specific Version | 0 | 0 | 0 | 236 |
47,970,844 | 2017-12-25T17:49:00.000 | 6 | 0 | 1 | 0 | python-3.x | 53,318,223 | 2 | false | 0 | 0 | 0 and 1 are exit codes.
exit code (0) means an exit without an errors or any issues, can be a compile time error or any dependency issue.
exit code (1) means there was some issue which caused the program to exit. For example if your program is running on port :8080 and that port is currently in used or not closed, the... | 2 | 15 | 0 | I am beginner in Python. I tried to develop a simple currency program but I have a problem. The program should calculate money when the calculate button is clicked(like an exchange). But I can't do it. PyCharm writes "Process finished with exit code 1" | What does "Process finished with exit code 1" mean? | 1 | 0 | 0 | 90,809 |
47,970,844 | 2017-12-25T17:49:00.000 | 30 | 0 | 1 | 0 | python-3.x | 47,970,971 | 2 | true | 0 | 0 | 0 and 1 are exit codes, and they are not necessarily python specific, in fact they are very common.
exit code (0) means an exit without errors or issues.
exit code (1) means there was some issue / problem which caused the program to exit.
The effect of each of these codes can vary between operating systems, but with Py... | 2 | 15 | 0 | I am beginner in Python. I tried to develop a simple currency program but I have a problem. The program should calculate money when the calculate button is clicked(like an exchange). But I can't do it. PyCharm writes "Process finished with exit code 1" | What does "Process finished with exit code 1" mean? | 1.2 | 0 | 0 | 90,809 |
47,972,613 | 2017-12-25T23:10:00.000 | 0 | 0 | 1 | 0 | python,pygame,pyc | 47,972,705 | 2 | true | 0 | 1 | Is is 'alright? Yes, the license allows you to distribute .pyc files.
Is is 'effective'? It will most likely be unnecessary, as there will be no commercial reason to copy your work. If it is super good, people will de-compile or write similar games in another language. See jonrsharpe's link.
Is is intended? The mai... | 1 | 2 | 0 | I have a Python project (a game) I would like to sell eventually. Would it be considered, by Python standards, acceptable to use a .pyc file instead of a regular .py source file to distribute the game, for security reasons? Would this even be effective? Or, on the other hand, is that just not what .pyc files are for? | Is it proper to use .pyc files? | 1.2 | 0 | 0 | 1,752 |
47,973,216 | 2017-12-26T01:43:00.000 | 0 | 0 | 1 | 0 | python,python-3.x | 47,973,889 | 3 | false | 0 | 0 | Can you try to run the import command on your Python Shell and let us know if you are able to import it successfully? | 2 | 2 | 1 | I installed the module factor-analyzer-0.2.2 but cannot import the function. My code is from factor_analyzer import FactorAnalyzer. I'm getting an error ModuleNotFoundError: No module named 'factor_analyzer'.
I'm using Python 3.6 and Jupyter notebook. Do you know why this does not work?
Thank you!! | Cannot import FactorAnalyzer from module factor-analyzer-0.2.2 | 0 | 0 | 0 | 5,421 |
47,973,216 | 2017-12-26T01:43:00.000 | 1 | 0 | 1 | 0 | python,python-3.x | 58,283,301 | 3 | false | 0 | 0 | Use the anaconda prompt to run the pip install factor-analyzer rather than termainal or powershell. I had the same problem and doing that solved it for me. | 2 | 2 | 1 | I installed the module factor-analyzer-0.2.2 but cannot import the function. My code is from factor_analyzer import FactorAnalyzer. I'm getting an error ModuleNotFoundError: No module named 'factor_analyzer'.
I'm using Python 3.6 and Jupyter notebook. Do you know why this does not work?
Thank you!! | Cannot import FactorAnalyzer from module factor-analyzer-0.2.2 | 0.066568 | 0 | 0 | 5,421 |
47,973,320 | 2017-12-26T02:11:00.000 | -4 | 0 | 0 | 0 | python,pymysql | 47,973,362 | 3 | false | 0 | 0 | It looks like you can create the database object and check if it has been created if it isn't created you can raise an exception
Try connecting to an obviously wrong db and see what error it throws and you can use that in a try and except block
I'm new to this as well so anyone with a better answer please feel free t... | 1 | 7 | 0 | I am using pymysql to connect to a database. I am new to database operations. Is there a status code that I can use to check if the database is open/alive, something like db.status. | How to check the status of a mysql connection in python? | -1 | 1 | 0 | 13,383 |
47,973,401 | 2017-12-26T02:33:00.000 | 0 | 0 | 0 | 1 | python,macos | 47,973,439 | 2 | false | 0 | 0 | using Automator, create an application that runs a shell script that runs python, and set the default application for opening .py files. | 1 | 0 | 0 | I know that you can do "chmod +x filename.py" to make the file executable on mac but is there a way I can change some setting so that happens by default when I create a filename with .py extension? | How do I make .py files executable by default on mac OS? | 0 | 0 | 0 | 299 |
47,978,664 | 2017-12-26T12:27:00.000 | 0 | 0 | 0 | 0 | python,hdf5,h5py | 47,985,532 | 2 | false | 0 | 0 | You can slice h5py datasets like numpy arrays, so you could work on a number of subsets instead of the whole dataset (e.g. 4 100000*10000 subsets). | 1 | 1 | 1 | I am engaged in analysing HDF5 format data for scientific research purposes. I'm using Python's h5py library.
Now, the HDF file I want to read is so large. Its file size is about 20GB and the main part of its data is 400000*10000 float matrix. I tried to read the data once, but my development environment Spyder was ter... | How to read data in HDF5 format file partially when the data is too large to read fully | 0 | 0 | 0 | 1,280 |
47,979,390 | 2017-12-26T13:36:00.000 | 8 | 0 | 0 | 0 | python,sqlalchemy,alembic | 47,979,603 | 1 | true | 1 | 0 | After you run your init. Open the env.py file and update context.configure, add version_table='alembic_version_your_name as a kwarg. | 1 | 4 | 0 | I am working with alembic and it automatically creates a table called alembic_revision on your database. How, do I specify the name of this table instead of using the default name? | Alembic, how do you change the name of the revision database? | 1.2 | 1 | 0 | 874 |
47,980,515 | 2017-12-26T15:20:00.000 | 0 | 0 | 0 | 0 | python,flask,flask-appbuilder | 47,981,099 | 1 | true | 1 | 0 | This can be accomplished by overriding the post_add function. If you want to modify the data before it is sent (which is what I wanted to do) that would be overriding the pre_add function. | 1 | 0 | 0 | Is there any way with Flask App builder to add post processing to after the form has been posted? For example, after the add form is submitted, I'd like to modify some of the data that has been sent.
I cannot for the life of me find anything in the docs, and I feel like this should be basic functionality.
Thanks | Flask App Builder - Post Processing Model View | 1.2 | 0 | 0 | 364 |
47,984,024 | 2017-12-26T21:46:00.000 | 0 | 1 | 1 | 0 | c#,python,python-3.x,visual-studio | 47,984,044 | 1 | false | 0 | 0 | No, it's still the same. Starting a process is a feature of the .NET language (code) and has nothing to do with Visual Studio. | 1 | 0 | 0 | I am new to Python and currently I have a Python project under VS2017 solution along with a C# project. I know the question has been asked before and the steps involved creating a process in C# and calling the Python.exe and pass in the *.pr file. However, with VS2017 and the integrated Python environment, I want to kn... | Invoke Python functions from C# in VS2017 | 0 | 0 | 0 | 48 |
47,985,369 | 2017-12-27T01:37:00.000 | 0 | 0 | 0 | 0 | python,mysql,django | 48,016,519 | 1 | true | 1 | 0 | about sorry
May the user anwered my question before had give me the right answer, but I did not get what they means.
what I choose
Finally I use the redis lock to ensure no repeating data.
The logic just below:
when I get the data,I try to use 'set(key,value.nx=True,ex=60)' to get a lock from redis.
If the answer is Tr... | 1 | 0 | 0 | background
I aim at overing a project which is made up of django and celery.
And I code two tasks which would sipder from two differnt web and save some data to database —— mysql.
As before, I do just one task, and I use update_or_create shows enough.
But when I want to do more task in different workers ,and all of th... | How to ensure no repeating datas when use django? | 1.2 | 0 | 0 | 47 |
47,988,087 | 2017-12-27T07:26:00.000 | 11 | 0 | 1 | 0 | python,dictionary,redis | 47,988,323 | 2 | false | 0 | 0 | No need to ask for forgiveness for asking a question! :) In fact, I just fielded a similar question from a colleague a couple of weeks ago.
Redis objects are very similar to familiar data structures that you're likely to see in lots of other programming languages. Redis hashes are fairly analogous to Python dictionarie... | 2 | 15 | 0 | So far in my all test cases it seems I could have also used python dictionary in place of redis.So I am not able to convince my self why Redis ?
Note:
I am new to Redis so please forgive me for such a naive question. | What is the difference between python native data structure "DICTIONARY" and "Redis" database? | 1 | 0 | 0 | 2,583 |
47,988,087 | 2017-12-27T07:26:00.000 | 10 | 0 | 1 | 0 | python,dictionary,redis | 47,988,263 | 2 | false | 0 | 0 | That's kinda like asking "everywhere I see mySQL database used, I could have just stored the data in a variable in the program, and written it to a text file when I wanted to power off; why do we bother with databases?"
A dictionary is a temporary key based data structure in your own program's memory. A redis cache i... | 2 | 15 | 0 | So far in my all test cases it seems I could have also used python dictionary in place of redis.So I am not able to convince my self why Redis ?
Note:
I am new to Redis so please forgive me for such a naive question. | What is the difference between python native data structure "DICTIONARY" and "Redis" database? | 1 | 0 | 0 | 2,583 |
47,988,332 | 2017-12-27T07:48:00.000 | 0 | 1 | 0 | 0 | python,imap | 47,988,655 | 1 | true | 0 | 0 | You must implement your proxy as a Man In The Middle attack. That means that there are two different SSL/TLS encrypted communication channels: one between the client and the proxy, one between the the proxy and the server. That means that either:
the client explicitely sets the proxy as its mail server (if only few se... | 1 | 0 | 0 | I would like to implement a transparent IMAPS (SSL/TLS) proxy from zero using python (pySocks and imaplib).
The user and the proxy are in the same network and the mail server is outside (example: gmail servers). All the traffic on port 993 is redirected to the proxy. The user should retrieve his emails using his favori... | Transparent IMAPs proxy | 1.2 | 0 | 1 | 221 |
47,988,983 | 2017-12-27T08:43:00.000 | 2 | 0 | 0 | 0 | python,machine-learning,neural-network,keras,keras-layer | 47,990,202 | 2 | true | 0 | 0 | input_dim=3 means that your data have 3 features which will be used to determine final result eg. if you want to determine what animal data refer to you could put width, height and color as data.
100 examples of different animals widths, heights and colors combinations allow neural network to adjust its parameters (lea... | 1 | 0 | 1 | I am using Keras for a project and I don't understand how Keras uses data input, that is to say how Keras reads our input data when creating the first layer.
For example:
model = Sequential()
model.add(Dense(10, activation='sigmoid', input_dim=3,name='layer1'))
In this model, what does it mean to have 10 neurons an... | How does Keras read input data? | 1.2 | 0 | 0 | 1,223 |
47,993,255 | 2017-12-27T13:42:00.000 | 0 | 0 | 0 | 1 | python,https,ansible,winrm | 48,159,688 | 2 | false | 0 | 0 | I too had this issue and ended up here.
Googling lead me to believe that this might be because third party root certificates on the windows host might have somehow been borked. Was it a bad update? Was it a dangerous user? Who knows! Who cares!
I did the following, and it resolved my connection issues:
1) Delete HKEY_L... | 1 | 0 | 0 | I tried to connect to my windows 7 machine using Ansible using credssp I'm recieving the error as below.
tls_server_hello,wrong_ssl_version.
Whereas when I tried the same in my windows 10 machine I'm able to do win_ping | Ansible HTTPS connection wrong SSL version | 0 | 0 | 0 | 3,609 |
47,997,038 | 2017-12-27T18:33:00.000 | 0 | 0 | 0 | 1 | python,windows,cmd | 47,997,108 | 2 | false | 0 | 0 | click start
in the run box type "cmd.exe"
in the terminal type "cd /path/to/my/prog"
then type "my_prog.exe"
output should be printing to the console ....
it should be noted you have not really supplied enough information to actually answer this question, but i think this should work as long as the exe is printing to ... | 1 | 0 | 0 | I have a game (.exe using python) that prints some console logs and I want to see these WHILE the game is running.
I have already seen solutions like:
cmd /k start.exe
but that only shows the console AFTER the game has stopped. I want it to be shown WHILE the game is running. Is this possible? Or is there some sort of ... | how to keep cmd line open to show console logs WHILE blender game engine runs | 0 | 0 | 0 | 425 |
47,999,716 | 2017-12-27T23:15:00.000 | 1 | 1 | 0 | 0 | python,bots,discord | 48,163,714 | 3 | true | 0 | 0 | you want to do this through oath2 using the url parameters | 1 | 0 | 0 | I am using discord.py to create my bot and I was wondering how to create roles/permissions specific to the bot?
What that means is when the bot enters the server for the first time, it has predefined permissions and role set in place so the admin of the server doesn't need to set a role and permissions for the bot.
I ... | How to create a role for a Discord Bot | 1.2 | 0 | 1 | 7,000 |
48,000,154 | 2017-12-28T00:22:00.000 | 3 | 0 | 1 | 1 | python,bash,python-3.x,exception | 48,000,173 | 1 | true | 0 | 0 | Python will always stop execution when an uncaught exception occurs.
It will print the traceback with information about the exception. | 1 | 0 | 0 | Is there a python3 equivalent to to the bash command set -e? That is, to stop execution as soon as an error occurs? Or does python already do this? | Is there a python3 equivalent to the bash command `set -e`? | 1.2 | 0 | 0 | 97 |
48,000,835 | 2017-12-28T02:12:00.000 | 0 | 1 | 0 | 1 | python,cron,raspberry-pi3,google-assistant-sdk | 50,710,220 | 1 | false | 0 | 0 | It is possible, but not directly, as I know.
I use IFTTT for that (check on youtube how easy it is).
The easiest way is to have public IP with your raspberry, but it is dangerous (see below for solution).
Log into ifttt.com and make an applet: Google Assistant Command to Webhook. It is a piece of cake. You will learn ... | 1 | 2 | 0 | I have installed the google assistant SDK on a raspberry pi 3 and have so far managed to get Spotify working, and managed to get IFTTT to run for lights. What I really want to know is whether it is possible to have google assistant run and interact with python scripts on the pi. By which I mean I have a script called s... | Google assistant to run python script | 0 | 0 | 0 | 1,796 |
48,003,535 | 2017-12-28T07:39:00.000 | 1 | 0 | 0 | 0 | python,tensorflow,machine-learning,computer-vision,deep-learning | 49,556,042 | 1 | false | 0 | 0 | Just use the sigmoid layer as the final layer. There's no need for any cross entropy when you have a single output, so just let the loss function work on the sigmoid output which is limited to the output range you want. | 1 | 0 | 1 | I want to make a neural network that has one single output neuron on the last layer that tells me the probability of there being a car on an image (the probability going from 0 - 1).
I'm used to making neural networks for classification problems, with multiple output neurons, using the tf.nn.softmax_cross_entropy_with_... | Neural network with a single out with tensorflow | 0.197375 | 0 | 0 | 430 |
48,003,638 | 2017-12-28T07:48:00.000 | 0 | 1 | 0 | 0 | python,unicode | 48,004,364 | 1 | false | 0 | 0 | So after much experimentation and for reasons I don't fully understand, the following code works:
print "%s" %("\xbf").decode("cp1252")
It's a workable solution so I'll call this one solved! | 1 | 0 | 0 | I've gone through about 20 threads but don't seem to be able to find an answer to what I hoped was a simple question!
I have a unicode-encoded byte "\xbf" which translates to a "¿" character.
If I encode the character as follows: u"¿".encode("cp1252") it outputs "\xbf". How can I return this back to a "¿" character f... | Unable to convert unicode byte to ASCII | 0 | 0 | 0 | 232 |
48,006,244 | 2017-12-28T10:59:00.000 | 0 | 1 | 0 | 0 | python-3.x,cron,raspberry-pi | 48,019,881 | 1 | true | 0 | 0 | While running cron job check any relative paths is given in your code, then either change it to absolute path or change the directory inside the script. Then only the cron job will take the attachment or anything that need to include into your script. | 1 | 1 | 0 | I've script in python that takes photos from raspberry camera and send mail with this photos. From command line everything works OK, script start do the jobs and finishes without errors.
I setup cron to execute script every 1 hour.
Every hour I get mail but without attachments.
Where or how can I check why script exe... | execute python script from cron don't send mail | 1.2 | 0 | 0 | 668 |
48,007,100 | 2017-12-28T11:58:00.000 | 0 | 0 | 1 | 0 | python,pyqt5,pyinstaller | 57,068,272 | 4 | false | 0 | 1 | If you using python 3.4 and pip refuses to install pyqt5
Download and install
Pyqt5 manually to %your python 3.4 dir%
Create directory
Go to %your python 3.4 dir%\Lib\site-packages\PyQt5 create directory Qt and then move plugins folder there.
Add plugins
Then you can add ('C:/Python34-32/Lib/site-packages/PyQt5/Qt/plu... | 1 | 10 | 0 | I am trying to bundle a PyQt project using Pyinstaller. I tried creating package using command pyinstaller --onedir Hello.py.
This creates dist folder and has Hello.exe. On running it gets the error: This application failed to start because it could not find or load the Qt platform plugin "windows"in "".
Reinstalling t... | Error: Could not find or load the Qt platform plugin "windows" - PyQt + Pyinstaller | 0 | 0 | 0 | 2,889 |
48,007,839 | 2017-12-28T12:49:00.000 | 0 | 1 | 1 | 0 | python,unit-testing,python-unittest | 48,013,158 | 2 | false | 0 | 0 | You can use pdb to debug this issue, in the test simply add these two lines to halt execution and begin debugging.
import pdb
pdb.settrace()
Now for good testing practice you want deterministic test results, a test that fails only sometimes is not a good test. I recommend mocking the random function and using data set... | 1 | 1 | 0 | For a specific program I'm working in, we need to evaluate some code, then run a unittest, and then depending on whether or not the test failed, do A or B.
But the usual self.assertEqual(...) seems to display the results (fail, errors, success) instead of saving them somewhere, so I can't access that result.
I have bee... | Python: How to access test result variables from unittest module | 0 | 0 | 0 | 978 |
48,008,791 | 2017-12-28T13:56:00.000 | 0 | 0 | 0 | 0 | python,django | 48,009,047 | 2 | false | 1 | 0 | Just realised that i was importing the models instead of the views.
the code above should be from reviews.views import * | 1 | 0 | 0 | So I have 2 apps for my django project. In the default mysite folder, you have the urls.py file. I cant seem to find out how to write all my urls for all the apps in just the one urls.py file.
I have tried this:
from reviews.models import *
however that isnt working.
Thanks for any help! | Django URLs from different apps in just the base one | 0 | 0 | 0 | 29 |
48,010,487 | 2017-12-28T15:54:00.000 | 1 | 1 | 0 | 0 | python,django | 48,010,534 | 1 | false | 1 | 0 | You should save your dependencies in a requirements.txt file and use pip to install the requirements as part of your Django app's deployment process.
Edit: smtplib is part of the standard lib, so it should be available out of the box. | 1 | 0 | 0 | I have imported "smtplib" in the code, and I doubt that the server won't have this installed. Is there a CDN for modules in python ? | What if the hosting Django server don't have the module I imported? | 0.197375 | 0 | 0 | 30 |
48,010,748 | 2017-12-28T16:13:00.000 | 22 | 0 | 1 | 1 | python | 48,010,814 | 1 | true | 0 | 0 | OS is python's standard library. So no need to download it. | 1 | 6 | 0 | I'm trying to install the os python module on Windows.
In a cmd console, I typed:
C:\Users\username> pip install os
Collecting os
Could not find a version that satisfies the requirement os (from versions: )
No matching distribution found for os
So I guessed the module was not available on Windows for some reasons, b... | How to install the os module on Windows? | 1.2 | 0 | 0 | 79,293 |
48,011,531 | 2017-12-28T17:10:00.000 | 2 | 0 | 1 | 1 | python,git,shell,github | 48,011,670 | 1 | true | 0 | 0 | None of those solutions are the right way to do it. When you need to patch a python code, because you want to add a feature or fix a bug, you should proceed as follows:
Solution 3
Find the project's main page (on github, gitlab or anywhere else), usually a lookup DDG or google or --help will point you the right direct... | 1 | 0 | 0 | Can somebody simply explain to me what is the correct workflow to download a GitHub code and work on it, quickly try tweaks and fixes ?
Solution 1
install the GitHub repo using pip
then python "functions" are called using shell commands, not in Python shell, but in the macOS shell.
This is clearly not the good solut... | How quickly set up a python environment to work and tweak a GitHub downloaded repo? | 1.2 | 0 | 0 | 46 |
48,012,824 | 2017-12-28T18:51:00.000 | 3 | 0 | 1 | 0 | python,python-3.x | 48,013,139 | 1 | true | 1 | 0 | The most important reason is performance: findall needs to find all occurences, so it searches the whole string. search just searches the string until it finds a match, so provided the pattern is present it will be faster. match just checks if the beginning of the string matches the pattern, so it probably doesn't need... | 1 | 2 | 0 | I have been learning python for some weeks. Presently I'm having some problems/questions with Python's re.findall().
In some books or videos they use re.search() seldom they use match(). In django documentation I read search finds the first match, and re.match finds a match at the beginning of a string.
But in all cas... | Why do not always use Python's re.findall instead of re.search | 1.2 | 0 | 0 | 317 |
48,013,449 | 2017-12-28T19:43:00.000 | 0 | 0 | 0 | 0 | python,leaflet,gtfs | 48,017,558 | 2 | false | 0 | 0 | The only alternative to using shapes.txt would be to use the stops along the route to define shapes. The laziest way would be to pick a single trip for that route, get the set of stops from stop_times.txt, and then get the corresponding stop locations from stops.txt.
If you wanted or needed to, you could get a more com... | 1 | 0 | 0 | I try to consume some GTFS Feeds and work with them.
I created a MySQL Database and a Python Script, which downloads GTFS - Files and import them in the right tables.
Now I am using the LeafLet Map - Framework, to display the Stops on the map.
The next step is to display the routes of a bus or tram line on the map.
In ... | Display GTFS - Routes on a Map without Shapes | 0 | 0 | 0 | 1,223 |
48,014,537 | 2017-12-28T21:21:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,security,anaconda | 48,022,958 | 2 | true | 0 | 0 | Are their security threats associated with leveraging Anaconda? If so, what specifically?
It depends on the environment. Do you have admin privileges ? How the global GPO policy looks like ? For example if you don't have an admin rights you can't do things like create a socket, access network stack on os level and vi... | 2 | 2 | 0 | There has been some back and forth between myself and the IT department of a company I recently began working regarding the installation of Python / Anaconda suite on my work PC. The IT department is making claims of security risks (with Anaconda) but I suspect it’s more of a matter of them not wanting to give me acce... | Security Issues with Anaconda? | 1.2 | 0 | 0 | 5,755 |
48,014,537 | 2017-12-28T21:21:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,security,anaconda | 48,015,112 | 2 | false | 0 | 0 | One could argue that any programming environment is a potential security risk.
But such an argument is rather unconvincing in any office environment where you will probably find a well-known office suite installed that comes with its own built-in programming environment! You can cause plenty of mayhem with VBA macros h... | 2 | 2 | 0 | There has been some back and forth between myself and the IT department of a company I recently began working regarding the installation of Python / Anaconda suite on my work PC. The IT department is making claims of security risks (with Anaconda) but I suspect it’s more of a matter of them not wanting to give me acce... | Security Issues with Anaconda? | 0 | 0 | 0 | 5,755 |
48,014,892 | 2017-12-28T21:59:00.000 | 1 | 1 | 0 | 0 | python,discord.py | 51,890,116 | 2 | false | 0 | 0 | Use a Raspberry Pi with an internet connection. Install all necessary components and then run the script in its terminal. Then, you can switch off the monitor and the bot will continue running. I recommend that solution to run the bot 24/7. If you don't have a Raspberry Pi, buy one (they're quite cheap), or buy a serve... | 2 | 0 | 0 | I recently made a music bot in my discord server but the problem I have is that I have to turn on the bot manually etc. and it goes offline when I turn off my computer. How can I make the bot stay online at all times, even when I'm offline? | How do I make my discord bot stay online | 0.099668 | 0 | 1 | 4,654 |
48,014,892 | 2017-12-28T21:59:00.000 | 0 | 1 | 0 | 0 | python,discord.py | 48,034,102 | 2 | false | 0 | 0 | You need to run the python script on a server, e.g. an EWS linux instance.
To do that you would need to install python on the server and place the script in the home directory and just run it via a screen. | 2 | 0 | 0 | I recently made a music bot in my discord server but the problem I have is that I have to turn on the bot manually etc. and it goes offline when I turn off my computer. How can I make the bot stay online at all times, even when I'm offline? | How do I make my discord bot stay online | 0 | 0 | 1 | 4,654 |
48,015,101 | 2017-12-28T22:20:00.000 | 0 | 0 | 0 | 0 | python,neural-network,keras,recurrent-neural-network | 48,015,138 | 1 | false | 0 | 0 | The number of goals would be an output, not an input. For example, you could build a model to predict how many goals each team would score...
If you used goals scored as an input, the model train to be incredibly simple and useless- just comparing the goals, ignoring all other inputs. | 1 | 0 | 1 | I want to do a neural network to predict who is going to win a soccer game. I have several features (like the team, the physical shape of the team, etc.) and an output, telling which team won (or if there was a die).
In my training, I want to add features like the number of goals these teams scored. The problem is that... | Neural Network: Extra features used for training but not for predicting new data | 0 | 0 | 0 | 26 |
48,016,091 | 2017-12-29T00:40:00.000 | 1 | 1 | 0 | 0 | python,amazon-web-services,aws-lambda,chalice | 50,925,535 | 6 | false | 1 | 0 | Fisrt, install unixODBC and unixODBC-devel packages using yum install unixODBC unixODBC-devel. This step will install everything required for pyodbc module.
The library you're missing is located in /usr/lib64 folder on you Amazon Linux instance.
Copy the library to your python project's root folder (libodbc.so.2 is ju... | 1 | 3 | 0 | I am trying to build a AWS Lambda function using APi Gateway which utlizes pyodbc python package. I have followed the steps as mentioned in the documentation. I keep getting the following error Unable to import module 'app': libodbc.so.2: cannot open shared object file: No such file or directory when I test run the Lam... | Unable to use pyodbc with aws lambda and API Gateway | 0.033321 | 1 | 0 | 6,014 |
48,016,206 | 2017-12-29T01:00:00.000 | 0 | 0 | 0 | 0 | python,excel,openpyxl | 49,428,497 | 4 | false | 0 | 0 | Currently what I do is in my template I create a dynamic data range that gets the data from the raw data sheet and then I set that named range to the tables data source. Then in the pivot table options there is a "refresh on open" parameter and I enable that. When the excel file opens it refreshes and you can see it ... | 2 | 6 | 0 | I have a file that has several tabs that have pivot tables that are based on one data tab. I am able to write the data to the data tab without issue, but I can't figure out how to get all of the tabs with pivot tables to refresh.
If this can be accomplished with openpyxl that would be ideal. | Using openpyxl to refresh pivot tables in Excle | 0 | 1 | 0 | 7,810 |
48,016,206 | 2017-12-29T01:00:00.000 | 1 | 0 | 0 | 0 | python,excel,openpyxl | 52,547,674 | 4 | false | 0 | 0 | If the data source range is always the same, you can set each pivot table as "refresh when open". To do that, just go to the pivot table tab, click on the pivot table, under "Analyze" - > Options -> Options -> Data -> select "Refresh data when opening the file".
If the data source range is dynamic, you can set a named... | 2 | 6 | 0 | I have a file that has several tabs that have pivot tables that are based on one data tab. I am able to write the data to the data tab without issue, but I can't figure out how to get all of the tabs with pivot tables to refresh.
If this can be accomplished with openpyxl that would be ideal. | Using openpyxl to refresh pivot tables in Excle | 0.049958 | 1 | 0 | 7,810 |
48,021,783 | 2017-12-29T11:18:00.000 | 0 | 0 | 0 | 0 | python-3.x,pygtk,glade | 48,027,204 | 1 | false | 0 | 1 | I think that is not posible to do dinamically.
As you know on Pygtk we load the glade file by this way wTree = gtk.glade.XML("localize.glade") only once time, and after that we have on scope the access to all tree of controls and componets.
If you have a window loaded, you can load another window, but not pull apart a ... | 1 | 3 | 0 | I made a GLADE file, a main window of type "GtkNotebook" and there are several pages in it (Window1 = Page1, Page2, Page3, Page4).
a) Is it possible, like a web-browser, to take one of this page and separate it from the main windows? Example Page4 taken away with the cursor would create a Windows2
b) If not (I could n... | GLADE & Pygtk: how to split dynamically windows? | 0 | 0 | 0 | 96 |
48,023,512 | 2017-12-29T13:40:00.000 | 1 | 0 | 0 | 0 | python,amazon-web-services,amazon-dynamodb | 48,023,965 | 1 | true | 1 | 0 | Generally speaking, using an auto-increment primary key is not going to be best practice. If you really want to do it, you could use a lambda function and another dynamodb table that stores the last used value, but you would be much better off picking a better primary key so that you don't run into performance problems... | 1 | 1 | 0 | I am working on python flask with Dynamo DB ,is there any functionality to auto increment the primary key in AWS Dynamo DB (like SQL.AUTOINCREMENT), Any suggestion on this? how to handle the AUTOINCREMENT Feature in AWS DynamoDB. | DynamoDB AutoIncrement Primary key Python flask | 1.2 | 1 | 0 | 923 |
48,025,594 | 2017-12-29T16:36:00.000 | 0 | 1 | 0 | 0 | python,api,dynamics-crm,exchange-server,exchangelib | 48,050,166 | 1 | false | 0 | 0 | How about using MS Flow? I have done similar thing before using MS Flow to transfer emails from CRM to an online email processing service and retrieving emails back to CRM. | 1 | 0 | 0 | I am looking for a way to automatically check contacts in Dynamics 365 CRM and sync them to mailcontacts in Exchange online distribution lists.
Does anyone have suggestions on where to start with this?
I was thinking of trying to use python scripts with the exchangelib library to connect to the CRM via API, check the C... | Syncing Dynamics CRM contacts to Exchange mailcontacts distribution lists | 0 | 0 | 1 | 76 |
48,026,111 | 2017-12-29T17:21:00.000 | 0 | 0 | 0 | 0 | python,amazon-web-services,pyspark,amazon-redshift,aws-glue | 50,180,152 | 5 | false | 0 | 0 | You need to modify the auto generated code provided by Glue. Connect to redshift using spark jdbc connection and execute the purge query.
To spin up Glue containers in redshift VPC; specify the connection in glue job, to gain access for redshift cluster.
Hope this helps. | 2 | 4 | 1 | I have created a Glue job that copies data from S3 (csv file) to Redshift. It works and populates the desired table.
However, I need to purge the table during this process as I am left with duplicate records after the process completes.
I'm looking for a way to add this purge to the Glue process. Any advice would be ... | AWS Glue Truncate Redshift Table | 0 | 1 | 0 | 4,214 |
48,026,111 | 2017-12-29T17:21:00.000 | 2 | 0 | 0 | 0 | python,amazon-web-services,pyspark,amazon-redshift,aws-glue | 65,486,258 | 5 | false | 0 | 0 | The link @frobinrobin provided is out of date, and I tried many times that the preactions statements will be skiped even you provide a wrong syntax, and came out with duplicated rows(insert action did executed!)
Try this:
just replace the syntax from
glueContext.write_dynamic_frame.from_jdbc_conf() in the link above to... | 2 | 4 | 1 | I have created a Glue job that copies data from S3 (csv file) to Redshift. It works and populates the desired table.
However, I need to purge the table during this process as I am left with duplicate records after the process completes.
I'm looking for a way to add this purge to the Glue process. Any advice would be ... | AWS Glue Truncate Redshift Table | 0.07983 | 1 | 0 | 4,214 |
48,026,159 | 2017-12-29T17:25:00.000 | 0 | 0 | 0 | 0 | python,django | 48,027,969 | 1 | false | 1 | 0 | You should check if in Setting/Languages & Frameworks/Django the option Enable Django Support if selected,
then you should check if the routes to Django Project Root, Settings and manage.py are set correctly.
regards | 1 | 0 | 0 | I am working in PyCharm professional version and I am not able to run Django server from PyCharm, though I can start it from cmd.
After starting the server from cmd, everything works fine, I can reach my urls and get a response.
When I am trying to do the same from Pycharm, first I get a windows error ("Python has stop... | Why does Django server crash in PyCharm professional? | 0 | 0 | 0 | 326 |
48,026,532 | 2017-12-29T18:01:00.000 | 2 | 0 | 1 | 0 | python,nlp,nltk,wordnet | 48,027,161 | 1 | true | 0 | 0 | The general task, as you've described it, is not possible from simple textual analysis of the input characters. English does not have consistent rules for handling words as they evolve. Yes, an excellent lemmatiser will solve the straightforward cases for you, those that can be discerned by applying transformations c... | 1 | 3 | 0 | I'd like to write a function same_base(word1, word2) that returns True when word1 and word2 are two English words derived from the same root word. I realize that words can have multiple senses; I want the algorithm to be overzealous, returning True whenever it is possible to view the words as originating from the same ... | Determining if two words are derived from the same root in Python | 1.2 | 0 | 0 | 633 |
48,027,878 | 2017-12-29T20:04:00.000 | 0 | 0 | 1 | 0 | python | 48,027,980 | 1 | false | 0 | 0 | Frozen binaries are not yet available for Python3. However, you can use the Api that allows you to run python code in C, but ideally, you would just use C to begin with. | 1 | 0 | 0 | How can you convert a python3 code to become executable. I am aware of py2exe program but its only for python2. Am asking if there is any program for python3 to exe | Conversion of Python code to executable | 0 | 0 | 0 | 67 |
48,028,570 | 2017-12-29T21:19:00.000 | 0 | 0 | 0 | 1 | python,ubuntu | 48,030,928 | 1 | false | 0 | 0 | If you want to say is: 'The process running in the terminal stopped, you want to run once in the second'.
Then: 1, you can find it by the up arrow in the cursor keys of your keyboard;
You can type 'sudo gedit ~/.bash_history' or 'history | less' in the terminal to see the history commands you entered.
If you want to sa... | 1 | 0 | 0 | how to keep the command to run if the process is auto-killed
example:
python3 "command"
then,
command running
if,
Killed (process killed or stop)
then,
run the early command | How to run a command if the process is Killed | 0 | 0 | 0 | 305 |
48,029,089 | 2017-12-29T22:26:00.000 | 0 | 0 | 1 | 0 | python,spyder,cv2 | 48,029,193 | 1 | false | 0 | 0 | As I know CV2 is python 2x related. When You use CV2 You need copy cv2.pyd file directly to python 2x site-packages. | 1 | 0 | 0 | I have Anaconda 3 installed (Python 3.6.3) and I am working on a project that uses the CV2 package in python. Now I am relatively new to python but I have been using this package (via "import cv2" command) in PyCharm with no problems. However, today, I wanted to give Spyder a try. I started using the IDE and everything... | Importing CV2 does not work in Spyder but works in PyCharm | 0 | 0 | 0 | 853 |
48,031,699 | 2017-12-30T06:48:00.000 | 0 | 0 | 1 | 0 | python,string,mode | 48,031,735 | 5 | false | 0 | 0 | You could always roll your own - if the list is sorted you can keep a running mode and only update it when a new value is presented with more occurrences. | 1 | 2 | 0 | example of list [1,1,2,2,4,5]
the modes are 1 and 2.
if i use the mode function in statistics package in python, I get an error saying that there is no unique mode.
But I want the lower mode i.e. "1" to be printed.
Thanks for your answers. | Select the mode with the lowest value | 0 | 0 | 0 | 1,292 |
48,031,800 | 2017-12-30T07:09:00.000 | 4 | 0 | 0 | 0 | python,django | 48,031,808 | 2 | false | 1 | 0 | instead of django-admin.py startproject projectname, use
django-admin startproject projectname
In windows, open folder where you want to create the project, point to empty space and press Shift and then right mouse click. Choose the option Open Command Window Here. Then in command window, just enter above command. | 1 | 1 | 0 | I tried of creating project in Windows. When I type django-admin.py startproject projectname it takes but it won't created in folder. Everything is installed and previous project also running fine. | How to create Django project in Windows? | 0.379949 | 0 | 0 | 1,446 |
48,031,855 | 2017-12-30T07:18:00.000 | 1 | 1 | 1 | 1 | python,condor | 61,310,906 | 1 | false | 0 | 0 | You can simply run an interactive job (basically just a job with sleep or cat as command) and do ssh_to_job to run it.
Generally you need to set-up your python environment on the compute node, it is best to have a venv and activate it inside your start script. | 1 | 1 | 0 | I am submitting a python script to condor. When condor runs it it gets
an import error. Condor runs it as
/var/lib/condor/execute/dir_170475/condor_exec.exe. If I manually copy
the python script to the execute machine and put it in the same place
and run it, it does not get an import error. I am wondering how to
debug ... | Debugging htcondor issue running python script | 0.197375 | 0 | 0 | 289 |
48,032,756 | 2017-12-30T09:48:00.000 | 2 | 0 | 0 | 1 | python,jenkins,build,continuous-deployment | 48,034,085 | 1 | false | 1 | 0 | Options 1) without using docker
Choose Free Style project when create jenkins job
Configure the Source code management section to tell jenkins where to fetch the source code,
Write the build commands you used by manual in build section.
If your jenkins slave not installed Python and jenkins server not support to in... | 1 | 3 | 0 | I want to build an existing Python web application in jenkins, just like building a java application using Maven.
Is it possible or not? if possible, please help me with necessary configurations to build and Continuous Deployment of the same application. | Building a Python Web application in jenkins | 0.379949 | 0 | 0 | 1,298 |
48,032,766 | 2017-12-30T09:48:00.000 | 0 | 0 | 1 | 0 | python,shell,ipython | 48,033,310 | 1 | false | 0 | 0 | Sounds like you might want the PgDn key. | 1 | 0 | 0 | I am running python 3.5 in the ipython interactive shell.
I used the %load magic command to continue my session, but the cursor was at the top and I am now having to scroll line by line to the bottom. Is there some keyboard shortcut in ipython that can get me to the bottom line?
I know there is the %run magic command,... | How to quickly go to bottom line of pasted code ipython shell | 0 | 0 | 0 | 159 |
48,036,741 | 2017-12-30T18:28:00.000 | 0 | 0 | 0 | 0 | python,pymc3 | 48,042,507 | 3 | false | 0 | 0 | Let step = pymc3.Metropolis() be our sampler, we can get the final acceptance-rate through
"step.accepted"
Just for beginners (pymc3) like myself, after each variable/obj. put a "." and hit the tab key; you will see some interesting suggestions ;) | 1 | 0 | 1 | Does anyone know how I can see the final acceptance-rate in PyMC3 (Metropolis-Hastings) ? Or in general, how can I see all the information that pymc3.sample() returns ?
Thanks | Acceptance-rate in PyMC3 (Metropolis-Hastings) | 0 | 0 | 0 | 551 |
48,039,657 | 2017-12-31T03:12:00.000 | 2 | 0 | 1 | 0 | python | 48,039,677 | 3 | false | 0 | 0 | You can try newlist = filter(lambda a: a > 0, [1, 2, 3]) or None or [i for i in original_list if i > 0] or None | 1 | 1 | 0 | I am wondering how I can take only positive values in a list in Python.
For example, if I have A = [1, 2, 3], it should return [1, 2, 3]
If I have A = [-1, 2, 3], it should return [2, 3]
if I have A = [-1, -2], it should return None
Thank you very much! | How to take only positive values in a list in Python? | 0.132549 | 0 | 0 | 20,880 |
48,040,573 | 2017-12-31T06:45:00.000 | 1 | 0 | 1 | 1 | python,macos,pip,kernel,atom-editor | 48,050,542 | 3 | false | 0 | 0 | Well although I am no Mac expert I've given it a shot anyway:
Yes you could but do you really want to risk it (or even do it)?
Mac-OS must rely on Python to fulfill something in the OS otherwise it would not come inbuilt. This means two things:
The Python installation will be minimal. By that I mean it will have thi... | 1 | 1 | 0 | I have read a bunch of posts here and on Google, but my question is far more basic than the answers: If Python(2.7) came pre-installed on my MacBook Pro (High Sierra), can I just do sudo easy_install pip (as suggested) from the command line--withOUT causing issues? I have a vague understanding of global/local installat... | How to install pip for a total newbie | 0.066568 | 0 | 0 | 442 |
48,040,767 | 2017-12-31T07:26:00.000 | 3 | 0 | 0 | 0 | python,firebase,flask,firebase-hosting | 48,040,899 | 1 | true | 1 | 0 | You don't need Firebase Hosting for using Firebase Functions, and as you mentioned Firebase Hosting is for static pages.
Firebase Functions are hosted on firebase (independent from Firebase Hosting for static pages), and currently don't support python.
For HTTP trigger Firebase Functions you simply make HTTP requests ... | 1 | 1 | 0 | I have a website that uses python/flask, and I know that firebase hosting is only for static websites, but I need to be able to use firebase cloud functions in my app, and that requires firebase hosting (please correct me if I am wrong). As node js is server side, but you can use it with firebase hosting, I was hopeful... | Can python/flask websites be hosted on firebase? | 1.2 | 0 | 0 | 9,781 |
48,041,129 | 2017-12-31T08:40:00.000 | 0 | 0 | 0 | 0 | python,django | 48,041,312 | 1 | true | 1 | 0 | A pure django solution would be:
create a form with three integer fields (say, num1, num2 and result)
in your view, populate num1 and num2 with the numbers to be added
render the form in your template (num1 and num2 fields should be read only)
the user enters the answer in the result field and submits the form
in your... | 1 | 0 | 0 | I've been thinking of this for a LONG time the past few days and can't figure out with my current toolset how to implement this in Django.
What I want is something that can be implemented trivially in Java for example, but how I'd do that on the web is much more difficult
The problem
I want to send data to a HTML templ... | Coding mental block with specific Django task | 1.2 | 0 | 0 | 131 |
48,041,557 | 2017-12-31T10:03:00.000 | 0 | 0 | 1 | 0 | python,pyinstaller | 48,041,611 | 2 | false | 0 | 0 | First try running the command from a command line (terminal) so you can see what happens. Not from inside any IDE.
If you created the script in a MSWindows environment, be sure your PATH includes the executable (or explicitly give the path to the script).
In Linux/Unix, be sure to enable execute permission for the scr... | 2 | 0 | 0 | I'm trying to learn how to use pyinstaller to make an executable. I wrote a little script in 2.7 as a test. Print 'test" and named it test-print. When I click on the executable in the Build folder a cmd screen flashes, and that all she wrote. I tried adding a x = raw_input('input something: ') hoping that would cause ... | pyinstaller -- script not found. | 0 | 0 | 0 | 1,732 |
48,041,557 | 2017-12-31T10:03:00.000 | 0 | 0 | 1 | 0 | python,pyinstaller | 48,043,401 | 2 | false | 0 | 0 | In pyinstaller the actual executable is located in the dist folder. I assume you did not use pyinstallers "--onefile" switch so once you finish compiling, navigate to dist then test-print. Afterwards look for test-print.exe in that folder. That is your executable. | 2 | 0 | 0 | I'm trying to learn how to use pyinstaller to make an executable. I wrote a little script in 2.7 as a test. Print 'test" and named it test-print. When I click on the executable in the Build folder a cmd screen flashes, and that all she wrote. I tried adding a x = raw_input('input something: ') hoping that would cause ... | pyinstaller -- script not found. | 0 | 0 | 0 | 1,732 |
48,041,979 | 2017-12-31T11:13:00.000 | 0 | 0 | 1 | 1 | windows,python-3.x,cx-freeze | 48,140,125 | 1 | false | 0 | 0 | The .exe output actually depends on the installation you are using (I'm assuming x64) so if you used an x86bit or x32bit Python installation it will output the bit version your installation is (I know both will run on x64 computers) and just freeze in the normal way.
Bear in mind that x32 works on x86, x64 as well so... | 1 | 0 | 0 | and thank you for your answer in advance. I am making a python program to automate something for my friend, and converted it into a .exe file with cx_Freeze so I could give it to him. But I have a x64 machine and he has a x86 machine. Can anyone please tell me how to make a x86 .exe file on my PC. I'm using Win 10 x64 ... | Making a x86 .exe on a x64 machine | 0 | 0 | 0 | 181 |
48,042,158 | 2017-12-31T11:44:00.000 | 0 | 1 | 0 | 1 | python,hotkeys | 48,042,519 | 1 | false | 0 | 0 | Some things to consider when trying to setup a hotkey to successfully execute any kind of command:
Each Operating System has its own ways to setup hotkeys and sometimes this may differ between distributions as well as between desktop managers.
Many of the relevant how-to-descriptions are easily found via regular searc... | 1 | 2 | 0 | I've created a simple script that executes a "moving mouse and keyboard" sequence. Although currently to get this to work I use a Shell (Idle) to run and that is to slow with boot up time and such.
Is there a way to have this python file on desktop och with a hotkey swiftly run the code? I tried doing it through termin... | Run Python script quickly via HotKey | 0 | 0 | 0 | 5,035 |
48,043,217 | 2017-12-31T14:20:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,numpy,64-bit | 48,043,323 | 3 | false | 0 | 0 | In Windows I use always this:
Rename the pip.exe to pip64.exe for example
Add python folder to Sys path if not exists.
You can use "pip64 install package_name" | 3 | 0 | 0 | I was having a memory error in Python with a program, I found out I had to upgrade my Python to 64 bit. I did that. I then copied all the files from the Lib/site-packages folder of the Python 32 bit and pasted it in the 64 bit folder. I did this so I wouldn't have to install the modules again for my program.
I ran the... | Using 32-bit and 64-bit Python - "NameError: global name 'numpy' etc. is not defined" | 0 | 0 | 0 | 302 |
48,043,217 | 2017-12-31T14:20:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,numpy,64-bit | 48,043,249 | 3 | false | 0 | 0 | For windows Shift-Right-Click on your 64-bit installation folder that has python.exe and select Open command window here. Then type python.exe -m pip install numpy in there and press Enter.
What this does is that it calls 64-bit python's pip to install numpy instead. | 3 | 0 | 0 | I was having a memory error in Python with a program, I found out I had to upgrade my Python to 64 bit. I did that. I then copied all the files from the Lib/site-packages folder of the Python 32 bit and pasted it in the 64 bit folder. I did this so I wouldn't have to install the modules again for my program.
I ran the... | Using 32-bit and 64-bit Python - "NameError: global name 'numpy' etc. is not defined" | 0 | 0 | 0 | 302 |
48,043,217 | 2017-12-31T14:20:00.000 | 1 | 0 | 1 | 0 | python,python-3.x,numpy,64-bit | 48,043,267 | 3 | false | 0 | 0 | I then copied all the files from the Scripts folder of the Python 32
bit and pasted it in the 64 bit folder. I did this so I wouldn't have
to install the modules again for my program.
That wasn't a good idea. There are executables in the Scripts folder that are not the same for 32-bit and 64-bit Python. You have t... | 3 | 0 | 0 | I was having a memory error in Python with a program, I found out I had to upgrade my Python to 64 bit. I did that. I then copied all the files from the Lib/site-packages folder of the Python 32 bit and pasted it in the 64 bit folder. I did this so I wouldn't have to install the modules again for my program.
I ran the... | Using 32-bit and 64-bit Python - "NameError: global name 'numpy' etc. is not defined" | 0.066568 | 0 | 0 | 302 |
48,043,363 | 2017-12-31T14:43:00.000 | 0 | 1 | 0 | 0 | python,discord,discord.py | 48,051,694 | 2 | false | 0 | 0 | As Wright has commented, this is against discord's ToS. If you get caught using a selfbot, your account will be banned. However, if you still REALLY want to do this, what you need to do is add/replace bot.run('email', 'password') to the bottom of your bot, or client.run('email', 'password') to the bottom depending on h... | 1 | 2 | 0 | Slack API provides you two options: use app as a bot and as a logged in user itself. I want to create App that will be working as a user and run channel commands. How can I do with discord.py? | How to login as user rather bot in discord server and run commands? | 0 | 0 | 1 | 8,029 |
48,047,793 | 2018-01-01T07:06:00.000 | 2 | 0 | 0 | 0 | python,tensorflow | 48,048,843 | 1 | false | 0 | 0 | The main benefit of using tf.Variables is you don't have to explicitly state what to optimize when you train a neural network. From the perspective of Machine Learning, Variables are network parameters (or weights) which have some initial value before training but get optimized during training (The gradients of the los... | 1 | 0 | 1 | I pretty much understand the concept of Variable in Tensorflow (I think) but I still haven't found them very useful. The main reason I read it is interesting to use them it's to later restore them, which might be handy in some cases, but you could achieve similar results using numpy.save for saving matrices and values,... | Are Tensorflow Variables essential? | 0.379949 | 0 | 0 | 52 |
48,049,253 | 2018-01-01T11:26:00.000 | 3 | 0 | 0 | 0 | linux,python-2.7,pygtk,python-3.6,pycairo | 49,293,259 | 8 | false | 0 | 1 | install cairocffi, and
replace import cairocffi with import cairocffi as cairo. | 5 | 9 | 0 | I get the following error when trying to import gtk in Python 2.7 :
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gtk/__init__.py", line 40, in <module>
from gtk import _gtk
File "/usr/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
from ._... | Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index | 0.07486 | 0 | 0 | 7,143 |
48,049,253 | 2018-01-01T11:26:00.000 | 0 | 0 | 0 | 0 | linux,python-2.7,pygtk,python-3.6,pycairo | 50,362,423 | 8 | false | 0 | 1 | For me,
ldd /usr/lib64/python3.6/site-packages/cairo/_cairo.cpython-36m-x86_64-linux-gnu.so
showed:
libcairo.so.2 => /usr/local/lib/libcairo.so.2
I had a stale self-compiled cairo installation. If you still have the original compile tree, you can run make uninstall within it. Otherwise, simply move the offending cairo... | 5 | 9 | 0 | I get the following error when trying to import gtk in Python 2.7 :
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gtk/__init__.py", line 40, in <module>
from gtk import _gtk
File "/usr/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
from ._... | Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index | 0 | 0 | 0 | 7,143 |
48,049,253 | 2018-01-01T11:26:00.000 | 5 | 0 | 0 | 0 | linux,python-2.7,pygtk,python-3.6,pycairo | 55,534,650 | 8 | false | 0 | 1 | I just shifted on older version of pycairo. Try downloading version 1.11.0.
pip uninstall pycairo pip install pycairo==1.11.0
You can do shift on other versions available too.
At this time; they are:-
1.11.0, 1.11.1, 1.12.0, 1.13.0, 1.13.1, 1.13.2, 1.13.3, 1.13.4, 1.14.0, 1.14.1, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4... | 5 | 9 | 0 | I get the following error when trying to import gtk in Python 2.7 :
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gtk/__init__.py", line 40, in <module>
from gtk import _gtk
File "/usr/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
from ._... | Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index | 0.124353 | 0 | 0 | 7,143 |
48,049,253 | 2018-01-01T11:26:00.000 | 0 | 0 | 0 | 0 | linux,python-2.7,pygtk,python-3.6,pycairo | 58,881,631 | 8 | false | 0 | 1 | I find that the root error is not finding the py3cairo.h
just locate py3cairo.h, and ln -s /usr/include/pycairo/py3cairo.h /usr/include/py3cairo.h
then the compilation works without error. | 5 | 9 | 0 | I get the following error when trying to import gtk in Python 2.7 :
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gtk/__init__.py", line 40, in <module>
from gtk import _gtk
File "/usr/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
from ._... | Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index | 0 | 0 | 0 | 7,143 |
48,049,253 | 2018-01-01T11:26:00.000 | 2 | 0 | 0 | 0 | linux,python-2.7,pygtk,python-3.6,pycairo | 53,972,647 | 8 | false | 0 | 1 | I'm using conda and I have same issue, but path are little bit different due to conda env:
ImportError: /home/juro/anaconda3/envs/py37/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index
$ ldd /home/juro/anaconda3/envs/py37/lib/python3.7/site-packages/cair... | 5 | 9 | 0 | I get the following error when trying to import gtk in Python 2.7 :
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "gtk/__init__.py", line 40, in <module>
from gtk import _gtk
File "/usr/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
from ._... | Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index | 0.049958 | 0 | 0 | 7,143 |
48,054,962 | 2018-01-02T02:33:00.000 | 1 | 0 | 1 | 0 | python,main,pep8 | 48,055,377 | 2 | true | 0 | 0 | There are no official guidelines referring to this. | 2 | 1 | 0 | What are the official guidelines for the location of the main method in a Python program?
Should it be written first (at the top of the program), last (at the bottom), or is it just preferential? I read through PEP8 and couldn't find anything. | Python Main Method Location Convention | 1.2 | 0 | 0 | 176 |
48,054,962 | 2018-01-02T02:33:00.000 | 1 | 0 | 1 | 0 | python,main,pep8 | 48,055,466 | 2 | false | 0 | 0 | Whatever is most useful for someone to read first should go first.
Often, this is going to be some kind of "main" method. It describes the flow of the program. It will give developers a quick way of figuring out what is happening and where to look for things they want.
But I can envisage cases where it's not explicitly... | 2 | 1 | 0 | What are the official guidelines for the location of the main method in a Python program?
Should it be written first (at the top of the program), last (at the bottom), or is it just preferential? I read through PEP8 and couldn't find anything. | Python Main Method Location Convention | 0.099668 | 0 | 0 | 176 |
48,056,052 | 2018-01-02T05:39:00.000 | 0 | 0 | 0 | 0 | python,python-3.x,selenium | 69,779,987 | 3 | false | 0 | 0 | use "http://" in url
that works for me | 1 | 11 | 0 | I am trying to access the internet with Google Chrome but every time I use webbrowser.open(url) it opens IE.
So I checked to make sure I have Chrome as my default, which I do, and I tried using the get() function to link the actual Chrome application but it gives me this error instead:
File "C:\Users\xxx\AppData\Local... | webbrowser.get — could not locate runnable browser | 0 | 0 | 1 | 24,477 |
48,060,354 | 2018-01-02T11:43:00.000 | 1 | 0 | 0 | 0 | python,mongodb,flask | 54,701,902 | 5 | false | 1 | 0 | This works for me:
sudo pip3 uninstall pymongo
sudo apt-get install python3-pymongo
I hope that works for someone else, regards. | 1 | 10 | 0 | I am trying to build an application with mongoDB and Python Flask. While running the application, I am getting below error:
ConfigurationError: Server at 127.0.0.1:27017 reports wire version 0,
but this version of PyMongo requires at least 2 (MongoDB 2.6).
Can any one help me in this?
Thanks,
Balwinder | ConfigurationError: Server at 127.0.0.1:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6) | 0.039979 | 1 | 0 | 25,842 |
48,062,744 | 2018-01-02T14:28:00.000 | 1 | 0 | 0 | 1 | python,websocket,tornado | 48,070,341 | 1 | true | 1 | 0 | Tornado's websocket implementation handles pings automatically (and so do most other implementations). You shouldn't have to do anything.
Tornado's ping timeout defaults to 3 times the ping interval, so if you're getting cut off after 60 seconds instead of 180 seconds, something else is doing it. Some proxies have a 60... | 1 | 1 | 0 | I have written a websocket server in tornado and i used websocket_ping_interval=60 to detect which connection is really closed after 60 sec. but after 60 sec the server disconnects the link(even if it's been disconnected). i think this is done because the server sends a ping packet each 60sec and the client doesn't res... | how to response to the server ping in tornado websocket | 1.2 | 0 | 1 | 720 |
48,062,763 | 2018-01-02T14:30:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,database | 48,063,653 | 1 | false | 1 | 0 | If you want to learn and use MySQL, then start without anything above it - no Django, no ORM, not even a Python script. Learn to configure your mysql server (the server process I mean - doesn't have to be on a distinct computer), to work with the command-line mysql client (database creation, tables creations / modifica... | 1 | 0 | 0 | I am leaning Python programming language. I have no problems with Python. I read Python official docs, and I can write small programs in Python. I want to familiarize myself with mysql database because it is useful in learning software development concepts. I've installed mysql database and Django on my computer. I ha... | Django to create and change mysql database for learning purposes | 0.197375 | 1 | 0 | 67 |
48,064,686 | 2018-01-02T16:41:00.000 | 0 | 1 | 0 | 0 | python,c,swig,cudd | 48,671,922 | 2 | false | 0 | 1 | I still forget what my problem was before. However, I have found that what was causing my problem here was a linker issue - the linker was looking at an old version of the library, which did not have my changes. | 1 | 0 | 0 | I am currently using PyCUDD, which is a SWIG-generated Python wrapper for the C package CUDD. I'm currently trying to get CUDD to print some debug information from inside the C code, but any printfs inside the C code don't seem to be producing any output - putting them in the .i files for SWIG produces output, putting ... | Make printf appear in stdout from shared object library | 0 | 0 | 0 | 861 |
48,064,949 | 2018-01-02T17:00:00.000 | 0 | 0 | 0 | 0 | python,pygame | 48,065,090 | 1 | false | 0 | 1 | Are you on windows?
The problem is not in Python or Pygame itself, but rather in Windows. It seems sound enhancements are somehow fiddling with the way the sound my script is playing (or any other Pygame script for that matter).
I'm on Windows 10 and this is how I did it:
1.Right click on the speaker icon in the taskba... | 1 | 0 | 0 | I can't seem to set the volume of a channel to 0 in one ear. (I initiated the mixer with stereo). I did pygame.mixer.Channel(channel).set_volume(0,volume) and it seems to play at about half-ish volume on the left and full volume on the right. Any clue what I'm doing wrong? | Pygame Can't Set Volume to 0 | 0 | 0 | 0 | 158 |
48,065,753 | 2018-01-02T18:09:00.000 | 0 | 0 | 0 | 0 | python,sql,pandas,sorting,group-by | 48,071,714 | 1 | false | 0 | 0 | Here is the answer to it-
Grouping is done when you want to pull out the conclusion based on the entire group , like total of sales done,for each of the groups(in this case John and Amy) . It is used mostly with an aggregate function or sometimes to select distinct records only. What you wrote above is sorting the data... | 1 | 0 | 1 | I have two columns, one is a string field customer containing customer names and the other is a numeric field sales representing sales.
What I want to do is to group data by customer and then sort sales within group.
In SQL or Pandas, this is normally achieved by something like order by customer, sales on the table. Bu... | Sort by two columns, why not do grouping first? | 0 | 1 | 0 | 119 |
48,068,694 | 2018-01-02T22:26:00.000 | 3 | 0 | 1 | 0 | python,python-multiprocessing | 48,068,944 | 1 | false | 0 | 0 | Instances are not passed between processes, because instances are per Python VM process.
Values passed between processes are pickled. Unpickling normally restores instances by measures other than calling __init__; As far as I can tell it directly sets attribute values to resurrect an instance, and resolves references ... | 1 | 3 | 0 | If I pass in a reference to an instance method instead of a module level method into multiprocessing.Process, when I call it's start method is an exact copy of the parent process instance passed in or is the constructor called again? What happens with 'deep' instance member objects? Exact copy or default values? | passing in an instance method into a python multiprocessing Process | 0.53705 | 0 | 0 | 463 |
48,072,932 | 2018-01-03T07:24:00.000 | 0 | 0 | 1 | 1 | python,python-3.x,atom-editor | 48,120,307 | 1 | false | 0 | 0 | To enable Atom to run python 3, using the script plugin, make the first line of your script be the path to your python3 interpreter. I can use script to run either python 2.7.13 or python 3.6 by changing first line of my script #!path-to-python2 to #!path-to-python3. I just checked this and it worked as described. | 1 | 0 | 0 | When I use the Script package for Atom to run code in python3, or any package to run code for that matter, I get an error message that says:
'python3' is not recognized as an internal or external command,
operable program or batch file.
I've changed the python.coffee file from python to python3 and neither have worked. | Difficulties with python3 and Atom | 0 | 0 | 0 | 511 |
48,076,009 | 2018-01-03T10:58:00.000 | 1 | 0 | 1 | 0 | python,macos,opencv | 48,076,093 | 2 | false | 0 | 0 | Package name is wrong pip install opencv-python Should work. | 2 | 0 | 1 | I am having trouble running a python script file that contains import opencv command. Upon running the file, it gives the following error:
ImportError: No module named cv2
I then ran pip install python-opencv but it gave Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching... | ImportError: No module named cv2 error upon running .py file in terminal | 0.099668 | 0 | 0 | 542 |
48,076,009 | 2018-01-03T10:58:00.000 | 0 | 0 | 1 | 0 | python,macos,opencv | 48,076,121 | 2 | false | 0 | 0 | I also had this issue. Tried different things. But finally
conda install opencv
solved the issue for me. | 2 | 0 | 1 | I am having trouble running a python script file that contains import opencv command. Upon running the file, it gives the following error:
ImportError: No module named cv2
I then ran pip install python-opencv but it gave Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching... | ImportError: No module named cv2 error upon running .py file in terminal | 0 | 0 | 0 | 542 |
48,077,808 | 2018-01-03T12:51:00.000 | 1 | 0 | 1 | 0 | python,conda | 48,077,850 | 1 | true | 0 | 0 | I would definitely suggest to go for miniconda or anaconda, as you already said yourself, since it allows you to keep different Python versions separated in different environments.
I cannot really give you advice on the editor to use, since I always use Spyder. It takes some time to get used to, but it very versatile a... | 1 | 0 | 0 | I recently switched jobs and have the oportunity to create a clean programming working environment, cleaner and better than I used to have before. In my previous work I had some problems with running different versions of python next to eachother (or different versions of package) so I thought it would be a good idea t... | Clean install of python working environment | 1.2 | 0 | 0 | 376 |
48,080,579 | 2018-01-03T15:42:00.000 | 3 | 0 | 0 | 0 | python,django,database | 48,080,725 | 1 | true | 1 | 0 | As with anything performance-related, do some testing and profile your application. Don't get lured into the premature optimization trap.
That said, given the fact that these statistics don't change, you could perform them asynchronously each time you do a scrape. Like the scrape process itself, this calculation proces... | 1 | 2 | 0 | I'm working on a Django application that consists of a scraper that scrapes thousands of store items (price, description, seller info) per day and a django-template frontend that allows the user to access the data and view various statistics.
For example: the user is able to click on 'Item A', and gets a detail view t... | Django - when best to calculate statistics on large amounts of data | 1.2 | 0 | 0 | 562 |
48,081,209 | 2018-01-03T16:20:00.000 | 1 | 0 | 0 | 1 | python,linux,openpyxl | 48,085,163 | 2 | false | 0 | 0 | If you read the help for pip, you'll see that there is an option for installing pre-release versions: `pip install --pre openpyxl' | 1 | 2 | 0 | I need to install openpyxl 2.5 on a new server. When I run "pip3 install openpyxl" it installs 2.4.9. There are features in 2.5 that are required for what I'm working on.
I have been able to get 2.5 on my Mac because I can download the source and simply copy/paste it where it needs to go. However, I'm just not exp... | Installing openpyxl 2.5 | 0.099668 | 0 | 0 | 1,554 |
48,081,688 | 2018-01-03T16:50:00.000 | 5 | 1 | 1 | 0 | python,hash,sha | 48,081,802 | 2 | false | 0 | 0 | Calling .digest() on a hashlib.sha256 object will return a 32-byte string -- the shortest possible way (with 8-bit bytes as the relevant unit) to store 256 bits of data which is effectively random for compressibility purposes.
Since 8 * 32 == 256, this provably has no wastage -- every bit is used. | 1 | 2 | 0 | What is the most dense way (fewest characters) that I can store a complete SHA-256 hash? | In Python, represent a SHA-256 hash using the fewest characters possible | 0.462117 | 0 | 0 | 1,624 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.