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
17,030,677
2013-06-10T18:46:00.000
2
0
0
1
debugging,python-2.7,tornado
20,555,024
2
true
1
0
If you are running your app using foreman you would set you environment variable in .env file in root project folder. Setting the below env variable in my .env file did the tick form me. PYTHONUNBUFFERED=true Now I can set code breakpoints in my app, and also print output to server logs while running the app using for...
1
3
0
How could I set a break point in my tornado app? I tried pdb, but Tornado app seams to be ignoring my pdb.set_trace() command in my app.
Set break points in Tornado app
1.2
0
0
1,963
17,031,075
2013-06-10T19:12:00.000
1
0
0
1
google-app-engine,email,python-2.7,webapp2,unsubscribe
17,033,151
1
true
1
0
Each new class implies a new query, which adds to the total cost. Pack as much information that is practical into the User class. A simple boolean in the User class should work for active/inactive or subscribe/unsubscribe. Your app needs to accept emails to receive the Unsubscribe request and set the associated bool...
1
0
0
I'm sending automated emails and hence I should deliver an unsubscribe function. I have a User entity that is not used much, only when a user registers and the emails can be send to users who are not registered as Users. So when I send an email and I must include an unsubscribe link, should I keep a whole separate enti...
How to implement unsubscribe usecase for website
1.2
0
0
138
17,032,676
2013-06-10T20:55:00.000
1
0
0
1
python,celery,pacemaker
18,737,345
1
false
0
0
The short answer is "yes." Pacemaker will do what you want, here. The longer answer is that your architecture is tricky due to the requirement to restart in the middle of a sequence. You have two solutions available here. The first is to use some sort of database (or a DRBD file system) to record the fact that 25 of th...
1
2
0
As far as I know about celery, celery beat is a scheduler considered as SPOF. It means the service crashes, nothing will be scheduled and run. My case is that, I will need a HA set up with two schedulers: master/slave, master is making some calls periodically(let's say every 30 mins) while slave can be idle. When mast...
celery beat HA - using pacemaker?
0.197375
0
0
1,055
17,037,621
2013-06-11T06:16:00.000
0
0
0
1
python,cloud,openstack,openstack-nova
17,218,519
1
true
0
0
most of the python clients for openstack have a not so well documented --debug flag, this will show the api queries occurring in incredibly unsafe verbosity.
1
2
0
I want to trace the functions used by a particular command, specifically for OpenStack. Now, I have a command, let's say 'nova image-list', which shows the images available in the repository. I want to know what functions is this command calling? I tried with strace, but the maximum I could get was the files that the c...
How to track the functions used by a python command?
1.2
0
0
135
17,039,253
2013-06-11T08:06:00.000
1
0
1
0
python,setuptools,setup.py
17,070,902
1
false
0
0
The site-packages directories is supposed to contain modules (e.g. spam.py) or packages (spam/__init__.py). In a setup script, the things referenced in py_modules and packages will get installed in site-packages. Could you explain what it is you want to do that does not work with py_modules or packages?
1
1
0
I want to copy some files to the site-packages folder. How to define in setup.py to copy files to the site-packes folder instead of a subfolder?
Copy files to site-packages
0.197375
0
0
1,190
17,039,873
2013-06-11T08:44:00.000
2
0
0
0
python,node.js,socket.io
17,039,955
1
false
1
0
Expose a Restful API on the chat server. Then your Django web application can easily make API calls to modify state in the chat server. Doing anything else is more complicated and most likely unnecessary.
1
1
0
I am building a chat application that consists of a Django web backend with a Node.js/socket.io powered chat server. There will be instances when changes made via the web interface (e.g. banning a user) need to be pushed immediately to the chat server. I can think of the following options: Use a Python-based socket.io...
Communicating with a Node.js server application
0.379949
0
1
361
17,040,209
2013-06-11T09:01:00.000
0
0
0
1
python,google-app-engine,debugging,ide,breakpoints
18,138,699
2
false
0
0
The latest version of PyDev (2.8.1) supports GAE debugging. However, "Edit and Continue Debugging or Interactive Debugging" feature seems to have stopped working.
1
2
0
I'm developing on GAE-Python 2.7 using Eclipse+PyDev as IDE. Since GAE SDK 1.7.6 (March 2013), where Google "broke" support for breakpoints*, I've been using the old dev server to continue debugging the application I'm working on. However, Google will drop support of the old dev server as of July 2013 and, since I do ...
Alternative IDE supporting debugging for Google App Engine in Python (Eclipse + PyDev no debug support on SDK 1.7.6+)
0
0
0
927
17,043,814
2013-06-11T12:13:00.000
0
0
0
1
python,python-2.7,permissions,permission-denied,ioerror
52,801,091
3
false
0
0
Although your code seems correct, I think it's better to assign an absolute path. If you develop on your local machine and the app runs on another server, there is probably some differences, like, who calls the process. Logs are recommended to be written to /var/log/app_name
2
6
0
I am creating Log file for the code but I am getting the following error : [Tue Jun 11 17:22:59 2013] [error] [client 127.0.0.1] import mainLCF [Tue Jun 11 17:22:59 2013] [error] [client 127.0.0.1] File "/home/ai/Desktop/home/ubuntu/LCF/GA-LCF/mainLCF.py", line 10, in [Tue Jun 11 17:22:59 2013] [error] [client ...
Why am I getting IOError: [Errno 13] Permission denied?
0
0
0
27,894
17,043,814
2013-06-11T12:13:00.000
0
0
0
1
python,python-2.7,permissions,permission-denied,ioerror
17,044,205
3
false
0
0
Looks like logging tried to open the logfile as /genetic.log. If you pass filename as a keyword argument to logging.basicConfig it creates a FileHandler which passes it to os.path.abspath which expands the filename to an absolute path based on your current working dir. So you're either in your root dir or your code cha...
2
6
0
I am creating Log file for the code but I am getting the following error : [Tue Jun 11 17:22:59 2013] [error] [client 127.0.0.1] import mainLCF [Tue Jun 11 17:22:59 2013] [error] [client 127.0.0.1] File "/home/ai/Desktop/home/ubuntu/LCF/GA-LCF/mainLCF.py", line 10, in [Tue Jun 11 17:22:59 2013] [error] [client ...
Why am I getting IOError: [Errno 13] Permission denied?
0
0
0
27,894
17,045,229
2013-06-11T13:24:00.000
0
0
1
1
python,easy-install
17,045,827
2
false
0
0
It's hard to say without providing us operation system information you use. For example in OSX, easy_install has it's own versions, I just type easy_install[tab][tab] to get all available version of easy_install. In OSX and debian and redhat I've got these: easy_install easy_install-2.5 easy_install-2.6 easy_install-...
1
0
0
I'm trying to install a python package using easy_install. There are several python versions installed. This causes the package to be installed on python2.7, whereas I want it to be installed on python2.4. Suggestions? Thanks Edit: I already have tried easy_install-2.4. I get -bash: easy_install-2.4: command not found
Install package on multiple python versions using easy_insatll
0
0
0
103
17,046,461
2013-06-11T14:21:00.000
3
0
0
1
java,python,file,rename,move
17,046,562
3
true
0
0
If you use java 7, you can simply use WatchService and WatchKey. This is a observer to watch a directory and each time something is changed, created or deleted you can do an action/file handling.
1
2
0
I'm trying to detect when a file is being moved or renamed in windows and I want to then use that change to update a database. When I say file move: I mean moving from one directory to another from ".../A/foo.txt" to ".../B/foo.txt". When I say file rename: I mean renaming but staying in the same directory ".../A/foo....
How to Detect File Rename / Move in Windows
1.2
0
0
1,402
17,046,929
2013-06-11T14:41:00.000
0
0
0
1
python,emacs,command,interpreter
17,047,535
2
false
0
0
AFAIS the keys are the same as in M-x shell. See menu In/Out for available keys/commands.
1
12
0
Inside emacs I am running interpreters for several different languages (python, R, lisp, ...). When I run the interpreters through the terminal in most cases I can use the up arrow to see the last command or line of code that I entered. I no longer have this functionality when I am running the interpreters in emacs. Ho...
Command history in interpreters in emacs
0
0
0
1,865
17,047,285
2013-06-11T14:57:00.000
0
0
1
0
python,gcc,header-files,setup.py
17,047,466
1
true
0
0
Just export CPLUS_INCLUDE_PATH=/path/to/desired/include/directory and re-run the installation script.
1
4
0
Basically the title says it all. I have a non-standard path for a library's header files and need to include it in the search path of a python installation script.
Specify header file location for a python setup.py installation
1.2
0
0
1,731
17,048,540
2013-06-11T15:54:00.000
0
1
1
0
php,python,code-analysis
17,223,867
4
false
0
0
Although a lot of suggestions point towards pycallgraph and phpcallgraph I don't think these will do what you want to do - these are for runtime analysis, whereas what it sounds like you want to do static analysis. I'm not aware of any tools for this, but, given that you're only interested in the workings of a single c...
1
6
0
I am looking for an easy-to-use tool which can visualize the 'inner working' of a class, written e.g. in PHP. What I would like to see are the different class methods, and how they are related (method A calls method B etc). Is there such a tool to create such a graph? In a further step, maybe there is a tool which also...
What tools are available to visualize in-class dependencies (e.g. for PHP)?
0
0
0
885
17,049,030
2013-06-11T16:20:00.000
0
0
1
0
python,setuptools,distutils
17,070,977
1
false
0
0
distutils imports all modules to byte-compile them (i.e. create the pyc and maybe pyo files) at build time and/or install time. There is no option currently to have a module skipped. You could write your setup script so that a different sdist is generated for Python 2 and Python 3 (so for example somemodule2.py would...
1
1
0
I have a Python library written to work under both Python 2 and Python 3, with all the version-specific code localized in one module that exists in two variants, one source code file for Python 2 and one for Python 3. Each file contains code that raises a SyntaxError if imported into the wrong Python version. When I pa...
Packaging python libraries with version-specific (2/3) code
0
0
0
86
17,051,552
2013-06-11T18:49:00.000
0
0
1
0
python,configparser
17,052,268
1
false
0
0
At best, I think you could change the option value to set it empty.
1
0
0
When using ConfigParser to parse multiple configuration files at the same time, is it possible to have an option from the first file removed by the second, and not just have it's value changed?
Use Python's ConfigParser to automatically remove options
0
0
0
298
17,052,725
2013-06-11T20:02:00.000
6
0
1
0
python,django
17,052,782
2
false
1
0
Python is a programming language. Django is a web framework built using Python, designed to simplify the creation of websites. It provides a set of common functionality to reduce the amount of trivial code that you need to write. Django provides: An administration panel A database modeling layer A templating system Fo...
1
5
0
I'm looking at a job possibility that has a need for both Django and Python. I have some experience with Python but none with Django, nor do I know precisely what Django is. Can someone please explain the difference between Django and Python, how they are related and what they are used for? Thanks in advance for all yo...
What is the difference between Django and Python?
1
0
0
9,241
17,053,548
2013-06-11T20:48:00.000
3
0
0
0
python,machine-learning,multiprocessing,scikit-learn
17,070,022
1
false
0
0
I don't think this is possible. You could implement something with OpenMP inside the minibatch processing. I'm not aware of any parallel minibatch k-means procedures. Parallizing stochastic gradient descent procedures is somewhat hairy. Btw, the n_jobs parameter in KMeans only distributes the different random initializ...
1
6
1
In Scikit-learn , K-Means have n_jobs but MiniBatch K-Means is lacking it. MBK is faster than KMeans but at large sample sets we would like it distribute the processing across multiprocessing (or other parallel processing libraries). Is MKB's Partial-fit the answer?
How can i distribute processing of minibatch kmeans (scikit-learn)?
0.53705
0
0
1,981
17,053,671
2013-06-11T20:56:00.000
40
0
1
0
python,multithreading,numpy
17,054,932
5
true
0
0
Set the MKL_NUM_THREADS environment variable to 1. As you might have guessed, this environment variable controls the behavior of the Math Kernel Library which is included as part of Enthought's numpy build. I just do this in my startup file, .bash_profile, with export MKL_NUM_THREADS=1. You should also be able to do it...
3
63
1
I have to run jobs on a regular basis on compute servers that I share with others in the department and when I start 10 jobs, I really would like it to just take 10 cores and not more; I don't care if it takes a bit longer with a single core per run: I just don't want it to encroach on the others' territory, which woul...
How do you stop numpy from multithreading?
1.2
0
0
25,964
17,053,671
2013-06-11T20:56:00.000
12
0
1
0
python,multithreading,numpy
21,673,595
5
false
0
0
In more recent versions of numpy I have found it necessary to also set NUMEXPR_NUM_THREADS=1. In my hands, this is sufficient without setting MKL_NUM_THREADS=1, but under some circumstances you may need to set both.
3
63
1
I have to run jobs on a regular basis on compute servers that I share with others in the department and when I start 10 jobs, I really would like it to just take 10 cores and not more; I don't care if it takes a bit longer with a single core per run: I just don't want it to encroach on the others' territory, which woul...
How do you stop numpy from multithreading?
1
0
0
25,964
17,053,671
2013-06-11T20:56:00.000
52
0
1
0
python,multithreading,numpy
48,665,619
5
false
0
0
Only hopefully this fixes all scenarios and system you may be on. Use numpy.__config__.show() to see if you are using OpenBLAS or MKL From this point on there are a few ways you can do this. 2.1. The terminal route export OPENBLAS_NUM_THREADS=1 or export MKL_NUM_THREADS=1 2.2 (This is my preferred way) In your pytho...
3
63
1
I have to run jobs on a regular basis on compute servers that I share with others in the department and when I start 10 jobs, I really would like it to just take 10 cores and not more; I don't care if it takes a bit longer with a single core per run: I just don't want it to encroach on the others' territory, which woul...
How do you stop numpy from multithreading?
1
0
0
25,964
17,054,291
2013-06-11T21:38:00.000
0
0
0
1
python,subprocess,pipe
17,054,413
2
false
0
0
It sounds like you might be confusing stderr and the process's return code (available in proc.returncode after you've called proc.communicate()). stderr is the second output stream available to the process. It's generally used for printing error messages that shouldn't be mixed with the process's normal ("standard") ou...
1
0
0
I have code proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate() I tried invalid commands assigning to cmd, but stderr always is Null An invalid command like 'ls fds' returns 'ls: cannot access fds: No such file or directory' But the message doesn't appear in ...
can't get stderr value from a subprocess
0
0
0
221
17,055,472
2013-06-11T23:25:00.000
0
1
0
1
c++,python,c,api
44,001,898
2
false
0
0
I had the same problem but when I fixed all the \ to / and added a . at the beginning of the path it worked ie. the path should look sth like that PySys_SetPath("./Python/") or PySys_SetPath("C:/full/path/Python/")
1
1
0
I'm using the Python C API, and numerous times now I've tried using PySys_SetPath() to redirect the interpreter to a path where I've stored all of my scripts. Yet, every time I try it, I get the following error: Unhandled exception at 0x1e028482 in app.exe: 0xC0000005: Access violation reading location 0x00000004. I us...
Why won't PySys_SetPath() work?
0
0
0
3,054
17,055,496
2013-06-11T23:28:00.000
0
0
0
1
android,python,unzip
64,447,721
3
false
0
1
A late entry...but all I had to do was rename the file to a .ZIP extension.
1
2
0
I am doing research with mobile apps and need to analyze their code after unzipping the .apk file. However, the process of unzipping naturally involves lots of IO, which doesn't make it scalable, I am thinking if it's possible to hold the unzipped data in memory, with several variables representing it, thus saving the ...
is it possible to unzip a .apk file(or generally any zipped file) into memory instead of writing it to fs
0
0
0
14,330
17,056,138
2013-06-12T00:55:00.000
1
1
0
0
python,testing,pytest,doctest
17,083,687
4
false
0
0
Could you try with the repo version of pytest and paste a session log? I'd think --doctest-modules should pick up any .py files.
2
26
0
We currently have pytest with the coverage plugin running over our tests in a tests directory. What's the simplest way to also run doctests extracted from our main code? --doctest-modules doesn't work (probably since it just runs doctests from tests). Note that we want to include doctests in the same process (and not...
How to make pytest run doctests as well as normal tests directory?
0.049958
0
0
7,851
17,056,138
2013-06-12T00:55:00.000
0
1
0
0
python,testing,pytest,doctest
53,343,424
4
false
0
0
worked with doctest as well as with plain tests in one module. for a non-doctest test to be picked up, standard py.test discovery mechanism applies: a module name with test prefix, test function with test prefix.
2
26
0
We currently have pytest with the coverage plugin running over our tests in a tests directory. What's the simplest way to also run doctests extracted from our main code? --doctest-modules doesn't work (probably since it just runs doctests from tests). Note that we want to include doctests in the same process (and not...
How to make pytest run doctests as well as normal tests directory?
0
0
0
7,851
17,056,818
2013-06-12T02:33:00.000
0
0
0
0
python,csv,file-io
21,414,260
4
false
0
0
I know this is an older question so maybe you have long since solved it but I think you are approaching this in a more complex way than is needed. I figure I'll respond in case someone else has the same problem and finds this. If you are doing things this way because you do not have a software key, it might help to kn...
1
7
1
Eprime outputs a .txt file like this: *** Header Start *** VersionPersist: 1 LevelName: Session Subject: 7 Session: 1 RandomSeed: -1983293234 Group: 1 Display.RefreshRate: 59.654 *** Header End *** Level: 2 *** LogFrame Start *** MeansEffectBias: 7 Procedure: trialProc itemID: 7 bias1Answer: 1 ...
Parsing a txt file into a dictionary to write to csv file
0
0
0
1,142
17,061,118
2013-06-12T08:38:00.000
1
1
1
0
python,performance
17,061,230
3
false
0
0
There isn't a specific set of circumstances in which C or C++ win. Pretty much any CPU-heavy code you write in C or C++ will run many times faster than the equivalent Python code. If you haven't noticed, it's simply because, for the problems you've had to solve in Python, performance has never been an issue.
1
7
0
It is always said that Python is not so efficient as other languages such as C/C++, Java etc. And it is also recommended to write the bottleneck part in C. But I've never run into such problems, maybe it's because most of the time it is the way you solve the problem rather than the efficiency of the language to bother....
Any real examples to show python's inefficiency?
0.066568
0
0
1,860
17,062,505
2013-06-12T09:52:00.000
4
0
0
0
python-3.x,sublimetext2
17,116,403
3
false
0
0
You can easily do this with two keystrokes - CtrlD,CtrlC.
1
2
0
In Netbeans its possible to create a macro for selecting a word and copying it to clipboard I wonder if its possible with Sublime Text 2 ? Thanks for any help. Edit : I understand that this is possible with a plugin. But I dont know Python, if any Python developers can create a plugin for this, it would be awesome!...
Sublime text - select word and copy to clipboard macro
0.26052
0
0
2,487
17,063,168
2013-06-12T10:26:00.000
0
1
1
0
java,python,perl,debugging
17,064,348
1
false
0
0
Yes, alter the host program (the java program ) so that it runs the perl program in a debugger You might well run into problems with the way that debuggers "attach" in different programming language environments. perl -d assumes a tty is there for interactive commands whereas java does something completely different
1
0
0
This question just came up in a discussion and i am curious to know . Is it possible to have a debugger that can debug 2 languages . For example . If i have Java program that references/opens/accesses/ a script (Perl or Python) then is it possible to have a debugger to be able to debug the Perl/Python script ? Note :...
Dual debugger Java + (Perl/Python) script
0
0
0
39
17,071,584
2013-06-12T17:24:00.000
0
0
0
1
python,bash,jenkins,environment-variables
64,924,366
2
false
0
0
import os os.environ.get("variable_name")
1
8
0
so I have a bash script in which I use the environment variables from Jenkins for example: QUALIFIER=echo $BUILD_ID | sed "s/[-_]//g" | cut -c1-12 Essentially I'm taking the build id, along with job name to determine which script to call from my main script. I want to use python instead so I was wondering whether I c...
How to use Jenkins Environment variables in python script
0
0
0
30,579
17,072,642
2013-06-12T18:25:00.000
2
0
1
0
python
17,072,705
1
false
0
0
afaict, no you won't have to reinstall all your modules, if you're only recompiling and make install, it will just overwrite already installed files. Though, if in a recent upgrade you've changed a dependency of python that has been used by a compiled module, then some extensions may break. But recompiling only those w...
1
1
0
I missed out the bz standard moudle during inital python compilation. This version of Python has been in use for a few months and quite a number of add-on modules such as numpy, scipy have been installed since then. Can anyone tell me if I recompile Python, do I have to re-install all add-on modules? Your help is muc...
will recompiling Python require re-install all add-on modules such as numpy, scipy?
0.379949
0
0
97
17,075,418
2013-06-12T21:09:00.000
4
1
0
0
python,fortran,embed
23,725,918
7
false
0
0
There is a very easy way to do this using f2py. Write your python method and add it as an input to your Fortran subroutine. Declare it in both the cf2py hook and the type declaration as EXTERNAL and also as its return value type, e.g. REAL*8. Your Fortran code will then have a pointer to the address where the python me...
1
8
1
I was looking at the option of embedding python into fortran90 to add python functionality to my existing fortran90 code. I know that it can be done the other way around by extending python with fortran90 using the f2py from numpy. But, i want to keep my super optimized main loop in fortran and add python to do some ad...
Embed python into fortran 90
0.113791
0
0
9,062
17,077,494
2013-06-13T00:23:00.000
-2
0
1
0
ipython,ipython-notebook
68,028,557
14
false
0
0
The %notebook foo.ipynb magic command will export the current IPython to "foo.ipynb". More info by typing %notebook?
1
370
0
I'm looking at using the *.ipynb files as the source of truth and programmatically 'compiling' them into .py files for scheduled jobs/tasks. The only way I understand to do this is via the GUI. Is there a way to do it via command line?
How do I convert a IPython Notebook into a Python file via commandline?
-0.028564
0
0
366,952
17,079,358
2013-06-13T04:38:00.000
1
0
0
1
python,windows,google-app-engine
17,086,966
1
false
1
0
I was having same problem with google app engine 1.8.0 then i installed the latest 1.8.1 and the issue fixed!
1
1
0
I'm install google app engine on my laptop and when i clicked on google app engine launcher icon, mouse change to loading icon then nothing run, nothing display and no error reported, just nothing. My laptop running with WIN7 64bit, Python27 installed. Please help.
Google App Engine Launcher not starting
0.197375
0
0
291
17,079,919
2013-06-13T05:39:00.000
0
0
1
1
python,openstack,openstack-nova
17,218,560
2
false
0
0
General rule of thumb for devstack. Always unstack.sh before re-running stack.sh or pulling from repositories and re-running stack.sh
1
0
0
I have installed openstack on Ubuntu 12.04 single node using devstack. Now, it was running smoothly till yesterday. When i ran ./stack.sh today, it showed an error ./stack.sh:672 nova-api did not start I have python-paste and python-pastedeploy installed. How to fix this error?
Error in devstack script. nova-api did not start?
0
0
0
3,196
17,081,821
2013-06-13T07:46:00.000
0
0
0
0
python,ironpython
37,896,844
5
false
0
1
All implementations can run on Eclipse via PyDev. So it kills the argument of which one to use as it is all the same language, implementations other than this instance are more domain specific. Iron Python targets Microsoft, Jython targets Java, Python targets itself. Each environment naturally has its own complier/lib...
2
13
0
I have to make a GUI for some testing teams. I have been asked to do it in Python, but when I Google, all I see is about Iron Python. I also was asked not to use Visual Studio because it is too expensive for the company. So if you have any idea to avoid that I would be very happy. I am still new to Python and programm...
Python vs Iron Python
0
0
0
21,603
17,081,821
2013-06-13T07:46:00.000
1
0
0
0
python,ironpython
30,813,721
5
false
0
1
If you're just trying to create a GUI that runs on Windows, C# on Visual Studio is the easiest way to go. Their free version, Community (used to be Express) provides all the Windows controls you're used to using with a drag and drop GUI builder.
2
13
0
I have to make a GUI for some testing teams. I have been asked to do it in Python, but when I Google, all I see is about Iron Python. I also was asked not to use Visual Studio because it is too expensive for the company. So if you have any idea to avoid that I would be very happy. I am still new to Python and programm...
Python vs Iron Python
0.039979
0
0
21,603
17,087,758
2013-06-13T13:02:00.000
-1
0
1
0
python
17,089,367
3
false
0
0
If your purpose is to not give away code, then just distribute the python-compiled library, rather than the source code for it. No need to manually weed code calls, just distribute the pyc versions of your files. If you're afraid that people will take your code and not give you credit, don't give them code if there is ...
2
13
0
I have the following situation: I am working on several projects which make use of library modules that I have written. The library modules contain several classes and functions. In each project, some subset of the code of the libraries is used. However, when I publish a project for other users, I only want to give awa...
Is there a tool that removes functions that are not used in Python?
-0.066568
0
0
755
17,087,758
2013-06-13T13:02:00.000
1
0
1
0
python
17,096,348
3
false
0
0
I agree with @zmo - one way to avoid future problems like this is to plan ahead and make your code as modular as possible. I would have suggested putting the classes and functions in much smaller files. This would mean that for every project you make, you would have to hand-select which of these smaller files to includ...
2
13
0
I have the following situation: I am working on several projects which make use of library modules that I have written. The library modules contain several classes and functions. In each project, some subset of the code of the libraries is used. However, when I publish a project for other users, I only want to give awa...
Is there a tool that removes functions that are not used in Python?
0.066568
0
0
755
17,087,905
2013-06-13T13:09:00.000
1
0
0
0
python,sockets,tcp
17,088,117
1
false
0
0
You can absolutely do this using Twisted Python. You just accept the connections and set up your own handling logic (of course the library does not including built-in support for your particular communication pattern exactly, but you can't expect that).
1
0
0
I am trying to create a server in Python 2.7.3 which sends data to all client connections whenever one client connection sends data to the server. For instance, if client c3 sent "Hello, world!" to my server, I would like to then have my server send "Hello, world!" to client connections c1 and c2. By client connectio...
How would I handle multiple sockets and send data between them in Python 2.7.3?
0.197375
0
1
108
17,092,893
2013-06-13T17:00:00.000
0
0
0
0
python,django,django-1.5
17,105,379
1
false
1
0
Resolved. I had deploy settings in a different file overriding the allowed_hosts in settings.py. Appologies missed this before posting. Thanks for the responses received.
1
5
0
I have updated to django 1.5 and am getting the following message: SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): localhost:8000 I have tried localhost, 127.0.0.1, localhost:8000 in ALLOWED_HOSTS. I have also tried ['*'] all without success. Anybody any ideas where I am going wrong...
django 1.5 update ALLOWED_HOSTS failing SuspiciousOperation
0
0
0
4,184
17,093,372
2013-06-13T17:27:00.000
5
0
0
0
python,flask,query-string
21,792,010
2
false
1
0
request.query_string also seems to work.
1
6
0
Is there a way to get the raw query string or a list of query string parameters in Flask? I know how to get query string parameters with request.args.get('key'), but I would like to be able to take in variable query strings and process them myself. Is this possible?
Get raw query string in flask
0.462117
0
0
4,634
17,094,157
2013-06-13T18:13:00.000
0
0
0
0
python,file,security,directory
17,111,088
4
false
0
0
Here's the approach I use, which I think has the benefits of giving easy control over access to the files, and preventing path manipulation. When the user uploads the file: Read the filename. Generate a random alphanumeric token. Save the file in a non-web accessible directory with a filename of that token. Record the...
1
2
0
Part of my app requires the client to request files. Now, a well-behaved client will only request files that are safe to give, but I don't want a user to go about supplying "../../../creditCardInfo.xls", instead. What's the best practice for/simplest way to secure a filename to make sure that no files are served that w...
Secure user-provided filename
0
0
0
1,341
17,094,525
2013-06-13T18:34:00.000
1
0
1
0
python,komodo
17,094,602
2
false
0
0
You can choose the file type/language when you create a new file in Komodo. Instead of selecting File/New/New File, use File/New/File from Template, and choose Python (for 2.x) or Python3 from the dialog. The file type will take effect immediately for syntax highlighting and checking. After you do this for the first ti...
2
2
0
I just downloaded komodo edit for editing python and I have an issue with its configuration. How would I get the editor to automatically assume that the code I type will be python. The highlighting of code parts only comes after i've typed the whole code and then saved adding the .py suffix.
How do I set the file type for a new file in Komodo Edit/IDE?
0.099668
0
0
1,153
17,094,525
2013-06-13T18:34:00.000
0
0
1
0
python,komodo
30,636,863
2
false
0
0
Also, after launching new file, you can change the language from the lower portion of the Komodo Edit main window. You don't have to save as .py file.
2
2
0
I just downloaded komodo edit for editing python and I have an issue with its configuration. How would I get the editor to automatically assume that the code I type will be python. The highlighting of code parts only comes after i've typed the whole code and then saved adding the .py suffix.
How do I set the file type for a new file in Komodo Edit/IDE?
0
0
0
1,153
17,094,940
2013-06-13T19:00:00.000
0
1
0
0
python,flash,selenium
17,096,754
2
false
0
0
As long as you have access to the flash source code it is possible (although it requires some work). To do that you have to expose the flash actions you want to test using selenium. This requires that you make the methods available in Flash to execute via Javascript. Once you can do that, you should be able to autom...
1
2
0
I'm using Selenium with Python to test a web application. The app has a Flash component that I'd like to test. The only references I've seen to using Selenium with Flash refer to Flash-Selenium which hasn't been updated in several years. Is testing Flash with Selenium even possible?
Selenium/Python/Flash - How?
0
0
1
3,667
17,096,050
2013-06-13T20:07:00.000
2
0
1
0
python-3.x,intellij-idea,pycharm
45,573,678
2
false
0
0
It is a rough ride for anyone using the IntelliJ IDEA editor coming from any of their dedicated editors (PyCharm, PHPStorm, etc). They look almost the same, but there are critical differences that often go undocumented. A couple tips for anyone struggling with these types of issues: In IntelliJ IDEA, there's a "Pro...
1
14
0
I use JetBrains' IntelliJ IDEA 12 for both Java and Python development (Python development through the official Python IntelliJ plugin). My friend uses PyCharm (same company and similar interface, just dedicated to Python) and he showed me a cool feature of PyCharm: there's a Python package manager built-in to the IDE....
IntelliJ IDEA 12 Python Package Manager?
0.197375
0
0
7,409
17,098,654
2013-06-13T23:05:00.000
2
0
0
0
python,pandas,dataframe
63,390,537
13
false
0
0
Another quite fresh test with to_pickle(). I have 25 .csv files in total to process and the final dataframe consists of roughly 2M items. (Note: Besides loading the .csv files, I also manipulate some data and extend the data frame by new columns.) Going through all 25 .csv files and create the dataframe takes around 14...
1
415
1
Right now I'm importing a fairly large CSV as a dataframe every time I run the script. Is there a good solution for keeping that dataframe constantly available in between runs so I don't have to spend all that time waiting for the script to run?
How to reversibly store and load a Pandas dataframe to/from disk
0.03076
0
0
432,843
17,099,364
2013-06-14T00:30:00.000
4
0
0
0
python,database,parsing,web-scraping
17,099,503
5
false
0
0
Python with BeautifulSoup and Urllib2 will probably serve you well. Of course, it is questionable as to whether or not you should be scraping data from other websites and you might find yourself in a constant struggle if those websites change layouts.
2
4
0
I want to create a website that extracts information from other websites and print them into my website, I am on research step, so I would like to hear some opinions and what's the best solution to this project? I have heard that Python using parser can do this I just want to know what's the path I should take and whic...
How can I get data from other websites?
0.158649
0
1
314
17,099,364
2013-06-14T00:30:00.000
0
0
0
0
python,database,parsing,web-scraping
17,100,130
5
false
0
0
You can write some web spiders to gather some data from other website.By using urllib2 or requests can help you download the html from the website.Beautiful or PyQuery can help you parse the html and get the data you want.
2
4
0
I want to create a website that extracts information from other websites and print them into my website, I am on research step, so I would like to hear some opinions and what's the best solution to this project? I have heard that Python using parser can do this I just want to know what's the path I should take and whic...
How can I get data from other websites?
0
0
1
314
17,099,581
2013-06-14T01:00:00.000
1
1
0
1
java,python,sip,lync,office-communicator
17,125,543
2
false
0
0
Well, if you are on Lync 2013, you can have a look at UCWA ucwa.lync.com. It's a web service that allows to log in to Lync and use IM, presence, etc. You can use then any language you want. I played with it using Node on Mac OS X, for example.
1
2
0
I need to send out Instant Messages to a Lync/OCS server from Linux programmatically as an alerting mechanism. I've looked into using python dbus and pidgin-sipe with finch or pidgin, but they aren't really good for sending one-off instant messages (finch and pidgin need to be running all the time). Ideally, I'd have ...
Sending out IMs to Lync/OCS programmatically
0.099668
0
0
3,151
17,099,850
2013-06-14T01:39:00.000
3
1
1
0
python,arrays,numpy,pypy
17,101,084
1
false
0
0
array.array is a memory efficient array. It packs bytes/words etc together, so there is only a few bytes of extra overhead for the entire array. The one place where numpy can use less memory is when you have a sparse array (and are using one of the sparse array implementations) If you are not using sparse arrays, you s...
1
3
1
My project currently uses NumPy, only for memory-efficient arrays (of bool_, uint8, uint16, uint32). I'd like to get it running on PyPy which doesn't support NumPy. (failed to install it, at any rate) So I'm wondering: Is there any other memory-efficient way to store arrays of numbers in Python? Anything that is suppor...
PyPy and efficient arrays
0.53705
0
0
919
17,100,293
2013-06-14T02:38:00.000
1
0
0
0
python,performance,sockets,loops,select
17,100,500
1
true
0
0
I'd use a priority queue to keep track of who's been dormant. Notice, however, that you don't actually need a full-fledged priority queue if you only want to time out connections that have been inactive for a certain fixed amount of time. You can use a linked list instead: The linked list stores all of the sockets in...
1
0
0
I'm designing a Python SSL server that needs to be able to handle up to a few thousand connections per minute. If a client doesn't send any data in a given period of time, the server should close their connection in order to free up resources. Since I need to check if each connection has expired, would it be more effic...
Connections with timeout: better to set sockets to non-blocking and loop through them or use select() and maintain a priority queue?
1.2
0
1
235
17,113,591
2013-06-14T16:55:00.000
0
0
0
0
python,cmd,shutdown,minecraft
17,114,583
3
false
0
0
I would look at the tools in the os module, it would also help if i had more information about what operating system you are using.
2
0
0
I have multiple minecraft servers running on the machine. servers are started with bat files that have according titles. My question is that, how can i shut down a certain minecraft server with python? Or how to kill a titled cmd.exe process with python?
How to shut down a minecraft server with python?
0
0
0
1,744
17,113,591
2013-06-14T16:55:00.000
0
0
0
0
python,cmd,shutdown,minecraft
17,331,529
3
false
0
0
I ended up using autohotkey. launched autohotkey with python and made separate .ahk files for every server.
2
0
0
I have multiple minecraft servers running on the machine. servers are started with bat files that have according titles. My question is that, how can i shut down a certain minecraft server with python? Or how to kill a titled cmd.exe process with python?
How to shut down a minecraft server with python?
0
0
0
1,744
17,113,613
2013-06-14T16:55:00.000
0
0
0
0
python,machine-learning,artificial-intelligence,neural-network
17,117,416
2
false
0
0
Assume you have v visible units, and h hidden units, and v < h. The key idea is that once you've fixed all the values for each visible unit, the hidden units are independent. So you loop through all 2^v subsets of visible unit activations. Then computing the likelihood for the RBM with this particular activated visi...
1
0
1
I have been researching RBMs for a couple months, using Python along the way, and have read all your papers. I am having a problem, and I thought, what the hey? Why not go to the source? I thought I would at least take the chance you may have time to reply. My question is regarding the Log-Likelihood in a Restricted Bo...
Finding log-likelihood in a restricted boltzmann machine
0
0
0
1,642
17,116,718
2013-06-14T20:24:00.000
1
0
0
1
android,python,django,web,localhost
17,116,746
9
false
1
0
If both are connected to the same network, all you need to do is provide the IP address of your server (in your network) in your Android app.
6
31
0
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home. i read a lot questions and answers...
how to access my 127.0.0.1:8000 from android tablet
0.022219
0
0
33,438
17,116,718
2013-06-14T20:24:00.000
0
0
0
1
android,python,django,web,localhost
61,816,349
9
false
1
0
Try this python manage.py runserver then connect both tablet and system to same wifi and browse in the address eg: python manage.py runserver 192.168.0.100:8000 In tablet type that url in adress bar
6
31
0
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home. i read a lot questions and answers...
how to access my 127.0.0.1:8000 from android tablet
0
0
0
33,438
17,116,718
2013-06-14T20:24:00.000
1
0
0
1
android,python,django,web,localhost
17,116,796
9
false
1
0
need to know the ip address of your machine .. Make sure both of your machines (tablet and computer) connected to same network 192.168.0.22 - say your machine address do this : 192.168.0.22:8000 -- from your tablet this is it !!!
6
31
0
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home. i read a lot questions and answers...
how to access my 127.0.0.1:8000 from android tablet
0.022219
0
0
33,438
17,116,718
2013-06-14T20:24:00.000
16
0
0
1
android,python,django,web,localhost
17,116,791
9
true
1
0
You can find out what the ip address of your PC is with the ipconfig command in a Windows command prompt. Since you mentioned them being connected over WiFi look for the IP address of the wireless adapter. Since the tablet is also in this same WiFi network, you can just type that address into your tablet's browser, wi...
6
31
0
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home. i read a lot questions and answers...
how to access my 127.0.0.1:8000 from android tablet
1.2
0
0
33,438
17,116,718
2013-06-14T20:24:00.000
6
0
0
1
android,python,django,web,localhost
17,116,785
9
false
1
0
127.0.0.1 is a loopback address that means, roughly, "this device"; your PC and your android tablet are separate devices, so each of them has its own 127.0.0.1. In other words, if you try to go to 127.0.0.1 on your Android tab, it's trying to connect to a webserver on the Android device, which is not what you want. Ho...
6
31
0
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home. i read a lot questions and answers...
how to access my 127.0.0.1:8000 from android tablet
1
0
0
33,438
17,116,718
2013-06-14T20:24:00.000
23
0
0
1
android,python,django,web,localhost
48,594,665
9
false
1
0
Though this thread was active quite a long time ago. This is what worked for me on windows 10. Posting it in details. Might be helpful for the newbies like me. Add ALLOWED_HOSTS = ['*'] in django settings.py file run django server with python manage.py 0.0.0.0:YOUR_PORT. I used 9595 as my port. Make firewall to allo...
6
31
0
I am developing a webpage in django (on my pc with windows 7) and now i need to test some pages in tablet pcs. suddenly the thought came if i can have an access to my localhost in windows from android tablet. is that possible? I am in the same wifi connection in both devices at home. i read a lot questions and answers...
how to access my 127.0.0.1:8000 from android tablet
1
0
0
33,438
17,118,747
2013-06-14T23:35:00.000
3
0
1
1
python,process
17,118,788
1
true
0
0
Python has good support for ZeroMQ, which is much easier and more robust than using raw sockets. The ZeroMQ site treats Python as one of its primary languages and offers copious Python examples in its documentation. Indeed, the example in "Learn the Basics" is written in Python.
1
2
0
I'm having a problem creating a inter-process communication for my python application. I have two python scripts at hand, let's say A and B. A is used to open a huge file, keep it in memory and do some processing that Mysql can't do, and B is a process used to query A very often. Since the file A needs to read is real...
Inter-process communication for python
1.2
0
0
1,821
17,119,388
2013-06-15T01:29:00.000
0
0
0
0
javascript,python,tinymce,pyqt,qwebkit
17,288,641
1
false
1
1
EvaluateJavaScript does make javascript function calls, or embed a whole javascript file. The following details out the attempts to solve the problem: The approach of first reading the tinyMCE.js file and then using that in an evaluatejavascript method embeds the javascript somewhere, and can't be sniffed out in a web...
1
0
0
as the question states, I wish to embed a tinymce editor in a PyQT webkit component. As far as I understand, evaluateJavascript allows for js functions to be called. However, when I try loading tinymce.min.js, the editor does not display anything at all. As suspected, when evaluating a javascript that 'loads' other jav...
Embedding a TinyMCE editor in PyQT QWebkit
0
0
0
239
17,122,268
2013-06-15T09:46:00.000
0
0
1
0
python,text,curses
17,122,309
2
false
0
0
You create static text by putting it in a separate window. Create a window large enough for all the text, and then create a smaller window for the dynamic text. Text is colored by passing the various COLOR_* constants as the text attribute.
1
2
0
I am creating a text adventure. How could I to add static text to this. What i mean is some text that always stays on the left side of the window. Even if all the other text is scrolling down. Also how could i make this text red.
(python) How to create static text in curses
0
0
0
2,751
17,122,479
2013-06-15T10:10:00.000
0
0
0
0
python,printing
17,122,495
2
false
0
0
Wherever you call your printing routine, add a small unique header to printout (module name+line number) to identify the place print was initiated from.
2
1
0
This application I am working on (GUI based), has well over a dozen modules. On running the application and using it, there is this particular action(clicking a label) upon which I get tons of empty prints in the stdout and because of which I suspect the application's performance is suffering. Now the problem is I am u...
how to find out exactly from where print is being executed
0
0
0
79
17,122,479
2013-06-15T10:10:00.000
6
0
0
0
python,printing
17,122,501
2
true
0
0
Replace sys.stdout with a file-like that will spew out a traceback when its write() method is called.
2
1
0
This application I am working on (GUI based), has well over a dozen modules. On running the application and using it, there is this particular action(clicking a label) upon which I get tons of empty prints in the stdout and because of which I suspect the application's performance is suffering. Now the problem is I am u...
how to find out exactly from where print is being executed
1.2
0
0
79
17,123,649
2013-06-15T12:29:00.000
0
0
1
0
python,package,sublimetext
21,785,292
1
false
0
0
Remove existing /User/Python.sublime-package and try manually unzip Python.sublime-package (change it's extension to .zip) to Package folder /Packages/Python. Package folder can be revealed via Preferences->Browse Packages... command.
1
0
0
I tried adding some extra features to my python package in Sublime Text 2 and it ended up showing: Error trying to parse settings . Unexpected trailing characters in ... {my path} \User\Python.sublime-package:1:11 I searched the internet for about 3 hours and my frustration grown off the charts. My ideea was trying to ...
Sublime Text 2 Python.sublime-package
0
0
0
229
17,124,966
2013-06-15T15:02:00.000
0
0
1
0
python,ida
17,152,569
1
false
0
0
Make sure that your Python interpreter is 32 bit and not a more recently compiled 64 bit version, even if you are running a 64 bit OS. If you need to compile your own you will need the Development kit for your version of IDA. Back in the 5.5 days you had to actually build your own, but idapython is now included as par...
1
1
0
I am trying to install IDA Pro 5.5 on a windows 7 machine. I have installed python 2.5. When starting IDA, i get error msg that init.py failed. While looking inside this file, i found that it is importing _idaapi module, but I cannot find this module anywhere in IDA installation directory. There is a python module name...
IDAPython error no module _idaapi
0
0
0
4,548
17,125,247
2013-06-15T15:35:00.000
4
0
0
0
python,python-2.7,machine-learning,svm,scikit-learn
17,133,162
1
false
0
0
First, for text data you don't need a non linear kernel, so you should use an efficient linear SVM solver such as LinearSVC or PassiveAggressiveClassifier instead. The SMO algorithm of SVC / libsvm is not scalable: the complexity is more than quadratic which is practice often makes it useless for dataset larger than 50...
1
2
1
I have a text data labelled into 3 classes and class 1 has 1% data, class 2 - 69% and class 3 - 30%. Total data size is 10000. I am using 10-fold cross validation. For classification, SVM of scikit learn python library is used with class_weight=auto. But the code for 1 step of 10-fold CV has been running for 2 hrs and ...
SVM Multiclass Classification using Scikit Learn - Code not completing
0.664037
0
0
2,914
17,125,248
2013-06-15T15:35:00.000
1
0
0
0
python,string,pandas,series
52,143,806
2
false
0
0
Get the Series head(), then access the first value: df1['tweet'].head(1).item() or: Use the Series tolist() method, then slice the 0'th element: df.height.tolist() [94, 170] df.height.tolist()[0] 94 (Note that Python indexing is 0-based, but head() is 1-based)
1
2
1
I think I have a relatively simply question but am not able to locate an appropriate answer to solve the coding problem. I have a pandas column of string: df1['tweet'].head(1) 0 besides food, Name: tweet I need to extract the text and push it into a Python str object, of this form...
Get first element of Pandas Series of string
0.099668
0
0
8,156
17,127,306
2013-06-15T19:47:00.000
1
0
0
0
python,database,pysqlite
17,382,716
1
true
0
0
Well. every table in a sqlite has a rowid. Select one and delete it?
1
0
0
Need to get one row from a table, and delete the same row. It does not matter which row it is. The function should be generic, so the column names are unknown, and there are no identifiers. (Rows as a whole can be assumed to be unique.) The resulting function would be like a pop() function for a stack, except that the ...
row_pop() function in pysqlite?
1.2
1
0
64
17,128,130
2013-06-15T21:36:00.000
0
0
0
1
python,google-app-engine
35,530,496
2
false
1
0
You need to add the requests/requests sub-folder to your project. From your script's location (.), you should see a file at ./requests/__init__.py. This applies to all modules you include for Google App Engine. If it doesn't have a __init__.py directly under that location, it will not work. You do not need to add the m...
1
4
0
I'm trying to import the requests module for my app which I want to view locally on Google App Engine. I am getting a log console error telling me that "no such module exists". I've installed it in the command line (using pip) and even tried to install it in my project directory. When I do that the shell tells me: "Re...
Python Request Module - Google App Engine
0
0
0
4,323
17,128,740
2013-06-15T23:07:00.000
0
0
0
0
python,django,django-south
17,128,801
2
false
1
0
I usually make a temporary modification to the migration script that fails. Comment out or modify the parts that are not needed, run the migrations, then restore everything to the way it was before. It's not ideal, and it involves some duplication of work - you have to do the same steps both on dev machine and on the ...
1
2
0
I am using a 3rd party app inside my django application and the older versions of it had a dependancy on the django auth model, but the newer version supports the custom auth model of django 1.5. The problem I am having is that when I install the app and migrate app, it breaks on the migration 002 because it is refere...
South skip broken migrations
0
0
0
1,534
17,128,878
2013-06-15T23:28:00.000
1
1
0
1
python,vim,plugins
17,131,966
4
false
0
0
All folders in the rtp (runtimepath) option need to have the same folder structure as your $VIMRUNTIME ($VIMRUNTIME is usually /usr/share/vim/vim{version}). So it should have the same subdirectory names e.g. autoload, doc, plugin (whichever you need, but having the same names is key). The plugins should be in their cor...
1
3
0
I was trying to install autoclose.vim to Vim. I noticed I didn't have a ~/.vim/plugin folder, so I accidentally made a ~/.vim/plugins folder (notice the extra 's' in plugins). I then added au FileType python set rtp += ~/.vim/plugins to my .vimrc, because from what I've read, that will allow me to automatically source ...
Vim plugins don't always load?
0.049958
0
0
938
17,132,334
2013-06-16T10:30:00.000
0
0
0
0
python,mysql,database,django
17,132,550
1
false
1
0
I have solved this issue by wrapping my view in the @transaction.autocommit decorator and executing transaction.commit() immediately before checking in the database if an answer with a particular client_id exists. This accomplishes the "refresh" I was aiming for.
1
0
0
I have a Django app with a MySQL database which allows answering of questions on an HTML page. The answers get sent to the server via AJAX calls. These calls are initiated by various JavaScript events and can often be fired multiple times for one answer. When this happens, multiple save requests for one answer get sent...
Simultanous AJAX requests and MySQL database data visibility in Django
0
0
0
323
17,136,085
2013-06-16T17:51:00.000
0
0
0
0
python,string,types,type-conversion
17,136,094
4
false
0
0
I'm not quite sure what your question is, but print automatically calls str on all of it's arguments ... So if you want the same output as print to be put into your file, then myfile.write(str(whatever)) will put the same text in myfile that print (x) would have put into the file (minus a trailing newline that print p...
1
1
0
I am using python and XMLBuilder, a module I downloaded off the internet (pypi). It returns an object, that works like a string (I can do print(x)) but when I use file.write(x) it crashes and throws an error in the XMLBuilder module. I am just wondering how I can convert the object it returns into a string? I have co...
Converting a string-like object into a string in python
0
0
1
165
17,137,050
2013-06-16T19:49:00.000
3
0
0
0
python,django,model-view-controller,event-handling,tkinter
17,137,094
2
false
1
1
Tkinter is a GUI library (for desktop applications) and Django is for web development. Both are completely different and in fact it is useless to compare them even.
1
0
0
I have a school project where my team needs to build a board game. We want to use Python based on all the good things we have heard. I have been researching MVC frameworks and came across Django (its part of my installation on Pydev). I have a Mac, fyi. I have also been looking up Tkinter but cant seem to understand w...
Trying to understand Python and all its moving parts - What is the difference between Tkinter and Django
0.291313
0
0
2,632
17,138,389
2013-06-16T22:38:00.000
1
1
0
0
python,.net,ios
17,138,453
4
false
0
1
I learned to write iOs apps from the CS 193P iPhone Application Development course on iTunes U. It's fantastic and I highly recommend it if you are sure iOs is what you want to do.
2
0
0
I really would like to start getting into Objective C coding, specifically so I can write applications for iOS. My coding background is that I have written C# .NET GUI Windows apps and PHP web scripts for years; I've also become a very good Python coder in the past year. I have written hundreds of useful command-line P...
Best intro to iOS for Python/PHP/C# Coder
0.049958
0
0
166
17,138,389
2013-06-16T22:38:00.000
1
1
0
0
python,.net,ios
17,140,686
4
false
0
1
I have gotten more from Erica Sadun's books than any of the others, personally. iOS apps use a lot of animation and graphics, by necessity, and her code examples are clean and concise. They aren't beginner's books but you sound as though you're not a beginning coder. They hit on a lot of topics it is hard to find mu...
2
0
0
I really would like to start getting into Objective C coding, specifically so I can write applications for iOS. My coding background is that I have written C# .NET GUI Windows apps and PHP web scripts for years; I've also become a very good Python coder in the past year. I have written hundreds of useful command-line P...
Best intro to iOS for Python/PHP/C# Coder
0.049958
0
0
166
17,138,569
2013-06-16T23:09:00.000
1
1
0
1
python,linux,benchmarking,inotify
17,139,897
1
false
0
0
I would try and remove as many other processes as possible in order to get a repeatable benchmark. For example, I would set up a separate, dedicated server with an NFS mount to the directories. This server would only run inotify and the Python script. For simple server measurements, I would use top or ps to monitor ...
1
0
0
I'm looking at using inotify to watch about 200,000 directories for new files. On creation, the script watching will process the file and then it will be removed. Because it is part of a more compex system with many processes, I want to benchmark this and get system performance statistics on cpu, memory, disk, etc whil...
Benchmarking System performance of Python System
0.197375
0
0
780
17,139,217
2013-06-17T01:07:00.000
2
0
0
0
python,yum
17,140,290
1
true
0
0
You want to use the postresolve_hook(), and walk the transaction list. To see a fairly simple copy and paste example look at the changelog plugin (displays the rpm changelog for everything to be installed/upgraded in the transaction).
1
1
0
I am writing my first Yum plugin, which I hope to use to display some info about the packages to be downloaded on an update or an install. I have successfully gotten the plugin to run and have it all set up properly. My problem is getting a list of packages that will be downloaded before the user accepts or cancels the...
How can I use the yum Python module to get a list of packages that will be downloaded before accepting the transaction?
1.2
0
1
498
17,139,485
2013-06-17T02:00:00.000
1
0
1
0
python,pycharm
58,257,720
5
false
1
0
Well, I wish I had a better answer, but what helped me was simply the following: switch the interpreter from a remote one to a system one wait until the Pycharm indexing is done switch the interpreter back to the initial/desired one
2
30
0
I'm using PyCharm (v 2.7.2) to develop a Django app, but I can't get it to check PEP8 style violations. I have enabled "PEP8 coding style violation" in the "Inspctions" section of the settings, but PyCharm doesn't highlight the style violations. Is there a way to fix this?
How to get PyCharm to check PEP8 code style?
0.039979
0
0
58,662
17,139,485
2013-06-17T02:00:00.000
13
0
1
0
python,pycharm
34,655,470
5
false
1
0
Mine wasn't showing up due to the color scheme. By default it's marked as "weak warning", so you might have to edit the appearance to make it visible. Editor > Colors & Fonts > General > Errors and Warnings.
2
30
0
I'm using PyCharm (v 2.7.2) to develop a Django app, but I can't get it to check PEP8 style violations. I have enabled "PEP8 coding style violation" in the "Inspctions" section of the settings, but PyCharm doesn't highlight the style violations. Is there a way to fix this?
How to get PyCharm to check PEP8 code style?
1
0
0
58,662
17,140,080
2013-06-17T03:36:00.000
0
0
0
0
python-2.7,pandas,xls
17,141,432
1
false
0
0
The problem you are facing is that your excel has a character that cannot be decoded to unicode. It was probably working before but maybe you edited this xls file somehow in Excel/Libre. You just need to find this character and either get rid of it or replace it with the one that is acceptable.
1
0
1
I am trying to export dataframe to .xls file using to_excel() method. But while execution it was throwing an error: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 892: ordinal not in range(128)". Just few moments back it was working fine. The code I used is: :csv2.to_excel("C:\\Use...
Unable to export pandas dataframe into excel file
0
0
0
474
17,140,280
2013-06-17T04:08:00.000
1
0
0
0
python,compression,zip,deflate
24,719,120
2
false
0
0
LZ77 is about referencing strings back in the decompressing buffer by their lengths and distances from the current position. But it is left to you how do you encode these back-references. Many implementations of LZ77 do it in different ways. But you are right that there must be some way to distinguish "literals" (uncom...
2
1
0
I'm learning about LZ77 compression, and I saw that when I find a repeated string of bytes, I can use a pointer of the form <distance, length>, and that the "<", ",", ">" bytes are reserved. So... How do I compress a file that has these bytes, if I cannot compress these byte,s but cannot change it by a different byte (...
LZ77 compression reserved bytes "< , >"
0.099668
0
0
475
17,140,280
2013-06-17T04:08:00.000
0
0
0
0
python,compression,zip,deflate
17,141,490
2
false
0
0
If I understand your question correctly, it makes no sense. There are no "reserved bytes" for the uncompressed input of an LZ77 compressor. You need to simply encodes literals and length/distance pairs unambiguously.
2
1
0
I'm learning about LZ77 compression, and I saw that when I find a repeated string of bytes, I can use a pointer of the form <distance, length>, and that the "<", ",", ">" bytes are reserved. So... How do I compress a file that has these bytes, if I cannot compress these byte,s but cannot change it by a different byte (...
LZ77 compression reserved bytes "< , >"
0
0
0
475
17,140,809
2013-06-17T05:15:00.000
0
0
0
0
python,django,rest,django-forms,django-piston
17,200,127
1
false
1
0
Use Django Tastypie, it's a much more robust REST framework than Piston :)
1
0
0
Is there any easy way to process the ModalForm in Django Piston API to a Django Client? , On documentations @validate decorator is mentioning but I couldn't find the way to send forms from API to the Django Client. I feel like it is possible to use Django Forms from API like in local on Client side.
Forms between Django Client and Django Piston API
0
0
0
75
17,141,979
2013-06-17T07:00:00.000
3
0
1
0
python,floating-point,integer,rounding
53,398,021
12
false
0
0
Just make round(x-0.5) this will always return the next rounded down Integer value of your Float. You can also easily round up by do round(x+0.5)
3
144
0
I want to take a floating-point number and round it down to the nearest integer. However, if it's not a whole, I always want to round down the variable, regardless of how close it is to the next integer up. Is there a way to do this?
Round a floating-point number down to the nearest integer?
0.049958
0
0
387,046
17,141,979
2013-06-17T07:00:00.000
1
0
1
0
python,floating-point,integer,rounding
27,183,740
12
false
0
0
Don't know if you solved this, but I just stumble upon this question. If you want to get rid of decimal points, you could use int(x) and it will eliminate all decimal digits. Theres no need to use round(x).
3
144
0
I want to take a floating-point number and round it down to the nearest integer. However, if it's not a whole, I always want to round down the variable, regardless of how close it is to the next integer up. Is there a way to do this?
Round a floating-point number down to the nearest integer?
0.016665
0
0
387,046
17,141,979
2013-06-17T07:00:00.000
-6
0
1
0
python,floating-point,integer,rounding
52,981,095
12
false
0
0
I used this code where you subtract 0.5 from the number and when you round it, it is the original number rounded down. round(a-0.5)
3
144
0
I want to take a floating-point number and round it down to the nearest integer. However, if it's not a whole, I always want to round down the variable, regardless of how close it is to the next integer up. Is there a way to do this?
Round a floating-point number down to the nearest integer?
-1
0
0
387,046
17,149,112
2013-06-17T13:46:00.000
0
0
1
0
python,excel
17,150,025
2
false
0
0
It sounds like the API you're using is returning different types depending on the content of the cells. You have two options. You can convert everything to a string and then do what you're currently doing: s = str(S1) ... You can check the types of the input and act appropriately: if isinstance(S1, basestring): # ...
1
1
0
I have just learned Python for this project I am working on and I am having trouble comparing two values - I am using the Python xlwt and xlrd libraries and pulling values of cells from the documents. The problem is some of the values are in the format 'NP_000000000', 'IPI00000000.0', and '000000000' so I need to check...
How to strip letters out of a string and compare values?
0
0
0
205
17,151,693
2013-06-17T15:50:00.000
0
0
0
0
python,zope
17,305,631
1
false
1
0
There are two adapters needed for this. One adapts the ZODB context one wishes to use and zope.publisher.interfaces.IRequest, while providing zope.traversing.interfaces.ITraversable (view). The second adapts the previous objects instantiated view and zope.publisher.interfaces.browser.IBrowserRequest, while providing zo...
1
1
0
How can I serve arbitrary paths zope.browserrsource does for @@ and ++resource++ URIs in Zope?
How can I serve arbitrary request paths?
0
0
1
47
17,153,483
2013-06-17T17:38:00.000
0
0
0
1
c++,python,shell
17,153,614
2
true
0
0
One option is to remove all the modules that allow running arbitrary shell commands, i.e.: subprocess.py*, os.py*... and include only the modules that the end users are allowed to have immediate access to.
2
0
0
I want to embed Python 3.x in our C++ application to allow scripting of maintenance and other tasks. It so far does everything we need including file manipulation. The problem is that to meet some specifications (like PCI), we aren't allowed to arbitrarily run shell commands such as with subprocess.call or popen. Is t...
Preventing Embedded Python from Running Shell Commands?
1.2
0
0
114
17,153,483
2013-06-17T17:38:00.000
0
0
0
1
c++,python,shell
17,153,992
2
false
0
0
Unless your application is really locked down I don't think you can prevent someone from loading their own python module from an arbitrary directory (with import) so I don't think you can prevent execution of arbitrary code as long as you have python embedded.
2
0
0
I want to embed Python 3.x in our C++ application to allow scripting of maintenance and other tasks. It so far does everything we need including file manipulation. The problem is that to meet some specifications (like PCI), we aren't allowed to arbitrarily run shell commands such as with subprocess.call or popen. Is t...
Preventing Embedded Python from Running Shell Commands?
0
0
0
114
17,154,006
2013-06-17T18:11:00.000
2
0
0
0
python,colors,matplotlib,scatter
17,154,439
1
true
0
0
I'm not sure if this is the "proper" way to do this, but you could programmatically split your data into two subsets: one containing the positive values and the second containing the negative values. Then you can call the plot function twice, specifying the color you want for each subset. It's not an elegant solution,...
1
1
1
I have a pyplot polar scatter plot with signed values. Pyplot does the "right" thing and creates only a positive axis, then reflects negative values to look as if they are a positive value 180 degrees away. But, by default, pyplot plots all points using the same color. So positive and negative values are indistinguis...
Pyplot polar scatter plot color for sign
1.2
0
0
785
17,154,381
2013-06-17T18:34:00.000
0
0
1
0
python,scipy,cluster-computing,mpi
20,356,186
3
false
0
0
One quick workaround is to use a local directory on each node (e.g. /tmp as Wesley said), but use one MPI task per node, if you have the capacity.
1
3
1
If scipy.weave.inline is called inside a massive parallel MPI-enabled application that is run on a cluster with a home-directory that is common to all nodes, every instance accesses the same catalog for compiled code: $HOME/.pythonxx_compiled. This is bad for obvious reasons and leads to many error messages. How can th...
How can scipy.weave.inline be used in a MPI-enabled application on a cluster?
0
0
0
282
17,156,844
2013-06-17T21:03:00.000
0
0
0
1
python,google-chrome
24,497,812
3
false
0
0
A few options you might consider, with their advantages and disadvantages: URL: advantage: as Chris mentioned, accessing the URL and manually changing it is an option. It should be easy to write a script for this, and I can send you my perl script if you want disadvantage: I am not sure if you can do it. I made a pe...
1
0
0
I'd like to write a script (preferably in python, but other languages is not a problem), that can parse what you type into a google search. Suppose I search 'cats', then I'd like to be able to parse the string cats and, for example, append it to a .txt file on my computer. So if my searches were 'cats', 'dogs', 'cows'...
Parse what you google search
0
0
1
205
17,158,233
2013-06-17T23:01:00.000
2
0
1
0
java,python,exception-handling
17,158,594
3
true
1
0
OK, I can try and give an answer which I'll keep as neutral as it can be... (note: I have done Python professionally for a few months, but I am far from mastering the language in its entirety) The guidelines are "free"; if you come from a Java background, you will certainly spend more time than most Python devs out th...
2
9
0
I am original Java developer, for me, checked Exception in Java is obviously/easy enough for me to decide to catch or throw it to the caller to handle later. Then it comes Python, there is no checked exception, so conceptually, nothing forces you to handle anything(In my experience, you don't even know what exceptions ...
Exception Handling guideline- Python vs Java
1.2
0
0
2,973