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
27,934,885
2015-01-14T02:25:00.000
-1
0
1
0
javascript,ipython,ipython-notebook
38,215,176
22
false
0
0
With all the solutions above even though you're hiding the code, you'll still get the [<matplotlib.lines.Line2D at 0x128514278>] crap above your figure which you probably don't want. If you actually want to get rid of the input rather than just hiding it, I think the cleanest solution is to save your figures to disk i...
1
187
0
I have an ipython/jupyter notebook that I visualize using NBviewer. How can I hide all the code from the notebook rendered by NBviewer, so that only the output of code (e.g. plots and tables) and the markdown cells are shown?
How to hide code from cells in ipython notebook visualized with nbviewer?
-0.009091
0
0
202,330
27,935,745
2015-01-14T04:11:00.000
1
0
0
0
python,openerp,odoo
28,070,202
9
false
1
0
You can use a private browser session to access the Database menu, from the login screen, and perform the the backup form there (you need to know the master password to access that, defined in the server configuration file).
1
13
0
I need to backup the current db while logged into odoo. I should be able to do it using a button, so that suppose I click on the button, it works the same way as odoo default backup in manage databases, but I should be able to do it from within while logged in. Is there any way to achieve this? I do know that this is p...
Backup Odoo db from within odoo
0.022219
1
0
4,840
27,936,012
2015-01-14T04:43:00.000
2
0
0
0
python,django,django-admin
27,936,097
2
true
1
0
You can code the "member area" to be much more user-friendly than Django's admin, inevitably very general purpose. You can carefully restrict exactly what a user can change, saving them from mistakes that could be damaging and hard to fix, add more sanity checks too. All in all, I'd say that, while more work, coding y...
2
0
0
Maybe my question can sound a little bit stupid but it's a real one. I'm doing an ecommerce website, so as an admin I directly use the one provided by django, to manage my article and user. But, what's the best for my user? Should I let them use the admin panel to manage their profile? (I saw I can manage who can do wh...
Should I allow users to manage their profile using the admin application?
1.2
0
0
50
27,936,012
2015-01-14T04:43:00.000
0
0
0
0
python,django,django-admin
28,121,019
2
false
1
0
Alternatively, you can make these users as 'superusers' in admin, to manage. And you can override view in admin to make it more friendly. Good luck!
2
0
0
Maybe my question can sound a little bit stupid but it's a real one. I'm doing an ecommerce website, so as an admin I directly use the one provided by django, to manage my article and user. But, what's the best for my user? Should I let them use the admin panel to manage their profile? (I saw I can manage who can do wh...
Should I allow users to manage their profile using the admin application?
0
0
0
50
27,937,988
2015-01-14T07:43:00.000
5
0
1
0
python,python-3.x,pycharm
27,939,054
2
false
0
0
The import does work. When PyCharm said No module named time, I assumed I would get a compiler error and started trying to fix it. However when I eventually just ran the code it worked fine. I expect PyCharm doesn't detect the time module as it's a dll and not a py as noted by Martijn in the comments. This is on PyCha...
1
5
0
When I try to import time I get : No module named time I have tried other time modules(datetime and timeit) and they work fine. I decided to check my installation and I can't find time.py anywhere. I checked the Lib, Scripts, libs and include folders, but can't find it anywhere. Anyone know what I can do to fix this? M...
Python 3.3.5 time module missing
0.462117
0
0
3,095
27,939,109
2015-01-14T09:03:00.000
0
0
1
0
python,exception-handling
27,939,203
2
false
0
0
You can create another exception type in A/B or catch all exceptions (which is not really good).
2
0
0
I have a module which imports psycopg2. Call this module A I have a second module, B which imports module A. If psycopg2 throws a custom exception (which is not handled by A), such as psycopg2.OperationalError, How can I handle the exception in module B without having to import psycopg2? Do I need to create some kind ...
Python catch exceptions from secondary module
0
0
0
73
27,939,109
2015-01-14T09:03:00.000
0
0
1
0
python,exception-handling
27,939,152
2
false
0
0
Yes, rethrowing the exception as a different class defined in module A is a very good way to solve this.
2
0
0
I have a module which imports psycopg2. Call this module A I have a second module, B which imports module A. If psycopg2 throws a custom exception (which is not handled by A), such as psycopg2.OperationalError, How can I handle the exception in module B without having to import psycopg2? Do I need to create some kind ...
Python catch exceptions from secondary module
0
0
0
73
27,940,829
2015-01-14T10:31:00.000
1
0
1
0
python-2.7,kivy
27,944,595
1
false
0
0
I have tried directly importing the kivy.Config module at various different points in the runtime (before the Kivy App is built, during, after). If this is to work, it should be before anything else is imported. Also, kivy is probably looking for the config file in ~/.kivy/config.ini.
1
0
0
I am working on Ubuntu 14.04 64bit. Default python 2.7.x package. Custom built Kivy (rather, it is not the kivy supplied in the repositories. I used pip to gather dependencies and build Kivy in a Virtualenv) For some reason, I seem to have no control over a large portion of my runtime Configuration. I have tried using ...
Kivy Configuration Ignored
0.197375
0
0
847
27,945,764
2015-01-14T14:54:00.000
4
0
1
0
python-3.x,recursion,import,python-3.4
27,955,271
1
true
0
0
To import a module by name (in 3.4), use importlib.load_module, which is a "simplifying wrapper around importlib.__import__". You will see the latter mentioned (as a builtin) in other answers. To be useful, you must, of course, assign each module returned to something -- unless you are importing merely to check synta...
1
8
0
Given one root directory, I need to import all files from all folders (and folders inside other folders) under the root directory. I figured this could maybe be done with the help of os.walk(), but no idea how to import the files after "walking" through them. Is there an easy way to do this?
Recursively import all .py files from all folders
1.2
0
0
2,001
27,947,639
2015-01-14T16:20:00.000
0
0
1
0
python,pyinstaller
65,626,205
2
false
0
0
Use Auto-py-to-exe to add hindden libraries. In additional files add Rasterio folder (C:/users/Admin/anaconda3/envs/name/Lib/site-packages/rasterio) and then convert to exe. It worked for me. if it says some other libraries are missing then add folder of that library too.
1
30
0
I have two packages (say, dataread and datainspector) that were somehow not detected by PyInstaller. Because of this, the application terminates when the running application reaches the point where it needs to import modules from those packages. The easiest solution would be to copy dataread and datainspector into pack...
How to properly create a pyinstaller hook, or maybe hidden import?
0
0
0
74,738
27,949,714
2015-01-14T18:14:00.000
1
0
0
0
python,python-3.4,python-asyncio
27,988,750
1
false
0
0
No. You cannot add a new method or inherit from existing asyncio transport. Consider transports as final or sealed, like sockets. You should never want to inherit from socket but make your class that embeds the socket instance inside, right? The same for transport. See asyncio.streams as example of building new API lay...
1
1
0
Is it possible to add new methods to a standard asyncio transport? e.g: Adding a send method to the SSL transport that serializes a protocol buffer, constructs a frame and uses the transports own write method to do a buffered write to the underlying socket. There are plenty of asyncio server/client examples out there, ...
Adding methods to an asyncio Transport
0.197375
0
1
253
27,950,855
2015-01-14T19:25:00.000
0
0
1
0
windows,python-2.7,registry,py2exe
27,986,791
3
false
0
0
Turns out WinPython has a menu option in the Control Console for adding Python packages that not only registers python for redistribution, but also registers it in the Windows Registry. Once I ran that menu option the install went ahead just fine. Why WinPython doesn't add itself during installation I'll never know. ...
2
1
0
I've installed Python 2.7.6 onto my Windows 7 32bit system, but it does not seem to have added it to the registry. When I tried installing py2exe (a version appropriate for 2.7.6 on 32bit) it keeps saying I need Python 2.7 which was not found in the registry. Could anyone provide me with a list of the registry items ...
Add Python 2.7.6 to the windows registry
0
0
0
7,408
27,950,855
2015-01-14T19:25:00.000
4
0
1
0
windows,python-2.7,registry,py2exe
39,231,383
3
false
0
0
Installing py2exe (py2exe-0.6.9.win32-py2.7.exe) requires: reg add HKLM\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve /t REG_SZ /d "C:\Python27" /f Tested on Windows 10. Regards LO
2
1
0
I've installed Python 2.7.6 onto my Windows 7 32bit system, but it does not seem to have added it to the registry. When I tried installing py2exe (a version appropriate for 2.7.6 on 32bit) it keeps saying I need Python 2.7 which was not found in the registry. Could anyone provide me with a list of the registry items ...
Add Python 2.7.6 to the windows registry
0.26052
0
0
7,408
27,951,419
2015-01-14T20:01:00.000
0
0
1
0
python,c,python-c-api,python-c-extension
27,969,486
3
false
0
1
sprintf into a buffer followed by atoi seems to do the trick
1
0
0
I have a PyFloatObject that I want to convert to a C float. However, PyObjectFloat only provides a conversion to double. Can I safely cast a double to a float, or is there a function to convert PyObject to float i.e. PyObject_AsFloat.
convert PyFloatObject to float
0
0
0
2,614
27,952,331
2015-01-14T20:59:00.000
92
0
1
0
python,pycharm
27,952,376
3
true
0
0
Menu: Run -> Edit configurations -> "+" (add new config) -> Python. Script name: program.py If you need to debug a script from installed packages, such as tox, you can specify the full path too. For example: Script name: /home/your_user/.envs/env_name/bin/tox Above /home/your_user/.envs/env_name is a path to virtual en...
2
63
0
I have been using PyCharm for a bit so I am not an expert. How I normally ran my programs was with the terminal like so: program.py -t input1 -t1 input2 I was wondering how can I debug this? For other programs I wrote, I did not have any arguments so debugging was simply setting break points and pressing debug.
Debugging with PyCharm terminal arguments
1.2
0
0
43,698
27,952,331
2015-01-14T20:59:00.000
1
0
1
0
python,pycharm
51,116,540
3
false
0
0
It was almost correct but just needed little correction with full script path. Menu: Run->Edit configurations->"+" (add new config)->Python. Script name: path + /program.py Script params: -t input1 -t1 input2
2
63
0
I have been using PyCharm for a bit so I am not an expert. How I normally ran my programs was with the terminal like so: program.py -t input1 -t1 input2 I was wondering how can I debug this? For other programs I wrote, I did not have any arguments so debugging was simply setting break points and pressing debug.
Debugging with PyCharm terminal arguments
0.066568
0
0
43,698
27,953,362
2015-01-14T22:07:00.000
3
0
1
0
python,egg,python-wheel
27,953,925
1
true
0
0
Can you assume your prospective users will all have pip >= 1.4 and/or setuptools >= 0.8? If so, wheels are fine. If not, an egg will help them, since previous releases of pip and setuptools don't support wheels. The fact that their Python is 2.6 or better is no guarantee that their installation tools will be reasona...
1
4
0
Assuming that you are supporting Python 2.6 or newer, does it make any sense to publish .egg packages or is enough to publish .whl ones? In my case, the packages are pure python.
If you publish Python using wheel format do you still need to publish them as egg?
1.2
0
0
72
27,955,463
2015-01-15T01:29:00.000
2
0
0
0
python,html,tags,uri,url-scheme
27,955,487
2
true
1
0
If you don't include the URI scheme (http://, https://, //, etc) then the browser will assume it to be a relative URL. You should be aware of scheme-relative URLs like //www.google.com for your script. In short your should look for a double forward slash // to figure out whether or not a URL will be treated as relativ...
1
0
0
I'm trying to find a way to test whether a URL is absolute or relative in Python. In the href attribute of an HTML tag, is the lack of a scheme (e.g. http, ftp, etc.) sufficient to mark a URL as relative, or is it possible to have an absolute URL as a href attribute without explicitly specifying the scheme (e.g. 'www.g...
Is it possible to have an absolute href attribute with no scheme?
1.2
0
1
173
27,955,622
2015-01-15T01:51:00.000
0
0
0
0
java,python,processbuilder,inter-process-communicat
27,969,431
1
false
1
0
From your scenario, you are looking for inter process communication. You can achieve this using shared file. Your python script will write the output in text file, and your java program will read the same file.
1
1
0
Good evening all, am running a python script inside java using processBuilder. the python script returns a list and i dont know how to get it java and use it since all i can do for the moment with process builder is print errors or outputs. is it possible to get the list in java as well. Many thanks
Java/python using processBuilder
0
0
0
266
27,955,957
2015-01-15T02:38:00.000
0
0
0
0
python-3.x,python-idle
27,956,444
1
false
0
1
Execute it directly from the command line with python script.py.
1
0
0
Is there a way to hide the IDLE (or not making it run at all), with a command, when launching a tkinter application, without having to build the application?
Is there a way to hide the IDLE when running a tkinter application?
0
0
0
155
27,957,035
2015-01-15T04:56:00.000
0
0
0
0
python,django,localhost
60,644,419
3
false
1
0
If you're working DEBUG=True mod in your Django project, you shouldn't need anything other than that (I assume you are not using port 80, it requires root access). You must use 0.0.0.0 as host IP, it is a simple solution. And the command is: python manage.py runserver 0.0.0.0:8000. That's it.
1
6
0
I am running my django project in localhost and it works fine.. For test purpose I want to run my localhost from another computer connected in the same network. I have done python manage.py runserver 'my ip address' That works fine too.. Is there any way that I can access my localhost from another computer connected to...
django run localhost from another computer connected to another network
0
0
0
8,099
27,957,296
2015-01-15T05:25:00.000
6
0
1
0
python
27,957,324
1
false
0
0
== delegates to the left-hand-side's object's __eq__ special method, if there. And string objects definitely have one, and it's highly optimized. So that's really all there is to it...
1
2
0
I was working on optimizing the run-time of a program and got to wondering what "==" in Python really does behind the scenes. In particular, I noticed that it can check whether two large "similar" objects are the same really fast. For instance, if you have two strings of length 10 million and they only differ by a char...
What does Python's "==" really do
1
0
0
100
27,957,335
2015-01-15T05:30:00.000
0
0
1
1
python,python-2.7
27,957,366
1
true
0
0
This is a shot in the dark, I haven't done much python, but could you not have your background scripts dump their results in a file and then have your window focus on updating when that file updates. In linux you could write to a text file and then open another console window to tail that file.
1
0
0
I need to run several python scripts simultaneously in the background, and have all the results be shown in 1 window, real time. The background scripts will continue running, but as more info is outputted it should be shown inside 1 window. I've tried os and subprocess, but to no avail. This needs to work on all plat...
How to show realtime results of multiple python scripts in 1 window
1.2
0
0
40
27,961,552
2015-01-15T10:39:00.000
0
0
0
0
python,numpy,comma,data-files
27,961,800
3
false
0
0
I don't know if this is an option but you could pre-process it using tr -s ',' file.txt. This is a shell command so you'd have to do it either before calling python or using system. The latter might not be the best way since dragon2fly solved the issue using a python function.
1
0
1
I am trying to collect some data from a .txt file into my python script. The problem is that when the data was collected, it could not collect data in one of the columns, which has given me more commas than normally. It looks like this: 0,0,,-2235 1,100,,-2209 2,200,,-2209 All I want is to load the data and remove the ...
Loading data file with too many commas in Python
0
0
0
192
27,965,967
2015-01-15T14:44:00.000
8
0
0
0
python,ocaml
27,966,451
3
false
0
0
This is a general question on how to talk between two programs, written in different languages. Actually, the problem should be further subdivided into two separate subproblems: What transport to use? (file, socket, etc) How to serialize and deserialize data. The first question is very general. You can use sockets of...
1
6
0
I would like to know the best way to send data from OCaml to Python and get response from Python back to OCaml. One naive method I can think is as follows. 1) In OCaml, write data into a file (input.txt) on file system. 2) In OCaml, run python, which opens input.txt and reads the data and write the execution result i...
Communication between OCaml and Python
1
0
0
1,406
27,972,459
2015-01-15T20:32:00.000
2
0
0
0
python,rest,paypal
27,989,541
1
false
1
0
Got a reply from PayPal support. Apparently you can take the same token you pass to BillingAgreement.execute() and pass it to GetExpressCheckoutDetails in their classic API. I tried it and it works. It means you have to use both APIs (which we weren't planning to do) and store both API auth info, which is annoying. ...
1
1
0
Let's say I have a billing agreement, which I just executed on the callback from the PayPal site: resource = BillingAgreement.execute(token) The resource returned does not have any payer information (name, email, etc). I can use the ID to load the full BillingAgreement: billing_agreement = BillingAgreement.find(res...
In the PayPal REST API, how can I get payer information from a newly executed BillingAgreement?
0.379949
0
1
555
27,975,963
2015-01-16T01:27:00.000
2
0
0
0
python,django,validation
27,976,034
3
true
1
0
Client side validation may improve user experience (less page reloads). It may decrease number of hits to he server (but sometimes this number is increased :). But it is not necessary. Anyway server side validation is a must. You can't trust data from user input.
2
3
0
I am writing a Django app, and am wondering if any client side validation is necessary. Django handles all validation through forms in python on the backend. If something validates wrong, the user is returned to the screen with all their information still there. I can't see any reason I need to implement client side ...
Is client side validation nessesary in Django?
1.2
0
0
1,963
27,975,963
2015-01-16T01:27:00.000
3
0
0
0
python,django,validation
27,976,103
3
false
1
0
If you have a web application that faces the public internet client side, validation is pretty much a user expectation. You might be able to ignore this if volume is low and people are motivated to use your website. For an company intranet site, the additional development cost may weigh against client side validation. ...
2
3
0
I am writing a Django app, and am wondering if any client side validation is necessary. Django handles all validation through forms in python on the backend. If something validates wrong, the user is returned to the screen with all their information still there. I can't see any reason I need to implement client side ...
Is client side validation nessesary in Django?
0.197375
0
0
1,963
27,977,626
2015-01-16T05:07:00.000
0
0
0
0
python,paraview
27,987,246
1
false
0
1
Uniform distribution works by picking a set of random locations in space and finding data points closet to those locations to glyph. Try playing with the Seed to see if that helps pick different random locations that yield better results. If you could share the data, that'd make it easier to figure out what could be go...
1
1
1
I'm running Paraview 4.2 on Linux. Here's what's happening: I load my XDMF/hdf5 data into PV, which contains vector data. I apply a glyph filter to the loaded data, and hit apply (thereby using the default mode of Uniform Spatial Distribution). No glyphs appear on screen, and the information tab shows that the filter ...
Paraview glyph uniform distribution does not work on my dataset
0
0
0
653
27,978,383
2015-01-16T06:25:00.000
5
1
0
0
python
27,978,545
2
false
0
0
Even if you did this, I'd strongly discourage it. Root can access pretty much everyone's home directory, but the nuances of adding programs to the PATH that the root user doesn't technically own can be detrimental at best - might lead to a few root services not working properly, and actively insecure at worst. There's...
1
7
0
How to use pyenv with another user? For example, If I have installed pyenv in user test's environment, I could use pyenv when i login as test. However, how could i use pyenv when I login as another user, such as root?
How to use pyenv with another user?
0.462117
0
0
3,900
27,980,567
2015-01-16T09:14:00.000
2
0
1
0
python,qt,batch-file,environment
27,981,382
1
true
0
0
"If the bat files contained only setting of environment variables this would be easy" Include a set command at the end of the batch file and capture its output that will be just the listing of the variables in the environment and their values
1
0
0
I'm writing a python script to coordinate building of a number of Qt-projects on windows. The python script decides which architecture to build for, and which versions of Visual Studio and Qt to use. After that is done I would like to run the proper qtenv2.bat and vcvarsall.bat to setup my environment, and then import ...
Call a bat file from python and import the environment
1.2
0
0
977
27,982,645
2015-01-16T11:06:00.000
0
1
1
0
performance,python-3.x,import
27,990,196
1
false
0
0
There would be an initial performance hit the first time the modules are loaded. The second, third, fourth, ..., times the modules are loaded, Python gets them from its cache, so no performance hit at all. Having said that, the performance should be minor -- still, being a game, do all the imports up front.
1
2
0
If I had 100 imports, would my program perform worse due to Python looking up names during runtime (and looking through my all 100 imports)? I am creating a game and it would be far easier to describe each area as a separate module containing single class.
Python3 import performance
0
0
0
99
27,983,493
2015-01-16T11:59:00.000
0
0
1
1
python,c++,swig,scons
28,020,565
1
true
0
0
It seems like using the "Delete" function as a Command, after the SharedLibrary line, allows me to delete the unwanted files.
1
0
0
I have a scons setup where I can choose to run SWIG and build a python module from c++. this creates files such as x_wrap.cc x.lib x.obj etc. When all I want to have at the end of the process are theses files: _x.pyd x.py Is there a way I can get scons to delete the unwanted files after the build process?
scons - delete some of the built files after the compilation process
1.2
0
0
408
27,985,812
2015-01-16T14:11:00.000
0
0
0
0
python,unix,ssh,paramiko,robotframework
27,986,741
1
false
0
0
For example, when the connection was unexpectedly dropped.
1
0
0
The documentation of recv_exit_status() in paramiko/channel.py says "If no exit status is provided by the server, -1 is returned.". In which situation can it happen that the server (Unix) is providing no exit status?
When does recv_exit_status() return -1?
0
0
1
233
27,987,614
2015-01-16T15:43:00.000
1
0
0
0
python,pyephem
28,003,737
1
true
0
0
No, the underlying C code inside of libastro does not support leading plus signs or leading zeros. You will have to write a little Python function of your own to add them.
1
1
0
How do I get PyEphem to give angles with sign and a zero padded to degrees. Currently it returns 2:46:32.8 but I want it in the form +02:46:32.8. Now, I could define a function to return it in that form, but I was wondering if there was a simpler way.
Getting PyEphem to return angles with sign
1.2
0
0
55
27,988,150
2015-01-16T16:13:00.000
2
0
0
1
python,ubuntu,wxpython
27,988,300
3
false
0
0
Run this: sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n
1
0
0
I'm using python and anaconda to work on some code, which turns out to requires wx2.8, but all I can find is installer for wx3.0. I looked into it, and the process for building an older version of wx from source is very unclear. It's not as simple as python setup.py install for example. Does anyone have experience ...
How to get WXpython 2.8 on Ubuntu?
0.132549
0
0
2,485
27,990,624
2015-01-16T18:39:00.000
1
0
1
0
python,pip
27,990,745
2
false
0
0
It also might be the case that some dependencies are for features of the package that you don't require, like a graphical display library as an example. If you wish to use the software for some other purpose, and will never need these features, then skipping the dependencies may save time or at least the headache of ...
2
0
0
Like the title states, why would I want to install a package while ignoring dependencies using the --no-deps switch? Seems to me doing so could cause some packages to malfunction. Surprisingly, I cannot find the answer to this.
Why would I want to install a package while ignoring dependencies?
0.099668
0
0
51
27,990,624
2015-01-16T18:39:00.000
1
0
1
0
python,pip
27,990,681
2
true
0
0
Some issues are caused by conflicting dependencies. In those cases, you might install the problematic dependency yourself instead of letting pip autofetch it.
2
0
0
Like the title states, why would I want to install a package while ignoring dependencies using the --no-deps switch? Seems to me doing so could cause some packages to malfunction. Surprisingly, I cannot find the answer to this.
Why would I want to install a package while ignoring dependencies?
1.2
0
0
51
27,990,755
2015-01-16T18:47:00.000
0
0
0
0
python,intel-mkl
41,439,399
1
false
0
0
on my workstation, it is the problem with libiomp5.so. You can find the location of the so file with command (i.e. sudo find / -name libiomp5.so on Linux) and add the directory of its location to etc/ld.so.conf.d/intel_mkl_settings.conf right after the MKL installation directory(/opt/intel/mkl/lib/intel64). That helps ...
1
1
0
I try to import skimage.io and have the following error: ...mkl/intel64/libmkl_intel_thread.so: undefined symbol: omp_get_num_procs I have an mkl lib in my LD_LIBRARY_PATH, if I delete it than I have: ImportError: libmkl_rt.so: cannot open shared object file: No such file or directory
skimage.io - undefined symbol: omp_get_num_procs
0
0
0
2,160
27,993,383
2015-01-16T21:52:00.000
0
1
0
0
python,ubuntu,pdf-generation,pdfkit
29,774,518
1
false
1
0
I found the solution. The problem was that I didn't close .colse() the file before the initialisation of the pdfkit
1
0
0
I have a very strange problem. I have a script written in python which is generating an html report then I convert it using pdfkit to pdf . The script is working just fine on MAC and the pdf is generated normally. When I tried to install the same script on Ubuntu I got the following upnormal behavior: The html file is...
PDFKit with python on Ubuntu
0
0
0
487
27,994,576
2015-01-16T23:49:00.000
0
0
0
0
python,web
27,994,687
2
false
1
0
Recommend flask. I've just done something like this. Only need a few lines of python code and a few lines of html code. No more than 30 lines. Write a html page which has an input and a button. When the page gets an input and the button gets hit, a python script will be invoked. And then result will be rendered to a ne...
1
0
0
Is there an easy, simple way to embed python code in a webpage; i.e., have an embedded app where viewers input numbers and a python code is run and an output is spit out? I don't really want to learn Django just for one project, but if there's no other way, I might have to.
Embed Python code on a webpage
0
0
0
273
27,995,942
2015-01-17T03:46:00.000
0
0
0
1
python,windows-mobile,windows-ce,gspread
28,018,470
1
true
0
0
Although gspread source code is available and a python modul it depends on urllib and that depends on various other modules that are not part of PythonCE. So, I fear, you will not success in getting gspread running on the windows mobile device. Best solution to this seems to use a web server that hosts the html pages. ...
1
0
0
I am working on an inventory project for work that will use a mobile computer and have run into a problem. I have written a program using Python and the Gspread library, but forgot to check if it will even work with either the windows mobile or windows CE operating systems. From what I have found there is a version of ...
Gspread and python on windows mobile or windows CE
1.2
0
0
151
27,998,297
2015-01-17T09:57:00.000
3
0
0
0
python,django
27,999,374
2
false
1
0
You can specify different permissions in the auth_user table using the is_superuser and is_staff boolean attributes in the model. Maintaining the session and permissions is easier if you use the auth_user table
1
1
0
I am quite new to Django, I need a example code for creating login and registration form and a default page which a user can see only after logged in. Here important thing is that i want to use different table for users other than the auth_user table for admin. These users can logged in and able to perform some functio...
Login and registration example in Django with different user table
0.291313
0
0
1,284
28,005,981
2015-01-18T00:39:00.000
3
0
1
0
python
28,006,269
4
false
0
0
__init__ does act like a constructor. It needs an instance to do its job like setting attributes and so on. If __new__ doesn't return explicitly returns an instance, then None is returned by default. Imagine that what will happen when __init__ gets a None as an input and trying to set attributes? It will raise an exce...
1
7
0
There are many questions on SO asking why python doesn't always call __init__ after object creation. The answer, of course, is found in this excerpt from the documentation: If __new__() returns an instance of cls, then the new instance’s __init__() method will be invoked like __init__(self[, ...]), where self is the n...
What is the design reason for the fact that if __new__ does not return an instance of cls, python does not invoke __init__?
0.148885
0
0
615
28,006,100
2015-01-18T01:01:00.000
0
0
1
0
python,class,pygame
50,237,749
3
false
0
1
Well you could always just re-assign a new group object to your old group. your_old_group = new_group I'm not entirely sure but it seems kill is meant to delete specific sprites.
1
1
0
I'm working on a pygame project at the moment and I'm wondering if there is an easy way to delete all sprites in a class. I have all the sprites in a group called self.spritegroup, so I couldn't just delete all objects in a group. Is there a simple shortcut to delete all objects in a class?
Pygame delete all objects in class
0
0
0
1,778
28,009,390
2015-01-18T11:56:00.000
6
0
0
0
python,python-2.7
28,009,442
4
false
0
0
This question is rather subjective to the definition of random, and the distribution you wish to replicate. The simplest solution: Choose a one random number, rand1 : [30,296] Choose a second random number, rand2 : [30, (326-Rand1)] Then the third cannot be random due to the constraint so calc via 356-(rand1+rand2)
1
0
1
please how can I randomly select 3 numbers whose sum is 356 and each of these 3 is more than 30? So output should be for example [100, 34, 222] (but not [1,5,350]) I would like to use random module to do this. thank you!
randomly select 3 numbers whose sum is 356 and each of these 3 is more than 30
1
0
0
131
28,009,999
2015-01-18T13:06:00.000
1
0
1
0
python,fork,daemon,server
28,010,240
1
false
0
0
It's done to ensure that the PID!=SID which ensures that the process cannotacquire tty(i.e. the terminal) to effectively be called a daemon process. A single fork results in the child having same SID as it's parent which means that it can acquire the tty if it's parent had such a permission or rights. So just exiting ...
1
0
0
Why do we need to fork() twice to create a daemon of a python server? Can't the same be done using a single fork() without subsequently setting it as a session leader by using os.setsid()??
Why should forking be done twice in python to set up a daemon server?
0.197375
0
0
259
28,012,791
2015-01-18T17:44:00.000
-1
0
1
1
python,deployment,packaging
28,012,820
2
false
0
0
Just turn your computer into a server. Simply set up your router for port forwarding so that your server's content's will display when the router's IP is entered. You can of course purchase a DNS domain to give that IP a human readable URL.
1
0
0
I have written a python script on my local laptop which uses several third party packages. I now want to run my script regularly (via a cron job) on an external server. The external server most likely does not have all the dependencies installed, is there is a way to package and deploy my python script and dependencie...
How do I deploy a python application to an external server?
-0.099668
0
0
452
28,012,863
2015-01-18T17:52:00.000
0
0
0
0
combobox,wxpython
28,027,478
1
false
0
1
I would recommend using the ComboCtrl instead of the ComboBox. The benefit is that the ComboCtrl is a custom widget, so it allows more flexibility. For example, the ComboCtrl provides a scrollbar for long strings. Check out the wxPython demo for some good examples.
1
1
0
In a wxpython Combobox, long strings get left-truncated in the dropdown portion. This can result in some values looking identical when they aren't. I'd like to provide better information to the user than that. The following options occur to me: Insert elipses in the middle of the string before adding it to the combob...
Showing long strings in wxpython Combobox dropdown
0
0
0
172
28,015,822
2015-01-18T23:02:00.000
0
0
1
0
python,multithreading,concurrency,hardware
28,016,068
1
true
0
0
OK, so practically speaking, I think the answer is that time.sleep() will yield to other waiting threads. Perhaps other limitations or concerns will rear their heads in time, but at this stage, performance is not the issue, only concurrency.
1
0
0
I'm having trouble getting clarity on this. I have a program, say, with three threads - A, B and C. C is a 'hardware manager', A and B perform their own tasks using APScheduler for scheduling and as part of their routines, make requests of the hardware manager thread. If I use a time.sleep() in thread C (sometimes nece...
What limitations does the Python GIL place on multithreading? (with example)
1.2
0
0
200
28,017,037
2015-01-19T02:11:00.000
6
0
1
0
python,heap
28,017,065
2
false
0
0
You can't. Or rather, you can't specify it as a lambda. You can however make a heap of tuples, heapq.heappush(Q, (key(v), v)) and heapq.heappop(Q)[1].
1
2
0
In python heapq if you are putting in objects, how can u use a lambda to specify its key? Like heapq.heappush(Q, v, key=lambda x: f(x)). Thanks
How to use lambdas in python heapq?
1
0
0
5,551
28,019,310
2015-01-19T06:51:00.000
0
1
0
0
django,apache,python-3.x,mod-wsgi
28,044,520
3
false
1
0
Thanks guys, I actually fixed the issue myself this morning by running the make install of mod_wsgi with .configure pointing to python3.4. I think you were right Adam.
3
6
0
Hi I am getting the error below when going to the website url on ubuntu server 14.10 running apache 2 with mod_wsgi and python on django. My django application uses python 3.4 but it seems to be defaulting to python 2.7, I am unable to import image from PIL and AES from pycrypto. ImportError at / cannot import name _...
running django python 3.4 on mod_wsgi with apache2
0
0
0
5,696
28,019,310
2015-01-19T06:51:00.000
9
1
0
0
django,apache,python-3.x,mod-wsgi
28,038,045
3
true
1
0
I believe that mod_wsgi is compiled against a specific version of python, so you need a py3.4 version of mod_wsgi. You may be able to get one from your os's package repository or you can build one without too much drama. From memory you'll need gcc and python-dev packages (python3-dev?) to build. OK, quick google, for ...
3
6
0
Hi I am getting the error below when going to the website url on ubuntu server 14.10 running apache 2 with mod_wsgi and python on django. My django application uses python 3.4 but it seems to be defaulting to python 2.7, I am unable to import image from PIL and AES from pycrypto. ImportError at / cannot import name _...
running django python 3.4 on mod_wsgi with apache2
1.2
0
0
5,696
28,019,310
2015-01-19T06:51:00.000
0
1
0
0
django,apache,python-3.x,mod-wsgi
28,032,221
3
false
1
0
From what I see here your application is using py2 interpreter with py3 compiled modules, which is no-go. One simple possible solution that comes me in mind is to add or change first line of manage.py to #!/usr/bin/python3. This will tell script to be interpreted with py3. Next on guess list would be misconfiguration i...
3
6
0
Hi I am getting the error below when going to the website url on ubuntu server 14.10 running apache 2 with mod_wsgi and python on django. My django application uses python 3.4 but it seems to be defaulting to python 2.7, I am unable to import image from PIL and AES from pycrypto. ImportError at / cannot import name _...
running django python 3.4 on mod_wsgi with apache2
0
0
0
5,696
28,024,191
2015-01-19T12:00:00.000
0
0
0
0
python,machine-learning,scikit-learn
28,024,414
1
false
0
0
(My answer is based on the usage of svm.SVC, Lasso may be different.) I think that you are supposed pass the Gram matrix instead of X to the fit method. Also, the Gram matrix has shape (n_samples, n_samples) so it should also be too large for memory in your case, right?
1
4
1
I'm trying to train a linear model on a very large dataset. The feature space is small but there are too many samples to hold in memory. I'm calculating the Gram matrix on-the-fly and trying to pass it as an argument to sklearn Lasso (or other algorithms) but, when I call fit, it needs the actual X and y matrices. A...
Using precomputed Gram matrix in sklearn linear models (Lasso, Lars, etc)
0
0
0
1,183
28,024,651
2015-01-19T12:26:00.000
0
0
0
0
python,django,login,navigation
28,024,750
2
false
1
0
1: create your own view that the login button take the person to when clicked and load your index.html template. you do not have to use the built in login. 2: logo? you can use any logo/format you want. Django doesn't come with a template that creates the look of the site (beside the admin one); so you need to create ...
2
0
0
Im using the Django template login and want to navigate from the login to my own written index.html file. so if a user push the "login" button the result page is my index file. My second question is how to use logos in django python and what structure i need in my project. best regards
Django Navigation from Template-Login to a self written index.html
0
0
0
85
28,024,651
2015-01-19T12:26:00.000
0
0
0
0
python,django,login,navigation
28,028,387
2
false
1
0
create custom log-in and registration in your project, and write the custom back-end if you have more user ,if request is came from user to log-in then redirect to index,html,
2
0
0
Im using the Django template login and want to navigate from the login to my own written index.html file. so if a user push the "login" button the result page is my index file. My second question is how to use logos in django python and what structure i need in my project. best regards
Django Navigation from Template-Login to a self written index.html
0
0
0
85
28,025,666
2015-01-19T13:24:00.000
15
0
0
0
python-3.x,tkinter
28,027,692
1
true
0
1
If you give the containing frame a color, and use options to put padding between cells, the background will bleed through the gaps. This only works where there are widgets. If you have spans that are empty, you won't see grid lines. It's important to realize that you aren't creating a grid object. "grid" is not a thin...
1
15
0
Is there a trick to show the grid layout cells (or the borders of the cells) when using it, in order to have a visual idea of what is going on behind the scenes? I have searched a little bit, but have not found nothing yet.
Show grid layout cells in tkinter
1.2
0
0
17,747
28,026,439
2015-01-19T14:05:00.000
0
0
0
0
python,linux,iptables
29,113,478
2
false
0
0
From the networking I've done, you'll need to put the 2 NFQUEUE commands into different table/chain tuples, eg. one in filter/FORWARD and the other in mangle/PREROUTING. Basically, once a packet has gone to a single NFQUEUE in a table/chain combo, it's done for that table/chain and it exits the main chain entirely. My ...
1
1
0
Here is what I am trying to achieve. I have an inline linux box running Suricata capable of dropping packets. This works with the standard method of placing all traffic onto NFQUEUE 0 and then setting suricata listening on that. The code I am writing needs to be able to intercept DNS and Kerberos packets on NFQUEUE 1, ...
NFQUEUE/IPtables - Suricata Inline With Python Intercept for DNS
0
0
0
1,911
28,028,695
2015-01-19T16:00:00.000
0
0
1
0
python
28,028,959
3
false
0
0
Most modules are actually written in C, like Pygame for example. Python itself is based on C. You can't jump to conclusions, but if the library is pure Python, I'd suggest copying the package into your project directory and importing, rather than copying and pasting code snippets.
1
1
0
Given that every library is a python code itself, I think its logical that instead of using the import command, we can actually copy the whole code of that library and paste it to the top of our main.py. I'm working on a remote pc, I cannot install libraries, can I use a library by just doing this? Forgive me if this a...
Manually adding libraries
0
0
1
231
28,029,215
2015-01-19T16:27:00.000
0
1
1
0
python,python-2.7
28,029,391
3
false
0
0
I belive second version (not 5 % 2) is faster since unary_not operation is faster than compare operation.
2
0
0
I tried using timeit and time.clock() but my computer's speed is inconsistent and I couldn't find out which is faster, If this question already exists then I apologize but I couldn't find it.
What is faster? "5 % 2 == 0" or "not 5 % 2"
0
0
0
142
28,029,215
2015-01-19T16:27:00.000
1
1
1
0
python,python-2.7
28,029,315
3
false
0
0
Testing %2 (i.e. for oddness / evenness) can be performed quickly by examining the least significant bit of a number. (Do that with logical AND: (n & 1)). You'd be hard pressed to beat that. But any potential performance gain might be probably attenuated in Python, so profile it and use if only, in your judgement, the ...
2
0
0
I tried using timeit and time.clock() but my computer's speed is inconsistent and I couldn't find out which is faster, If this question already exists then I apologize but I couldn't find it.
What is faster? "5 % 2 == 0" or "not 5 % 2"
0.066568
0
0
142
28,033,003
2015-01-19T20:30:00.000
0
0
1
0
python,pygame,pyinstaller
28,058,867
2
true
0
1
i suggest trying another program like py2exe to bundle python programs i currently have not had any issues with it. Their are lots of good youtube videos on the process which is cmd based. I have had some personal problems using pyinstaller and think it is just buggy assuming your program is not flawed.
1
6
0
I have tried multiple times to use PyInstaller to bundle my Python2 programs, but it never seems to work with the Pygame module. I have seen many other issues on this topic, but I couldn't find any useful answers. Does anybody know a solution to this? I am trying to do this on Ubuntu 14.10. -Edit- To be more specific: ...
Pyinstaller with pygame
1.2
0
0
9,558
28,035,119
2015-01-19T23:10:00.000
1
0
0
0
python,django,git
68,283,683
10
false
1
0
You should think of migrations as a version control system for your database schema. makemigrations is responsible for packaging up your model changes into individual migration files - analogous to commits - and migrate is responsible for applying those to your database. The migration files for each app live in a “migr...
5
187
0
Should I be adding the Django migration files in the .gitignore file? I've recently been getting a lot of git issues due to migration conflicts and was wondering if I should be marking migration files as ignore. If so, how would I go about adding all of the migrations that I have in my apps, and adding them to the .g...
Should I be adding the Django migration files in the .gitignore file?
0.019997
0
0
78,791
28,035,119
2015-01-19T23:10:00.000
3
0
0
0
python,django,git
56,424,456
10
false
1
0
Gitignore the migrations, if You have separate DBs for Development, Staging and Production environment. For dev. purposes You can use local sqlite DB and play with migrations locally. I would recommend You to create four additional branches: Master - Clean fresh code without migrations. Nobody is connected to this bra...
5
187
0
Should I be adding the Django migration files in the .gitignore file? I've recently been getting a lot of git issues due to migration conflicts and was wondering if I should be marking migration files as ignore. If so, how would I go about adding all of the migrations that I have in my apps, and adding them to the .g...
Should I be adding the Django migration files in the .gitignore file?
0.059928
0
0
78,791
28,035,119
2015-01-19T23:10:00.000
1
0
0
0
python,django,git
52,187,013
10
false
1
0
Having a bunch of migration files in git is messy. There is only one file in migration folder that you should not ignore. That file is init.py file, If you ignore it, python will no longer look for submodules inside the directory, so any attempts to import the modules will fail. So the question should be how to ignore ...
5
187
0
Should I be adding the Django migration files in the .gitignore file? I've recently been getting a lot of git issues due to migration conflicts and was wondering if I should be marking migration files as ignore. If so, how would I go about adding all of the migrations that I have in my apps, and adding them to the .g...
Should I be adding the Django migration files in the .gitignore file?
0.019997
0
0
78,791
28,035,119
2015-01-19T23:10:00.000
4
0
0
0
python,django,git
37,484,659
10
false
1
0
I can't imagine why you would be getting conflicts, unless you're editing the migrations somehow? That usually ends badly - if someone misses some intermediate commits then they won't be upgrading from the correct version, and their copy of the database will be corrupted. The process that I follow is pretty simple - wh...
5
187
0
Should I be adding the Django migration files in the .gitignore file? I've recently been getting a lot of git issues due to migration conflicts and was wondering if I should be marking migration files as ignore. If so, how would I go about adding all of the migrations that I have in my apps, and adding them to the .g...
Should I be adding the Django migration files in the .gitignore file?
0.07983
0
0
78,791
28,035,119
2015-01-19T23:10:00.000
5
0
0
0
python,django,git
45,315,509
10
false
1
0
The solution usually used, is that, before anything is merged into master, the developer must pull any remote changes. If there's a conflict in migration versions, he should rename his local migration (the remote one has been run by other devs, and, potentially, in production), to N+1. During development it might be ok...
5
187
0
Should I be adding the Django migration files in the .gitignore file? I've recently been getting a lot of git issues due to migration conflicts and was wondering if I should be marking migration files as ignore. If so, how would I go about adding all of the migrations that I have in my apps, and adding them to the .g...
Should I be adding the Django migration files in the .gitignore file?
0.099668
0
0
78,791
28,036,292
2015-01-20T01:22:00.000
5
0
1
0
python,importerror,python-newspaper
29,700,163
2
false
0
0
I was able to fix this problem by creating an images directory in /usr/local/lib/python2.7/dist-packages/newspaper , moving images.py to this directory, and placing a blank __init__.py in this directory.
1
3
0
I am pretty new to python and am trying to import newspaper for article extraction. Whenever I try to import the module I get ImportError: cannot import name images. Anyone come across this problem and found a solution?
ImportError when installing newspaper
0.462117
0
0
1,499
28,038,384
2015-01-20T05:30:00.000
1
0
0
0
python,python-2.7,openssl,pycrypto,brython
28,065,519
1
false
1
0
So, first things first: it is not usueal to have the same code to run on server side and client side. Second thing: be aware that no authentication (or "signing") done on client side can be regarded as safe. At most, the client side can take care of closely coupling the signing with the UI to give the user dynamic feed...
1
1
0
Client side tool to extract values such as common name serial number and public key from pfx file which is loaded by client, and then sign the public key and send to server.. I have completed the backend python code which will import modules from OpenSSL.Crypto library.. How to execute the same in client side?.. i.e s...
Python Client side tool( should work in browser) to extract values from a pfx file and sign it
0.197375
0
1
146
28,039,131
2015-01-20T06:36:00.000
0
0
0
0
python,mysql,mysql-python,mysql-connector,python-3.4
47,486,286
2
false
0
0
Relative to Python 3.6: The official mysql connector only worked in python 2.7 after i installed it on OSX. As an alternative I used the easy_install-3.6 python module integrated in python 3.6 Go to directory: /Library/Frameworks/Python.framework/Versions/3.6/bin command: easy_install-3.6 mysql-connector-python
1
0
0
Python 2.7 and 3.4 co-exist in my mac-os. After installing the official mysql connector (downloaded from dev.mysql.com), import mysql.connector can only pass in python 2.7. Is there any way for the connector to work for both python versions?
mysql-python connector work with python2.7 and 3.4 at the same time
0
1
0
569
28,041,429
2015-01-20T09:11:00.000
1
0
0
0
python,peewee
28,041,761
3
true
1
0
According to source code, no way to find out. Also, according to documentation, it is not recommended to use this method. I suggest to use try/except/else clause.
1
0
0
AFAIK, peewee's Model.get_or_create() doesn't return a flag that indicates a creation, unlike django's get_or_create(). Is there a good way to check if an instance returned by get_or_create() is freshly created? Thanks
get_or_create: is it a 'get' or a 'create'?
1.2
0
0
3,290
28,042,290
2015-01-20T09:53:00.000
0
0
0
0
python,django,versioning
28,045,449
2
false
1
0
As an other answer mentions, Django doesn't store old values by default. You can do this yourself by grabbing the old value and storing it to another attribute on your model on save.
1
0
0
For a model instance does Django store the model instance value by default that I could retrieve before it has been changed? Example I would like to get the status(model attribute) changed for a given date? I am able to check the attribute from LogEntry, But is there some default which stores the actual old value that ...
Does django store instance values before changing it by default
0
0
0
42
28,042,692
2015-01-20T10:12:00.000
1
0
1
0
python,infinite,timedelta
28,043,090
3
false
0
0
The typical way to express an unfinished interval is to use a datetime type's maximum value or NULL for the ending time. As it was shown, you cannot really perform calculations involving the infinite value and get meaningful results. Thus, NULL is better in this regard by simply not allowing you to.
1
7
0
How can you express an infinite timedelta in Python? Up to now we use datetime from stdlib, but we could switch, if it is only supported in a third party library. PostgreSQL does support it. And it would be handy in my case. I want to use it to express an not finished interval. I could use None, but an infinite timedel...
Infinite Timedelta in Python
0.066568
0
0
2,680
28,044,269
2015-01-20T11:29:00.000
1
0
1
0
python,python-asyncio
28,050,981
3
false
0
0
You may implement own asyncio transport which utilizes .recv_into() function but yes, for now asyncio has not a way to use .recv_into() out-the-box. Personally I doubt in very big speedup: when you develop with C the zero-copy is extremely important but for high-level languages like Python benefits are much lesser.
2
5
0
Socket module has a socket.recv_into method, so it can use user-defined bytebuffer (like bytearray) for zero-copy. But perhaps BaseEventLoop has no method like that. Is there a way to use method like socket.recv_into in asyncio?
is there any operation like socket.recv_into in python 3 asyncio?
0.066568
0
1
1,555
28,044,269
2015-01-20T11:29:00.000
1
0
1
0
python,python-asyncio
28,045,430
3
false
0
0
The low-level socket operations defined for BaseEventLoop require a socket.socket object to be passed in, e.g. BaseEventLoop.sock_recv(sock, nbytes). So, given that you have a socket.socket, you could call sock.recv_into(). Whether it is a good idea to do that is another question.
2
5
0
Socket module has a socket.recv_into method, so it can use user-defined bytebuffer (like bytearray) for zero-copy. But perhaps BaseEventLoop has no method like that. Is there a way to use method like socket.recv_into in asyncio?
is there any operation like socket.recv_into in python 3 asyncio?
0.066568
0
1
1,555
28,057,383
2015-01-20T23:56:00.000
4
0
0
0
python,sockets,network-programming
28,057,748
1
false
0
0
From the python doc: Note close() releases the resource associated with a connection but does not necessarily close the connection immediately. If you want to close the connection in a timely fashion, call shutdown() before close().
1
3
0
I was looking at how to send a TCP FIN using python socket. I tried using the socket.socket.close and it sends out a TCP RST and not a TCP FIN. Can someone please let me know what is the API?
how to send a TCP FIN using python sockets
0.664037
0
1
3,320
28,057,407
2015-01-20T23:59:00.000
0
0
0
0
python,dictionary,storage,store,pickle
28,057,921
2
false
0
0
With 60,000 dimensions do you mean 60,000 elements? if this is the case and the numbers are 1..10 then a reasonably compact but still efficient approach is to use a dictionary of Python array.array objects with 1 byte per element (type 'B'). The size in memory should be about 60,000 entries x 60,000 bytes, totaling 3.3...
1
5
1
I have a dictionary with many entries and a huge vector as values. These vectors can be 60.000 dimensions large and I have about 60.000 entries in the dictionary. To save time, I want to store this after computation. However, using a pickle led to a huge file. I have tried storing to JSON, but the file remains extremel...
Store large dictionary to file in Python
0
0
0
6,975
28,057,552
2015-01-21T00:14:00.000
0
0
0
0
python,sockets,buffer,recv
28,057,641
2
false
0
0
Learn about OSI layers, and different connections such as TCP and UDP. socket.send implements a TCP transmission of data. If you look into the OSI layers, you will find out that the 4th layer (i.e. transport layer) will buffer the data to be transmitted. The default size of the buffer depends on the implementation.
2
0
0
I'm trying to learn how socket module works and I have a dumb question: Where is socket.send()'s sent data stored before being cleared by socket.recv()?. I believe there must be a buffer somewhere in the middle awaiting for socket.recv() calls to pull this data out. I just made a test with a server which sent a lot of...
Trying to understand buffering in Python socket module
0
0
1
184
28,057,552
2015-01-21T00:14:00.000
0
0
0
0
python,sockets,buffer,recv
28,057,652
2
true
0
0
The OS (kernel) buffers the data. On Linux the buffer size parameters may be accessed through the /proc interface. See man 7 socket for more details (towards the end.)
2
0
0
I'm trying to learn how socket module works and I have a dumb question: Where is socket.send()'s sent data stored before being cleared by socket.recv()?. I believe there must be a buffer somewhere in the middle awaiting for socket.recv() calls to pull this data out. I just made a test with a server which sent a lot of...
Trying to understand buffering in Python socket module
1.2
0
1
184
28,059,694
2015-01-21T04:37:00.000
1
0
1
0
python,user-input,file-transfer
28,059,825
2
false
0
0
First, you need to prompt the user for their file size and transfer speed, obviously. I usually use input. The reason is that sys takes arguments directly after the name of your file in the command line, so you'd say python file.py 10 11. I find creating a better user interface for taking input via prompts to be more...
1
0
0
I am fumbling my way through learning python and need some help getting started on some things. For this project I need to create a program that calculates file transfer time. I need to prompt the user for a file size in megabytes. I also need to prompt the user for the estimated transfer speed in megabits per second....
Python - Calculate file transfer time
0.099668
0
0
2,626
28,059,937
2015-01-21T05:00:00.000
0
1
0
0
python,linux,django,printing,raspberry-pi
28,060,170
1
false
1
0
install a print server on the pi and serve the printer. you may need some sort of tunnel so that the VPS can reach the pi.
1
0
0
I have a website in django, I only going to visit the website using a Raspberry Pi, I need print a data, and for print I am using a Thermal Printer in the Raspberry Pi. I can print from the Raspberry pi using ("/dev/ttyAMA0",19200,timeout=5) for obtain serial communication This work fine but only when the project i...
django work with a Thermal Printer in Raspberry PI
0
0
0
349
28,059,948
2015-01-21T05:01:00.000
0
0
0
1
python,linux,pip,openstack,devstack
28,060,641
2
false
0
0
Edit the script and append --allow-unverified ie pip install package_name==version --allow-unverified package_name
2
1
0
I am not able to install OpenStack. I executed the script stack.sh and there was Error on exit. I looked at the log, the error is during the execution of the command: sudo -H -E python /home/sagar/devstack/files/get-pip.py : This is the error during the execution of the below command: sudo -H -E python /home/sagar/dev...
./stack.sh failed while installing Openstack
0
0
0
2,026
28,059,948
2015-01-21T05:01:00.000
1
0
0
1
python,linux,pip,openstack,devstack
28,063,958
2
false
0
0
I got the problem. The system date was not correct.
2
1
0
I am not able to install OpenStack. I executed the script stack.sh and there was Error on exit. I looked at the log, the error is during the execution of the command: sudo -H -E python /home/sagar/devstack/files/get-pip.py : This is the error during the execution of the below command: sudo -H -E python /home/sagar/dev...
./stack.sh failed while installing Openstack
0.099668
0
0
2,026
28,063,099
2015-01-21T08:58:00.000
1
0
0
0
python-2.7,customization,kivy
28,068,266
1
false
0
1
These variables can be set in the buildozer.spec, e.g. icon.filename in the [app] section.
1
1
0
How do you customize the kivy logo for a kivy app? I am using Buildozer in Ubuntu 14.04.
Customizing a kivy app logo using Buildozer
0.197375
0
0
448
28,063,378
2015-01-21T09:14:00.000
1
0
0
0
python,macos,apache,ampps
28,284,966
1
true
1
0
As far as I can tell, AMPPS does not work on Yosemite at all (@ v2.8)
1
0
0
I am have just recently acquired a new Mac (Yosemite OSX 10.10) I am reconfiguring everything and I need to work with external configs and Python on some new projects. Which bring me to two additional question: how to include an extra configuration with an external config file ? can I just include it to the httpd.con...
AMPPS Yosemite Python configuration
1.2
0
0
259
28,064,634
2015-01-21T10:17:00.000
2
0
0
0
python,random,scikit-learn
57,910,696
7
false
0
0
If there is no randomstate provided the system will use a randomstate that is generated internally. So, when you run the program multiple times you might see different train/test data points and the behavior will be unpredictable. In case, you have an issue with your model you will not be able to recreate it as you do ...
2
189
1
I want to implement a machine learning algorithm in scikit learn, but I don't understand what this parameter random_state does? Why should I use it? I also could not understand what is a Pseudo-random number.
Random state (Pseudo-random number) in Scikit learn
0.057081
0
0
236,863
28,064,634
2015-01-21T10:17:00.000
23
0
0
0
python,random,scikit-learn
50,672,222
7
false
0
0
If you don't specify the random_state in your code, then every time you run(execute) your code a new random value is generated and the train and test datasets would have different values each time. However, if a fixed value is assigned like random_state = 42 then no matter how many times you execute your code the resul...
2
189
1
I want to implement a machine learning algorithm in scikit learn, but I don't understand what this parameter random_state does? Why should I use it? I also could not understand what is a Pseudo-random number.
Random state (Pseudo-random number) in Scikit learn
1
0
0
236,863
28,069,439
2015-01-21T14:19:00.000
7
0
0
0
python,mysql,openerp-7,odoo
28,069,999
1
true
1
0
You can't: the Odoo ORM does not support null numeric values. If you really need to distinguish an "empty" value from a zero value, you need a workaround: either use a string field (simpler, but needs additional checks to allow only number and it's harder to perform calculations) or use a second boolean field to mark e...
1
8
0
In Odoo/OpenERP 7, I have a nullable numeric column called balance 'balance': fields.float(string='Balance',digits=(20,2)) I am trying to use Python code to update None into the field self.write(cr, uid, [1], { 'balance':None }) but, rather frustratingly, Python treats None the same as 0 so I end up with 0 in the D...
Odoo - Write null to numeric column
1.2
0
0
4,136
28,070,431
2015-01-21T15:07:00.000
0
0
0
1
python,linux,wifi,ftp-server
28,070,608
1
false
0
0
On Linux the most straightforward way would be to either use SSH (SCP), for which you only need SSH daemon enabled on the server machine, or to run a trivial webserver. No coding required in either cases.
1
0
0
My application running under Linux creates four to seven data files in a directory whose name includes the client and datetime.These need to be copied by other devices - usually a Linux PC/laptop and potentially an Android phone. Currently the copying is done via a cable connection. I now need to make this wireless and...
Linux PC: How to let other Linux devices copy files
0
0
0
56
28,072,368
2015-01-21T16:40:00.000
1
0
1
0
python,global-variables
28,072,666
3
false
0
0
If you only need a reference to global state, consider passing that as an argument to the function instead of relying on kicking upward through scopes until you hit one where the global value is defined. Under the assumption that the global state truly will only be referenced and never mutated, there's no good reason n...
2
1
0
There are plenty of posts on when global variables must be declared in Python, and relatedly, on Python scope rules. I haven’t been able to find a satisfactory treatment of the more specific question above, however, either on the internet or in text books I’ve consulted. Even as a beginner programmer, I can appreciate ...
Referencing (as opposed to assigning to) global variables in Python functions. Bad practice or not?
0.066568
0
0
88
28,072,368
2015-01-21T16:40:00.000
1
0
1
0
python,global-variables
28,072,436
3
false
0
0
If you try to use a global variable inside of a function the interpreter will try to look for it in the nearest scope, then in others possible. If your code is complicated enough, it'll cycle through lots of scopes and lots of different variables trying to find the one you want. If your script only consists of some fun...
2
1
0
There are plenty of posts on when global variables must be declared in Python, and relatedly, on Python scope rules. I haven’t been able to find a satisfactory treatment of the more specific question above, however, either on the internet or in text books I’ve consulted. Even as a beginner programmer, I can appreciate ...
Referencing (as opposed to assigning to) global variables in Python functions. Bad practice or not?
0.066568
0
0
88
28,076,316
2015-01-21T20:34:00.000
2
0
0
0
python,django,scheduled-tasks,celery,django-celery
28,076,369
2
false
1
0
Use a simple cron job to trigger a custom Django management command.
2
0
0
Some tuples in my database need to be erased after a given time. I need my django app to check if the rows have expired. While I can definitely write the function, how do I make Django run at everyday at a fixed time? I have heard about Task Queues like Celery. Are they too much powerful for this? Is their anything sim...
How do I make my django application perform a job at a fixed time everyday?
0.197375
0
0
140
28,076,316
2015-01-21T20:34:00.000
-1
0
0
0
python,django,scheduled-tasks,celery,django-celery
28,076,358
2
false
1
0
Use a threading.Thread to schedule a continuous event loop. In your thread, use time.sleep to create a gap before the next occurrence of the event.
2
0
0
Some tuples in my database need to be erased after a given time. I need my django app to check if the rows have expired. While I can definitely write the function, how do I make Django run at everyday at a fixed time? I have heard about Task Queues like Celery. Are they too much powerful for this? Is their anything sim...
How do I make my django application perform a job at a fixed time everyday?
-0.099668
0
0
140
28,078,555
2015-01-21T23:07:00.000
0
0
0
0
python,opencv,image-processing
28,078,626
1
false
0
0
Very open question, but OpenCV is where to be looking. Your best bet would probably be building Haar cascade classifiers. Plenty of reading material on the topic, somewhat overwhelming at first but that is what I would be looking into.
1
0
1
I've been looking into this for a while and was wondering the feasibility of using something like feature detection in OpenCV to do the following: I'm working on a project that requires identifying items within a grocery store that do not have barcodes (i.e. produce). I want to build a local database of the various ite...
Detecting similar objects using OpenCV
0
0
0
243
28,083,203
2015-01-22T07:19:00.000
0
0
1
0
python,matplotlib
28,083,896
1
false
0
0
Yes the matplotlib site above will do the job! The same procedure you will have to follow to install numpy, which I guess you will also need.
1
0
1
I just started using python and definitely need the matplotlib. I'm confused by the fact that there is even not a clear explanation for the basic ideas behind install a lib/package in python generally. Anyway, I'm using windows and have installed Python 3.4.2 downloaded from the offical website, how should I install th...
How to install matplotlib on windows
0
0
0
986
28,084,065
2015-01-22T08:20:00.000
2
0
0
0
python,nginx,flask
28,084,606
2
false
1
0
Serve your image through Flask instead of your web server, treat it like any other url with permissions. Nginx is obviously a much better choice to serve your static files but it won't integrate with Flask.
1
1
0
I've created an application in which media files(files that are uploaded by users, not css/js) are served statically by another server on the subdomain like: media.example.com/path/to/image.jpg. How can I limit access to the images so that only certain people who are logged in and have permission can see them? Please n...
How to handle static/media file permission on flask?
0.197375
0
0
1,641
28,092,518
2015-01-22T15:27:00.000
0
0
1
0
python,matplotlib,figures
28,105,601
1
false
0
0
Figures need a canvas to draw on. Try fig.draw()
1
2
1
I am working with a matplotlib-based routine that returns a figure and, as separate objects, the axes that it contains. Is there any way, that I can display these things and edit them (annotate, change some font sizes, things like that)? "fig.show()" doesn't work, just returns an error. Thanks.
How to display a matplotlib figure object
0
0
0
1,408
28,096,856
2015-01-22T19:13:00.000
1
1
0
0
php,python,sql,unicode
28,096,917
2
false
0
0
just put a N infront of the string, something like INSERT INTO MYTABLE VALUES(N"xxx") and make sure your column type is nvarchar
2
0
0
I want to build an universal database in which I will keep data from multiple countries so I will need to work with the UNICODE charset. I need a little help in order to figure out which is the best way to work with stuff like that and how my queries will be affected ( some sql example queries from php/python for basic...
How to insert UNICODE characters to SQL db?
0.099668
1
0
1,733
28,096,856
2015-01-22T19:13:00.000
0
1
0
0
php,python,sql,unicode
28,096,868
2
false
0
0
there is nothing special you need to do. with php you can do... query("SET NAMES utf8");
2
0
0
I want to build an universal database in which I will keep data from multiple countries so I will need to work with the UNICODE charset. I need a little help in order to figure out which is the best way to work with stuff like that and how my queries will be affected ( some sql example queries from php/python for basic...
How to insert UNICODE characters to SQL db?
0
1
0
1,733