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
21,411,408
2014-01-28T16:34:00.000
2
1
0
0
python,image-processing,embedded,octave
21,412,797
2
false
0
0
I am bit surprised that you don't stick to C/C++ - many convenient image processing libraries exists. Even though, I have like 20 years of experience with C, 8 years of experience with Matlab and only 1 years of experience with Python, I would choose Python together with OpenCV, which is an extremely optimized library for computer vision supporting Intel Performance Primitives. Once you have a working Python solution, it is easy to translate this to C or C++ to get the additional performance or reduce the power consumption. I would start with Python and Numpy using matplotlib for displaying / prototyping, optimize using OpenCV from within Python and finally use C++ and test it against the Python reference implementation.
1
0
0
I want to perform image processing on a low-end (Atom processor) embedded computer or microcontroller that is running Linux. I'm trying to decide whether I should write my image processing code in Octave or Python. I feel comfortable in both languages, but is there any reason why I should use one over the other? Are there huge performance differences? I feel as though Octave may more closely resemble, syntax-wise, the domain of image processing than Python. Thanks for your input. Edit: The motivation for this question comes from the fact that I design in Octave and get a working algorithm and then port the algorithm to C++. I am trying to avoid this double work and go from design to deployment easily.
Octave/MATLAB vs. Python On An Embedded Computer
0.197375
0
0
812
21,411,914
2014-01-28T16:56:00.000
0
0
0
1
python,batch-file,unicode
21,412,006
2
false
0
0
If you are using shell constructs such as redirection, you need the parameter shell=True.
1
0
0
I am using Python to create windows commands using subprocess.call(command) where command is a string I've generated for the Windows command. I need the results of my command to output to a .txt file so I use 2>> C:\Users\me\out.txt as part of command except Python does not seem to recognize the greater than character, >. I've tried using the Unicode value, u'\u003E' too. [EDIT] If I copy command and paste it into my command prompt, then it will execute the command properly. Otherwise it won't work from my Python script.
Python not recognizing the greater than sign?
0
0
0
274
21,414,191
2014-01-28T18:46:00.000
0
0
1
0
python,networking,network-programming
21,414,605
4
false
0
0
It really depends of your technical requirements, program architecture etc. But basically i could recommend you to use some kind of message queue service to communicate between your applications. RabbitMQ, for example.
1
0
0
Im new to programing. I want to know if there is a way to send a variable created on one computer in python to another computer running another python script on the same network. Basically lets say when the Variable is equal to 5 i want the other script to print 5
Pass variable between python scripts on different computers.
0
0
0
2,013
21,417,637
2014-01-28T21:49:00.000
2
0
0
0
python,django
21,417,983
2
true
1
0
Yes, Django won't recognize the field if you change the name. I will say that the "field does not exist", so YES, you have to run Django's South migrate / schemamigration as you asked. Datatype YES as well. Django may be okay at first if you only change the field type depending, but may run into problems later depending on what you have in that field.
2
2
0
The problem is pretty self-explanatory in the title. Do I need to do that or I just need to edit the existing migration file?
Do I need to user schemamigration and migrate commands after changing a field name or a field data type in a model?
1.2
0
0
54
21,417,637
2014-01-28T21:49:00.000
1
0
0
0
python,django
21,418,000
2
false
1
0
You need to do a schemamigration every time you change your models. On every call of python manage.py migrate command south record number of the latest migration applied into database migrationhistory table. So if you just change existing migration it won't be applied because south would think it's already applied. You can make a backward migration, fix next migration, even delete it and make a new one and only then migrate forward.
2
2
0
The problem is pretty self-explanatory in the title. Do I need to do that or I just need to edit the existing migration file?
Do I need to user schemamigration and migrate commands after changing a field name or a field data type in a model?
0.099668
0
0
54
21,419,369
2014-01-28T23:49:00.000
1
0
1
0
python
21,419,493
3
true
0
0
Internally the Int object is stored as 2's complement representation like in C (well, this is true if range value allow it, python can automagically convert it to some other representation if it does not fit any more). Now to get the string representation you have to change that to a string (and a string merely some unmutable list of chars). The algorithm is simple mathematical computing: divide the number by 10 (integer division) and keep the remainder, add that to character code '0'. You get the unit digit. Go on with the result of the division until the result of the division is zero. It's as simple as that. This approach works with any integer representation but of course it will be more efficient to call the ltoa C library function or equivalent C code to do that if possible than code it in python.
1
5
0
I understand it's easy to convert an int to a string by using the built-in method str(). However, what's actually happening? I understand it may point to the __str__ method of the int object but how does it then compute the “informal” string representation? Tried looking at the source and didn't find a lead; any help appreciated.
What's actually happening when I convert an int to a string?
1.2
0
0
118
21,420,269
2014-01-29T01:20:00.000
2
0
0
0
python,python-2.7,max,pickle
21,420,290
3
false
0
0
You would need to load your existing pickle'd object, modify it, and then dump it again with the modifications.
1
1
0
I am trying to save high scores in a game that I am creating, but each time I do a pickle.dump, it overwrites my previous data. Any help?
I am trying to save high scores with pickle, but how do I add to an already pickled document and then get the max?
0.132549
0
0
262
21,423,798
2014-01-29T06:36:00.000
0
0
1
0
python,multithreading,thread-safety,twisted
21,423,872
3
false
0
0
Either Threading or Twisted can do this. ie. If you use twisted, you won't need to use Threading. Keep in mind that some servers have a limit on the number of connections they will allow from a single IP address.
1
2
0
I am looking to set up an HTTP server which takes in some input and then the application needs to send multiple HTTP requests at the same time (to another server). What is the best approach for this? If I use the Twisted framework, do I still need to use threading?
Python: Multiple HTTP requests at the same time
0
0
1
2,932
21,426,024
2014-01-29T08:44:00.000
0
0
0
0
python,django,authorization,server-side
21,426,172
3
false
1
0
The authentification method in every application connects to the same webservice for autentification.
2
1
0
There are multiple mobile apps. I want people using one app to login with their same login credentials into all other apps. What is the best approach to implement this? I'm thinking to create a separate authorization server that will issue tokens/secrets on registering and logins. It will have a validation API that will be used by mobile app servers to validate requests.
One login for multiple products
0
0
1
386
21,426,024
2014-01-29T08:44:00.000
1
0
0
0
python,django,authorization,server-side
21,427,549
3
true
1
0
First check if OAuth could be adapted to using this, that would save you a lot of work. Of course all the services and apps would have to talk to some backend network server to sync tokens issued to apps. Half-secure/maybe-abusable solution: have symmetric cipher encrypted cookie that webpages (and apps?) hold and use it for authorization with different network services (which again have to verify cookie for authorization with authorization service that knows the passphrase used to encrypt the cookie) I've used approach #2 on internal systems but I am not sure if it is advisable to use it in in the wild - this may pose some security risks.
2
1
0
There are multiple mobile apps. I want people using one app to login with their same login credentials into all other apps. What is the best approach to implement this? I'm thinking to create a separate authorization server that will issue tokens/secrets on registering and logins. It will have a validation API that will be used by mobile app servers to validate requests.
One login for multiple products
1.2
0
1
386
21,434,332
2014-01-29T14:42:00.000
1
0
1
0
python,inheritance,module,code-reuse
21,434,602
5
false
0
0
A module is an instance, not a class, so you can't inherit from it any more than you can inherit from 6. If your stuff has state, you should have classes, not modules. If you have two modules that need the same stuff, then it either a) one of them should have it and the second should use the first, or b) they should both get it from a third module. Module names are typically lowercase, since Uppercase/CamelCase names indicate classes.
2
4
0
So I hear that modules are very pythonic and I structure my code with modules a lot and avoid classes. But now I'm writing a module Formula that has a lot of the same functionality as the module Car. How should I handle that? Duplicate code in both modules? Convert to classes? Refactor code to add a third, parent module Vehicle and import methods and variables that I need? The third looks good, the only downside that I see is that there are some variables that are specific to a module (e.g. top_speed), but the functions in the parent module Vehicle need to access those specific variables.
How to extend (inheritance) a module in Python?
0.039979
0
0
6,016
21,434,332
2014-01-29T14:42:00.000
1
0
1
0
python,inheritance,module,code-reuse
21,434,599
5
false
0
0
Modules can sometimes be used to implement Singletons, but they aren't meant to be a replacement for classes. You can only import the module once, while a class can have multiple instances. If you need inheritance, use a class.
2
4
0
So I hear that modules are very pythonic and I structure my code with modules a lot and avoid classes. But now I'm writing a module Formula that has a lot of the same functionality as the module Car. How should I handle that? Duplicate code in both modules? Convert to classes? Refactor code to add a third, parent module Vehicle and import methods and variables that I need? The third looks good, the only downside that I see is that there are some variables that are specific to a module (e.g. top_speed), but the functions in the parent module Vehicle need to access those specific variables.
How to extend (inheritance) a module in Python?
0.039979
0
0
6,016
21,434,533
2014-01-29T14:51:00.000
4
0
1
1
python
21,434,929
2
false
0
0
I'm writing a Python IDE and I want to let user to choose the interpreter for executing the program. Just do it like other IDEs then and simply supply a dialog where users can add interpreters they want to be able to run the code with. Eclipse does this for example for Java Runtimes, and it’s perfectly fine to have it like that. Especially for languages like Python where virtual environments are an important thing which each have their own exectutable. You certainly can come up with a one-time detection that checks some common locations. For Windows, this would obviously be the registry, as the py.exe launcher requires the interpreters to be registered there—at least the system-wide ones. On Unix machines, you could check the common bin/ folders, most prominently /usr/local/bin/ which is the standard location where Python installs itself. You could also check the PATH for Python executables. But all those things should be considered carefully and only offer an initial setup. There are always edge cases where a user didn’t do the “standard thing” where your detection will fail. For example I don’t have my Python interpreters in my path, and a linux server I access I have installed Python into a non-standard folder in my home directory. And finally, just because it looks like Python doesn’t mean it is Python. Yes, you can do some guesswork to come up with an initial set of interpreters, but really don’t spend too much time on it. In the end, you won’t be able to detect everything perfectly anyway. And you will miss virtual environments—which might be very crucial to the project the user is working on in your IDE. So instead of wasting time on bad detection, spend more time on creating a manual dialog to register interpreters. You will need that anyway, and a good interface can make it very easy—even for beginners—to use it.
1
8
0
I need to present the user a list of Python installations to choose from for executing something. I suppose in Windows I could get this information from registry. Don't know about Linux and Mac. Any hints? Or maybe you even know a place where I could find Python code for this? EDIT: it is not important that I find really all interpreters. Finding interpreters from standard locations would be actually fine. Agreed, it's not something too difficult, but I was just hoping that maybe someone has code for this lying around or that I've overlooked a function for that in stdlib.
How to list all Python versions installed in the system?
0.379949
0
0
4,374
21,436,787
2014-01-29T16:24:00.000
1
1
0
0
java,python,sockets
21,436,939
2
true
1
0
A meta-answer would be to use JSON, since JSON generators and parsers can be found for every major programming language.
2
0
0
I am using OpenCV on my Raspberry Pi to track circular objects. Then, I want to send the coordinate and radius values in an array of floats across the LAN to the Java program I can send strings all fine with the code I have, but I'm having trouble trying to send numerical datatypes. What is the correct process for this?
How to send an array from Python (client) to Java (Server)?
1.2
0
0
129
21,436,787
2014-01-29T16:24:00.000
1
1
0
0
java,python,sockets
21,437,109
2
false
1
0
Have you looked at BSON? It's like JSON, but optimised for a little more speed.
2
0
0
I am using OpenCV on my Raspberry Pi to track circular objects. Then, I want to send the coordinate and radius values in an array of floats across the LAN to the Java program I can send strings all fine with the code I have, but I'm having trouble trying to send numerical datatypes. What is the correct process for this?
How to send an array from Python (client) to Java (Server)?
0.099668
0
0
129
21,439,346
2014-01-29T18:19:00.000
2
0
1
0
python,permutation,alphabetical
21,439,435
4
false
0
0
It might be faster to run it in reverse: index your document, and for each word, see if it is a subset of your list of letters.
1
4
0
So I am making a word generator that takes several inputted letters, puts them in all possible positions, and matches them with a document to find words. If I am approaching this wrong please tell me! If not how can I do this? Thanks
How can I generate a list of all possible permutations of several letters?
0.099668
0
0
11,854
21,440,163
2014-01-29T18:59:00.000
5
1
1
0
python,global-variables,closures
21,440,260
1
true
0
0
Local and closed-over names are enumerated during compilation. At runtime, they're stored in C arrays and accessed using integers/indices. LOAD_FAST and LOAD_DEREF take a C integer and perform a C array lookup. Global names cannot be enumerated at compile time, they can be added and removed during run time by any code in the whole process. This is similar to object attributes - because globals essentially are a module object's attributes. Therefore, they are stored in a dictionary and the implementation accesses them quite differently from local and closed-over names. LOAD_GLOBAL takes a string (constant) and performs a dictionary lookup.
1
5
0
Functions declared at module level never have a closure and access non-local variables via LOAD_GLOBAL. Functions declared not at module level may have a closure and access non-local, variables via LOAD_DEREF if those variables are not global. So basically we have three ways of storing and loading variables GLOBAL (global), FAST (local) and DEREF (non-local, enclosed, covered). Why the GLOBAL? Wouldn't FAST and DEREF suffice, if you let all functions have their closures? Is there some important difference between a non-local variable and global variable I fail to spot? Is this maybe due to performance issues, as perhaps global variables (like all functions and classes (including their methods) defined at module level plus the builtins) are generally more common than non-local variables?
Implementation of Global variables vs Dereferenced variables
1.2
0
0
190
21,440,987
2014-01-29T19:42:00.000
0
0
0
0
python,django,django-admin
21,442,464
1
false
1
0
What would be best to do is write your core project on one side, and store it in a repository (version control). Apart from that, write your sub-applications as requirements and store/track them on separate version control. Then, to keep everything working together and keep it all integrated, what you should do is that for different functionality, write it all in the same app, but add special settings that change the app's behavior. These settings can be stored in an independent settings_local.py that is imported at the end of your settings file, making them installation-independent, and you keep in your settings.py those that are general to all installations.
1
0
0
I have core django admin project that when my customers purchase needs to be modified both in configuration and function. Each customer will have their own instance of the project installed on a different server. Currently I am using django apps to separate out the difference in clients and using settings.py to load the correct app for the correct customer. So my questions: Is there a industry standard/best practice/framework to customize configuration and functionality in django admin projects and distribute them?
Django admin project distribution and management
0
0
0
82
21,442,470
2014-01-29T20:57:00.000
0
1
0
0
php,python,raspberry-pi,home-automation
31,495,240
2
false
0
0
Use a websocket (e.g., on Node.js) to open a channel of communication between the Raspberry Pi and the Web page. Run a socket server on the Web server and run clients on your Rasberry Pis. Then create a simple messaging protocol for commands that the Web server will send over the websocket and that the Raspberry Pis will listen for over the socket. They can even communicate when the task is done that it's been done successfully.
2
0
0
I am planning on doing a bit of home automation. I decided on going with the RPi, because it is cheap, and can connect to the internet wirelessly via a USB dongle. I was planning on controlling the system through a PHP webpage hosted on my webserver. I was wondering if I could make it so that when I click a button on the PHP site, it somehow sends a signal to the raspberry pi and makes it activate a GPIO pin. I realize that it would be easier to host the webpage on the actual Pi itself, but I plan to have multiple Pis and would like to be able to control all of them with one webpage. Thanks In advance
Python, PHP: Controlling RPi GPIO from website on a separate server
0
0
1
525
21,442,470
2014-01-29T20:57:00.000
0
1
0
0
php,python,raspberry-pi,home-automation
21,864,500
2
false
0
0
I don't think it would be as easy as 'sending a signal' to your Pi. What you could do, however, is set up a MySQL database on the server with your control signals input to the database and have the Pi poll it every so often to check the values. For actually controlling, you would simply use UPDATE statements to set the values. There may be some lag involved, but this depends on your polling rate and network speed.
2
0
0
I am planning on doing a bit of home automation. I decided on going with the RPi, because it is cheap, and can connect to the internet wirelessly via a USB dongle. I was planning on controlling the system through a PHP webpage hosted on my webserver. I was wondering if I could make it so that when I click a button on the PHP site, it somehow sends a signal to the raspberry pi and makes it activate a GPIO pin. I realize that it would be easier to host the webpage on the actual Pi itself, but I plan to have multiple Pis and would like to be able to control all of them with one webpage. Thanks In advance
Python, PHP: Controlling RPi GPIO from website on a separate server
0
0
1
525
21,445,897
2014-01-30T00:55:00.000
0
0
0
1
python,web-services,google-app-engine,rest,qualtrics
21,449,385
1
true
1
0
I am familiar with Qualtrics but I will answer (b) first. You can write a Python Web Service in a variety of ways, depending on your choice: You could write a simple get handler Use Google Cloud Endpoints Use one of several Web Services Python libraries Having said that, a quick glance at Qualtrics indicated that it required a RSS feed in the result format(I could be wrong). So what you will need to take care of while doing (b) is to ensure that it is in a format that Qualtrics understand and parses out the response format for you. For e.g. if you have to return RSS, you could write your Python Web Service to return that data. Optionally, it can also take one or more parameters to fine tune the results.
1
0
0
Has anyone out there created a a.) web service for Qualtrics or b.) a Python web service on Google App Engine? I need to build in some functionality to a Qualtrics survey that seems only a web service (in the Qualtrics Survey Flow) could do, like passing parameters to a web service then getting a response back. I've looked at GAE Protocol RPC, but I'm not quite sure if that's the right path. Qualtrics gave me a PHP code example but I don't know how to begin translating it to python and/or GAE.
Creating a web service for Qualtrics written in Python on Google App Engine
1.2
0
0
909
21,446,649
2014-01-30T02:19:00.000
2
0
0
0
python,django
21,447,135
1
true
1
0
Well, there's an amount of subjectivity in this choice. It does depend on whether all of these different documents are pretty much the same thing (just relatively minor variations but still more or less similar), or if they have a large amount of very specific functionality. I guess yours is probably the first, in which they might have different functionality, but they do share a lot. Then you can go ahead and create them as a single app You would have documents/__init__.py documents/models.py documents/views.py What you can do if, lets say you have many models, and different kinds of models, lets say 3 different types of text files, 4 different types of audio, you could use a folder structure like this: documents/__init__.py documents/models/__init__.py documents/models/base.py documents/models/text.py documents/models/audio.py ... documents/views.py So, in this case you would have your base abstract model in base.py, then in the other files you'd have several models properly classified, inheriting from your base abstract model. Then to use these classes you'd do: from documents.models.audio import FancyAudio from documents.models.text import BigText, SmallText ....
1
1
0
I have an abstract model called documents. Types of documents like "invoices" and "quotes" inherit from this class. This is my first Django project and I'm a bit unclear of the best folder structure. I was planning to make each type of document get its own app. So, there would be an app for "invoices" and an app for "quotes" and each would have their own folder. Is this a reasonable approach? My second question is where should the documents model be located? Should documents be an app on its own? Should "invoices" and "quotes" sit within "documents"?
Best Folder Structure For Abstract Models
1.2
0
0
590
21,447,430
2014-01-30T03:47:00.000
0
0
1
0
python,ipython,ipython-parallel
21,489,974
1
true
0
0
I ran some tests. The LoadBalancedView assigns tasks to engines (nodes) immediately after being apply'd. If more nodes join later, the the load is not recalculated and the tasks are left to the original engines to complete. Only tasks created after the engine has registered with the controller can be assigned to that engine.
1
1
0
I have a few questions about the IPython parallel LoadBalancedView class which I couldn't find in the docs. How does a LoadBalancedView deal with nodes entering and exiting the pool? Does it recalculate loads and reassign? Otherwise once nodes join the older ones would still be backed up with tasks. When a task is added to the pool, is the task assigned immediately based on load or are tasks assigned just after a node "frees up" after completing its task? I'm just curious when the binding assignment happens, or if there is reshuffling all the time due to certain nodes being faster, etc. Thanks!
IPython parallel LoadBalancedView task assignment particulars
1.2
0
0
93
21,454,046
2014-01-30T10:37:00.000
4
0
0
0
python,orm,openerp,odoo
27,442,462
1
false
1
0
Yes, when issuing a ORM '.search' query, pass in Python False to represent database nulls. The ORM has no 'is' operator, so you must query for ('column', '=', False). Similarly, when '.browse' returns rows, database nulls are converted into Python False. I believe the reason for this is that xmlrpc (which is used to send these queries to your OpenERP server) does not have any way to represent None/null values in its 'out of the box' configuration. Xmlrpc can be configured to allow nulls, but OpenERP does not use this. The obvious question this raises is what happens for nullable boolean fields, where False is a valid value? Based on personal experiments: When creating row with a nullable boolean fields, if you pass Python False, then the database ends up containing false, not null as for other datatypes. I don't think there is any way to set such fields to null: It doesn't work to pass Python None, nor setting the default value to None and not passing this column at all. Where is this documented? I can't find it. It's all crazy. Welcome to Odoo!
1
1
0
Within OpenERP, when you define a new char field in python and set False as default value, the field will be set to NULL in the db, the ORM taking care of the conversion. Does the ORM also convert integer type the same way, or should I be careful that it may convert it to 0 instead of NULL? Where could I find the on the fly value conversion rules of OSV (OpenERP ORM)?
Does OpenERP convert False value to NULL when affected to integer?
0.664037
0
0
1,668
21,455,014
2014-01-30T11:20:00.000
1
0
1
0
postgresql,plpython
21,455,200
1
true
0
0
The PL/Python procedural language allows PostgreSQL functions to be written in the Python language. PL/Python2U untrusted procedural language
1
3
0
what is difference between plpython, plpythonu, plpython2u. What does u and 2u mean. Looking around I could't find any info on that matter.
What is difference between plpython, plpythonu, plpython2u
1.2
0
0
1,112
21,455,134
2014-01-30T11:25:00.000
75
1
0
0
python,unit-testing,pytest
21,462,398
4
true
0
0
You can also use --collect-only, this will show a tree-like structure of the collected nodes. Usually one can simply -k on the names of the Function nodes.
2
53
0
I can't find a way to list the tests which I can call with py.test -k PATTERN How can I see the list of the available tests?
List available tests with py.test
1.2
0
0
18,525
21,455,134
2014-01-30T11:25:00.000
4
1
0
0
python,unit-testing,pytest
21,455,508
4
false
0
0
-v verbose tells you which test cases are run, i.e. which did match your PATTERN.
2
53
0
I can't find a way to list the tests which I can call with py.test -k PATTERN How can I see the list of the available tests?
List available tests with py.test
0.197375
0
0
18,525
21,455,719
2014-01-30T11:50:00.000
0
0
0
0
python,pelican
50,008,098
3
false
1
0
When you press Ctrl + C or Ctrl + z, do not restart the HTTP server: it is running in the background, and that is the exact reason as why you are getting that error message. To see that the server is running in the background after pressing the any of the key combinations above, try to edit and save any file: you will see right away in the terminal the re-generation process of your pages is active again. You can start the HTTP server using this command: make devserver and stop by ./developer_server.sh stop
2
3
0
Hi I just started working with Pelican and it really suits my needs, I had tried to build blogs in Flask and other frameworks but I really just wanted something simple so I can post about math, and pelican just works. My question is when I am testing on my machine, I start the server; however when I stop the server to make some edits to my test blogs, and then try to reload the server I get a socket already in use error. I am stopping my server by ctrl+z am I doing this correctly?
Pelican restarting you server
0
0
0
990
21,455,719
2014-01-30T11:50:00.000
2
0
0
0
python,pelican
27,992,709
3
false
1
0
For your development server, you can also use the script ./develop_server.sh that comes with the last versions of pelican (at least with the 3.5.0). Build the blog and load a server with ./develop_server.sh start: it reloads each time you edit your blog (except the settings). Simply stop with ./develop_server.sh stop when you're finished.
2
3
0
Hi I just started working with Pelican and it really suits my needs, I had tried to build blogs in Flask and other frameworks but I really just wanted something simple so I can post about math, and pelican just works. My question is when I am testing on my machine, I start the server; however when I stop the server to make some edits to my test blogs, and then try to reload the server I get a socket already in use error. I am stopping my server by ctrl+z am I doing this correctly?
Pelican restarting you server
0.132549
0
0
990
21,457,402
2014-01-30T13:06:00.000
-1
0
1
0
python,matplotlib,tkinter,python-3.3
21,458,494
1
false
0
0
I suggest you get matplotlib from your distro's repositories. Pip is fine for installing simple, pure Python packages but isn't very convenient for packages such as matplotlib or numpy, for which a lot of non-Python dependencies need to be solved. Your package manager should nicely take care of all this stuff for you.
1
2
0
I have a fresh Python 3.3 installation on Red Hat Enterprise Linux 6.5, including Tkinter — python3.3 -m tkinter works and shows a dialogue. However, when I run pip3.3 install matplotlib, at the Optional Backend Dependencies, it says: Tkinter: no * TKAgg requires Tkinter How does matplotlib determine the availability of Tkinter, and how can I give it a hint?
When installing through pip, how do I tell matplotlib how to find tkinter?
-0.197375
0
0
492
21,458,155
2014-01-30T13:42:00.000
1
0
0
0
python,file,openerp
21,458,634
4
false
0
0
Generally there's no way to retrieve the path of a file just from it's content. There may be file formats for which this is possible, but in the general case there is no way. However, if you need the file's path only to feed the file into some other part of your program, there is another way: Just dump your binary data into any file (or temp file), and use that file's path.
2
2
0
Is it possible to get the path of a file from binary data? I have only binary data which came from reading the file, but have no information of file path. Does the binary data have the information of path? if yes then How can I get it. I need to read xlsx file using python xlrd lib, which requires the file path, but i only have binary data. Can anyone shed light on it?
Get File path from binary data
0.049958
0
0
4,238
21,458,155
2014-01-30T13:42:00.000
0
0
0
0
python,file,openerp
21,458,351
4
false
0
0
If you are getting the binary data from a stream, then there is NO way of getting the file path. If you think about it, the data may also be coming through stdin or through a network socket, so no file path is associated with it. A possible approach is to manipulate the program to attach file path information along with the binary stream. We can help more in this approach, if you can post the code of your program.
2
2
0
Is it possible to get the path of a file from binary data? I have only binary data which came from reading the file, but have no information of file path. Does the binary data have the information of path? if yes then How can I get it. I need to read xlsx file using python xlrd lib, which requires the file path, but i only have binary data. Can anyone shed light on it?
Get File path from binary data
0
0
0
4,238
21,458,423
2014-01-30T13:54:00.000
7
0
1
0
python,ipython-notebook
21,458,549
1
true
0
0
Is it possible that one of the cells got a lot of output data? if so, try editing the file manually (with notepad++ or something like this), and delete cell's output
1
4
0
So my iPython notebook comes up in my browser (chrome) and when I open my specific notebook a new tab opens. However the work does not load up! The page also freezes. Is this an iPython issue or something wrong with the file? Was working yesterday. I've restared comp etc. but no luck Update: just tried renaming notebook to open again with no luck Update 2: One has now shown up - but can't do anything with it! Is iPython simply extremely extremely slow...
iPython notebook not loading
1.2
0
0
3,514
21,462,118
2014-01-30T16:33:00.000
1
0
0
0
python,c++,qt
21,467,816
3
false
0
1
You can use the Qt Graphics View Framework. Create a QGraphicsView and a QGraphicsScene for it. Add items using QGraphicsScene::addPixmap (that returns QGraphicsPixmapItem which is derived from QGraphicsItem) and adjust their positions using QGraphicsItem::setPos. QGraphicsView will effectively draw your scene and handle scrolling and zooming if necessary.
3
1
0
I need to display a chart that can be very large, for example the image resolution could be 100 000 x 1000. However, it seems like I am limited to 32768 x 32768 by the QImage. I can't reasonably redraw directly the chart at every paintEvent so I need to store it into a QImage (it could be a QPixmap that won't change anything). But then, it doesn't fit. My first idea was: Create a list of QImage Plot on the various QImage Redraw using the good QImages. The first and last points have been done quite easily. But the second point is more complex. I'm quite confident that my approach would work but it requires to overload the basic paint methods (draw rectangle, circles, etc.) in order to be able to paint on multiple images. So, before going any further, I would like to know what could be the other options.
Draw an image too big to fit into a QImage
0.066568
0
0
622
21,462,118
2014-01-30T16:33:00.000
2
0
0
0
python,c++,qt
21,462,850
3
false
0
1
You probably do not want to display more than one QImage of data at a time. Few screens are more than 32k pixels wide or tall. So you want an abstract type that produces QImages on request for reading, at offsets and possibly at different zoom factors. The next problem is modifying this abstract type. An easy to use, not maximally performance version consists of letting users blit QImages into your internal storage (whatever that is). The user still has to "tile" their efforts, but can tile their efforts in ways that is convenient for them. A higher performance version exposes some of the underlying implementation, which we have not yet mentioned. A traditional implementation for large images is a tiled image. You have a grid of image tiles that abut each other. When someone asks for a blit from your image, you produce a temporary QImage, and blit the appropriate tiles onto it. And when someone blits to you, you figure out what the appropriate tiles are, and write parts of that source QImage over parts of them. The higher performance interface exposes these tiles. A low level interface lets the outside know where your tiles are, and lets them ask for them. This is a poor interface. A better interface exposes a sub tile iterator. They ask for a region, and you return a pair of iterators that describe the region. The data in the iterators consists of either a tile and a region in that tile as well as the location this region is in the "full image", or a sub-tile object (with linestride, line length, etc) and the location of the sub-tile object. Another good interface is a foreach style interface. Again, the user of the big image class passes in a region they want to work with, but a callback as well. That callback something similar to either one of the above results of the iterator dereference. This approach has two large advantages over the iterator approach. First, you can implement parallel image processing algorithms within your large image class. Second, it is much easier to write than rolling your own iterator. Once you have either of these, drawing is relatively easy. Determine the region you are drawing on (be generous). Iterate over the resulting tiles. On each tile, draw after applying the offset of the tile to the drawing.
3
1
0
I need to display a chart that can be very large, for example the image resolution could be 100 000 x 1000. However, it seems like I am limited to 32768 x 32768 by the QImage. I can't reasonably redraw directly the chart at every paintEvent so I need to store it into a QImage (it could be a QPixmap that won't change anything). But then, it doesn't fit. My first idea was: Create a list of QImage Plot on the various QImage Redraw using the good QImages. The first and last points have been done quite easily. But the second point is more complex. I'm quite confident that my approach would work but it requires to overload the basic paint methods (draw rectangle, circles, etc.) in order to be able to paint on multiple images. So, before going any further, I would like to know what could be the other options.
Draw an image too big to fit into a QImage
0.132549
0
0
622
21,462,118
2014-01-30T16:33:00.000
0
0
0
0
python,c++,qt
21,469,131
3
false
0
1
You do realize that a 100,000 x 1000 RGBA QImage is 400MBytes? There's no point in wasting all that memory. Really, none. Just paint it every time, one request, in the paintEvent. Be clever about it so that you only paint what needs to be shown. I'd think one should focus on optimizing the painting process and your data structures so that it can be painted effectively. At small scales (zoomed out), a lot can be gained by approximating/decimating/interpolating the data so that it looks the same, but you don't waste time painting the same pixel too many times.
3
1
0
I need to display a chart that can be very large, for example the image resolution could be 100 000 x 1000. However, it seems like I am limited to 32768 x 32768 by the QImage. I can't reasonably redraw directly the chart at every paintEvent so I need to store it into a QImage (it could be a QPixmap that won't change anything). But then, it doesn't fit. My first idea was: Create a list of QImage Plot on the various QImage Redraw using the good QImages. The first and last points have been done quite easily. But the second point is more complex. I'm quite confident that my approach would work but it requires to overload the basic paint methods (draw rectangle, circles, etc.) in order to be able to paint on multiple images. So, before going any further, I would like to know what could be the other options.
Draw an image too big to fit into a QImage
0
0
0
622
21,463,282
2014-01-30T17:24:00.000
0
0
1
0
python-3.x
21,463,343
3
false
0
0
An octet and a byte is the same. A bit is just one 0 or 1. Eight bits make a byte.
2
3
0
What's the difference between a "bit" and "octet"? Some python books, depending on the author, seem to use the terms interchangeably. I asked a PHD level guy and he said there was a difference but didn't explain what the difference was.
What's the difference between a "bit" and "octet"?
0
0
0
4,355
21,463,282
2014-01-30T17:24:00.000
9
0
1
0
python-3.x
21,463,473
3
false
0
0
A bit is a single binary digit. An octet is a collection 8 bits, sometimes called a "byte". There is no formal definition of a byte as 8 bits (though it is the generally accepted standard). The term octet is used when it is necessary to unambiguously specify that there are only 8 bits in the collection.
2
3
0
What's the difference between a "bit" and "octet"? Some python books, depending on the author, seem to use the terms interchangeably. I asked a PHD level guy and he said there was a difference but didn't explain what the difference was.
What's the difference between a "bit" and "octet"?
1
0
0
4,355
21,469,046
2014-01-30T22:45:00.000
0
0
0
1
windows-8.1,python-idle
26,771,569
1
false
0
0
Find file HOME/.idlerc/config-keys.cfg, where on Win7 HOME would be 'C:/Users/yourloginname', and delete the key binding or, if there is nothing else in the file or nothing you want to keep, the whole file. If you were to run Idle from a console with python -m idlelib, you would probably see an error message. (Yes, you were probably running with pythonw, as when using the start menu or icon. This works better in 3.4.2 and I am working or more improvements.) I do not know the specific reason for your crash. I set Zoom-height to --space, restarted, and it works, no problem.
1
1
0
I feel like I have been coming the internet for days with absolutely no result. I have taken some web programming classes, and would like to learn some python, just because programming is wicked interesting altogether, and have run into a fairly large hurdle given my experience. the problem is this: Python.exe (or is is more properly pythonw.exe?) v3.3.3, running on windows 8.1 used to launch fine. Typed up a simple program to roll various sided die, worked out well. Then I changed the key bindings for 'Run Module' from 'ctrl+f5' to 'crtl+alt+spacebar.' As soon as I did this IDLE crashed and so did the shell. Now the process will not run AT ALL. I cannot access it through the desktop icon to go back and revert the settings. I also attempted to look at the .def files and change it from there but could not find the 'run module' command. It looked like all the key bindings in the .def files were for the shell. When I double click, nothing, when I run as admin, nothing. run from the start menu, nothing. I uninstalled and re-installed, rebooted, everything low tech I can think of. Now i'm out of my element and could use one of you brilliant social programmers!! I've found information about checking with some tool called 'Windows Process Manager' some stuff about what to do with the CMD prompt (something about a path problem ...it intuitivly sounds like I very well could have created a 'path problem' but I'm not 100% I know what that is exactly). I'm sorry for the lack of links, the pages were farther back in my browsing history than I expected. Hopefully i'm not asking an instant many down vote question here, most of the resources online are for either an older version of windows, Lunix, or an older version of python (which is actually where the path problem hint came from) Thanks any and all greatly for any time spend reading/answering. Immensely appreciated.
Python IDLE GUI not starting
0
0
0
2,234
21,469,470
2014-01-30T23:14:00.000
28
0
0
0
python,django,django-i18n
32,872,393
3
false
1
0
In your settings.py just add 'django.middleware.locale.LocaleMiddleware' to your MIDDLEWARE_CLASSES setting, making sure it appears after 'django.contrib.sessions.middleware.SessionMiddleware'.
1
20
0
I have a django 1.6 site with i18n working. I can change the frontend language with a select box in the top of the template, but I don't know if there is a django app or trick to change the admin language, because it seems to store somewhere in session variable, and it keeps the first language I have used in the frontend.
How can I change Django admin language?
1
0
0
18,987
21,471,470
2014-01-31T02:31:00.000
0
0
0
0
python,c++
21,518,936
1
false
0
1
It seems no solution to do that after a few attempts. A simple way to fix this problem is wrapping the c++ code with SWIG, so can pass it to other SWIG-wrapped modules.
1
0
0
I was using Python to process some data (int array). It is very slow. So I put the processing function in a c++ DLL and talk with it through ctypes. The data are loaded from swig-wrapped modules (c++). I browsed almost everywhere but found nothing to convert swig object of type 'int *' pointer to ctypes int pointer. How can I do it? Thanks
How to convert swig object of type 'int *' to ctypes int*
0
0
0
640
21,473,532
2014-01-31T06:06:00.000
0
0
0
0
python,django,image
21,473,553
1
true
1
0
Storing your images in database to serve them on a page is not a good idea. Upload them to a CDN , and store the URLs in your database.
1
0
0
I am storing images as base64 string in database(MYSQL) and then when requested from client side(HTML webpages simply), sending base64 strings of images along with some other data from tables and then embedding this data in img tag on client side. These tags are built on dynamically using javascript. But this approach takes a lot of time even for 2 images. I see that when serving static images, django serves quite fast. So what could be a good approach to reduce the time?
sending image on client side takes too much time in django
1.2
0
0
83
21,477,016
2014-01-31T09:53:00.000
6
0
0
0
python,python-2.7
21,477,105
2
true
0
0
If your input is [0x20, 0x00], then you can do (arr[1]<<8)|arr[0]. If your input is ["0x20", "0x00"], then you can do int(arr[1],16)<<8)|int(arr[0],16).
1
0
0
I have an unsigned integer that is 16 bits coming in on the USB, these appear as 2 bytes in my list that is returned, e.g. [0x20, 0x00]. How would I combine these in to a number in python?
Unsigned integer 16 bits little endian to Python variable
1.2
0
0
954
21,480,554
2014-01-31T12:52:00.000
1
0
1
0
python,eclipse,jar,pydev,jython
21,758,703
1
true
1
0
Yes, PyDev is not able to read an 'aggregating' jar, so, you really have to add those other jars manually.
1
0
0
I'm using Eclipse, PyDev and Jython together on a project. It works well, but I have a problem with an external jar. This jar is special, has no .class files inside it just a manifest which uses Class-Path attribute to list additional jars (just aggregating a bunch of jars). It seems like adding this as an external jar ignores this attribute and because it has no .class files, it doesnt add anything visible to the project. Do I have to add all the jars by hand now?
Eclipse, PyDev, Jython, external JAR
1.2
0
0
483
21,483,236
2014-01-31T15:06:00.000
2
0
0
0
python,matplotlib,label,axes
21,483,417
1
true
0
0
Try this: axes.xaxis.set_tick_params(label1On=False)
1
1
1
Is there a way to remove the labels of the x axis, but not the grid lines? Both solutions to remove the labels also removed my grid lines. I tried: axes.get_xaxis().set_visible(False) and axes.get_xaxis().set_ticks([])
Python Matplotlib remove xlabels but not grid
1.2
0
0
90
21,485,237
2014-01-31T16:36:00.000
2
0
1
0
python,logic
21,485,454
2
false
0
0
is not not doesn't work. This is not a very bad thing, as it's never needed. is not has the same operator precedence as is, which makes sense. is has a higher operator precedence than not, otherwise x is not y would mean x is (not y), when it needs to mean x is not (y). But you can't figure out if a is not not b because you can't get the answer for is not before you do not b.
1
1
0
For some reason there is a syntax error in the following logical evaluation: True is not None and not False is not not not None The error can be narrowed down to this statement: False is not not None Where the second not is highlighted. This isn't important at all, but I was just interested in why this might be failing. Any ideas?
Weird syntax error in python 3.x logic
0.197375
0
0
151
21,485,769
2014-01-31T17:00:00.000
11
0
1
0
python,matplotlib,latex
21,486,017
1
true
0
0
Try ax.set_ylabel(r'$\langle B_{\mathrm{e}} \rangle$') for labeling Y-Axis or ax.set_title(r'$\langle B_{\mathrm{e}} \rangle$') for the title of the axes.
1
6
1
How to label axes in Matplotlib using LaTeX expression $\langle B_{\mathrm{e}} \rangle$? I need to label my axis with nice looking "<" and ">" LaTeX brackets.
How to label axes in Matplotlib using LaTeX brackets?
1.2
0
0
7,377
21,486,362
2014-01-31T17:29:00.000
1
0
0
1
python,linux,django,celery
21,489,049
1
true
1
0
Here is one approach: in your Django web application, write a message to a queue (e.g., RabbitMQ) containing the information that you need. In a separate system, read the message from the queue and perform any file actions. You can indeed use Celery for setting up this system.
1
0
0
Does anyone knows of a proven and simple way of running a system command from a django application? Maybe using celery? ... From my research, it's a problematic task, since it involves permissions and insecure approaches to the problem. Am i right? EDIT: Use case: delete some files on a remote machine. Thanks
How to run a system command from a django web application?
1.2
0
0
148
21,490,336
2014-01-31T21:23:00.000
3
0
1
0
python,ubuntu,pip
21,490,370
2
true
0
0
Any single pip installation is (roughly) specific to one Python installation. You can, however, have multiple parallel pip installations. Your package manager probably has a package called pip-3.3 or similar. If not, you can manually install it (run the get-pip.py script using Python 3.3), though you'll have to be careful that it ends up in the right place in PATH. You can also use a virtualenv.
1
1
0
I'm using Ubuntu, how do I instruct pip to use the Python3 installation and not Python2.6? 2.6 is the default installation on Ubuntu. I can't upgrade that as it will break Ubuntu.
Instructing Pip to Use Python 3
1.2
0
0
95
21,497,489
2014-02-01T11:31:00.000
2
0
0
0
python,flask,python-babel,flask-babel
22,099,629
2
false
1
0
It's not possible to use Babel in database translations, as database content is dynamic and babel translations are static (they didn't change). If you read the strings from the database you must save the translations on the database. You can create a translation table, something like (locale, source, destination), and get the translated values with a query.
1
9
0
I'm using Flask-Babel for translating string. In some templates I'm reading the strings from the database(postgresql). How can I translate the strings from the database using Flask-Babel?
translating strings from database flask-babel
0.197375
1
0
1,789
21,498,342
2014-02-01T12:57:00.000
1
0
1
1
python,subprocess
21,498,354
1
true
0
0
Given you're working in a Linux/POSIX environment you could read the EDITOR environment variable using the os.environ map.
1
0
0
I am launching the text editor but for different users the default text editor could be different, so how do I get the name of which text editor is being used just to handle if an error occur switch to different text editor ?
how do I get the name of application launched by subprocess in python?
1.2
0
0
35
21,500,736
2014-02-01T16:47:00.000
0
0
1
0
python,regex,machine-learning
21,604,563
6
false
0
0
There were suggestions about unsupervised learning, but I recommend to use supervised learning, so you'll categorize 100-200 positions manually, and then algo will do the rest. There are number of resources, libraries, etc. - look please at "Programming Collective Intelligence" book - they provided good machine learning topics with python examples.
2
11
0
Problem: I am given a long list of various position titles for jobs in the IT industry (support or development); I need to automatically categorize them based on the general type of job they represent. For example, IT-support analyst, help desk analyst... etc. Could all belong to the group IT-Support. Current Approach: Currently, I am manually building regex patterns to accomplish this, which change as I encounter new titles which should be included in a group. For example, I originally used the pattern: "(HELP|SERVICE) DESK" to match IT-Support type jobs, and this eventually became: "(HELP|SUPPORT|SERVICE) (DESK|ANALYST)" which was even more inclusive. Question: I feel like there should be a fairly intuitive way to automatically build these regex patterns with some sort of algorithm, but I have no idea how this might work... I've read about NLP briefly in the past, but its extremely alien to me... Any suggestions on how I might implement such an algorithm with/without NLP? EDIT: I'm considering using a decision tree, but it has some limitations which prevent it from working (in this situation) "out-of-the-box"; for example, if I have built the following tree: (Service)->(Desk)->(Support) OR ->(Analyst) ...where Support and Analyst are both children of Desk Say I get the string "Level-1 Service Desk Analyst"... This should be categorized using the decision tree above, but it will not inherantly match the tree (since there is no root node named "Level" or "Level-1"). I believe I am heading in the right direction now, but I need additional logic. For example, if I am given the following hypothetical strings: IT Service Desk Analyst Level-1 Help Desk Analyst Computer Service Desk Support I would like my algorithm to create something like below: (Service OR Help)->(Desk)->(Analyst OR Support) ...where Service and Help are both root nodes, and both Analyst and Support are children of Desk Basically, I need the following: I would like this matching algorithm to be able to reduce the strings it is presented with to a minimal number of sub-strings which effectively match all of the strings in a given cateogory (preferably using a decision tree). If I am not being clear enough, just let me know!
Python - A way to learn and detect text patterns?
0
0
0
13,027
21,500,736
2014-02-01T16:47:00.000
0
0
1
0
python,regex,machine-learning
21,549,987
6
false
0
0
This sounds like a clustering, or unsupervised, problem rather than a decision tree one (do you know all the roles in advance, and can you provide labelled data). If it were me, I'd be tempted to build a bag-of-words style representation of your strings and run a generic clustering algorithm (k-means, say) to see what came out. Deciding on a category to assign a new string to is then a fairly simple matching operation (depending on what you use to do the clustering). You could also look at topic models, with the simplest being Latent Dirichlet Allocation, as being of potential application here. You'd get an assignment to a topic per-word, not per string, but that could be altered if you tweaked the method.
2
11
0
Problem: I am given a long list of various position titles for jobs in the IT industry (support or development); I need to automatically categorize them based on the general type of job they represent. For example, IT-support analyst, help desk analyst... etc. Could all belong to the group IT-Support. Current Approach: Currently, I am manually building regex patterns to accomplish this, which change as I encounter new titles which should be included in a group. For example, I originally used the pattern: "(HELP|SERVICE) DESK" to match IT-Support type jobs, and this eventually became: "(HELP|SUPPORT|SERVICE) (DESK|ANALYST)" which was even more inclusive. Question: I feel like there should be a fairly intuitive way to automatically build these regex patterns with some sort of algorithm, but I have no idea how this might work... I've read about NLP briefly in the past, but its extremely alien to me... Any suggestions on how I might implement such an algorithm with/without NLP? EDIT: I'm considering using a decision tree, but it has some limitations which prevent it from working (in this situation) "out-of-the-box"; for example, if I have built the following tree: (Service)->(Desk)->(Support) OR ->(Analyst) ...where Support and Analyst are both children of Desk Say I get the string "Level-1 Service Desk Analyst"... This should be categorized using the decision tree above, but it will not inherantly match the tree (since there is no root node named "Level" or "Level-1"). I believe I am heading in the right direction now, but I need additional logic. For example, if I am given the following hypothetical strings: IT Service Desk Analyst Level-1 Help Desk Analyst Computer Service Desk Support I would like my algorithm to create something like below: (Service OR Help)->(Desk)->(Analyst OR Support) ...where Service and Help are both root nodes, and both Analyst and Support are children of Desk Basically, I need the following: I would like this matching algorithm to be able to reduce the strings it is presented with to a minimal number of sub-strings which effectively match all of the strings in a given cateogory (preferably using a decision tree). If I am not being clear enough, just let me know!
Python - A way to learn and detect text patterns?
0
0
0
13,027
21,501,848
2014-02-01T18:28:00.000
0
0
1
0
python,c,compilation
21,501,934
3
false
0
0
Variables in Python are just references to objects. The memory for an object is allocated at runtime in the moment that the object is instantiated.
3
1
0
I was wondering what happens internally so that using Python you don't need to declare a variable type before assign it to something. Other languages like C reserve memory prior to the assignment phase. I was just wondering what happens on compilation time so that Python can skip that step?
Assignments in Python
0
0
0
89
21,501,848
2014-02-01T18:28:00.000
0
0
1
0
python,c,compilation
21,501,899
3
false
0
0
Well, I think the python don't skip that step, what he does is look for the value inside the variable and then he should knows what type of variable it is. Like: a = 5 b = 5.0 Python will look, what value is inside the a, well it's five, so lets make this variable an integer! And then move to the next variable.
3
1
0
I was wondering what happens internally so that using Python you don't need to declare a variable type before assign it to something. Other languages like C reserve memory prior to the assignment phase. I was just wondering what happens on compilation time so that Python can skip that step?
Assignments in Python
0
0
0
89
21,501,848
2014-02-01T18:28:00.000
1
0
1
0
python,c,compilation
21,501,929
3
true
0
0
If you look deep down at the C level, all Python objects are of type PyObject*, and allocated on the heap. Variables are just names (usually implemented as hash map entries) you bind to these objects.
3
1
0
I was wondering what happens internally so that using Python you don't need to declare a variable type before assign it to something. Other languages like C reserve memory prior to the assignment phase. I was just wondering what happens on compilation time so that Python can skip that step?
Assignments in Python
1.2
0
0
89
21,502,099
2014-02-01T18:50:00.000
2
0
1
0
python,scipy,spyder
70,327,984
3
false
0
0
I just started exploring Spyder 4.1.5 (unfortunately could not get 5.1.5 installed), and found this for EOL settings: 'Tools' > 'Preferences' > choose 'Editor' in the list on the left > 'Advanced setting' tab on the right > at the bottom is the 'End-of-line characters' section. To convert existing CRLF to LF, select the LF option in the dropdown, then for each file you want to convert, make any edit and save the file and voila. (I think you have to do the edit+save step file-by-file.)
1
14
0
I am using Spyder IDE to develop code and the IDE currently has default end-of-line character set to be CRLF. I would like to use '\n' instead because all my existing source code uses '\n' and so I don't want to have a bunch of new files that use a different end-of-line character. Is there a way to specify the default end-of-line character in Spyder IDE? If yes, how?
Spyder IDE: How do you configure default end-of-line character?
0.132549
0
0
5,094
21,503,147
2014-02-01T20:20:00.000
2
0
0
1
python,macos,python-imaging-library,pillow
22,077,355
1
false
0
0
Reinstall X11 from XQuartz.org Install the latest XCode Install the command line tools: xcode-select --install Worked for me on mavericks
1
0
0
I'm having trouble upgrading from PIL to PILLOW on my mac. I tried "brew install libtiff lbjpeg webp littlecms" but homebrew couldn't find the lbjpeg - any tips?
Changing from PIL to PILLOW on a mac
0.379949
0
0
301
21,504,617
2014-02-01T22:40:00.000
5
0
1
1
python,eclipse,python-2.7,ubuntu
24,506,641
1
false
0
0
Configure Aptana Studio's python interpreter( you can configure more than one) In aptana, Window -> Preferences -> Interpreter Python and create a New interpreter. Select the python executable from the virtual environment (in windows it is python.exe which resides in Scripts subfoler of the virtualenv,where as in ubuntu python is under bin subfolder) . Now Aptana will show a list of directories to add also remember to check C:\Python27\Lib or Ubuntu conterpart. Now on creating use this interpreter. Or if to use with existing project Step 1.Take project properties(File -> Properties OR By right clicking on Project). Step 2.From PyDev Interpreter/Grammer select the interpreter you configured above. Edit : In this way you can even configure both python 3 and python 2 for Aptana. You have to configure an interpreter for each python 3 and python 2. Then follow steps above to select the interpreter.
1
3
0
I did some searches on this topic and the solutions didn't work for me. I am running both a Linux (Ubuntu) environment and Windows. My system is Windows 8.1 but I have virtualbox with Ubuntu on that. Starting with Windows... I created a venv directory off the root of the e drive. Created a project folder and then ran the activate command, which is in the venv>Scripts directory. So, after activating that (note, I had installed virtualenv already)... so after activating that I then changed into the folder with my module and it ran fine, with the shebang, I didn't even have to type python in front of my filename. However, in Aptana Studio, it cannot find the module I installed with pip. So, it doesn't work. In an earlier post it was recommended that one choose a different interpreter and browse to the env and select that. So, how does one get this installed and working with an IDE like Eclipse and Aptana Studio? I am having problems on Ubuntu. The instructions I found had me using package installer to install virtualenv, pip and a few other tools that package these. The problem is that on Ubuntu the default version of python is 2.7.x. I need 3.3 or 3.x. So, can someone point me in the direction of how to setup virtual environments for the 2.7.x branch of python and the 3.x branch. Also, how does one tell the IDE (Eclipse or Aptana Studio) to use the virtualenv? Thanks, Bruce
How do I tell Aptana Studio to use Python virtualenv?
0.761594
0
0
2,520
21,507,215
2014-02-02T04:56:00.000
3
1
1
0
python,git,git-config
21,507,326
1
true
0
0
git has support for integrating with local keyring/password management utilities; search google for "git (name of your keyring program)". (These are called "credential helpers".) Alternatively, if your remote is over SSH, you can use public key authentication, along with ssh-agent to remember the password to your private key. If it's something else entirely that you're storing the password for (the "email password"?), you could consider a similar tactic: integrate with the local keyring manager. I'm not sure if git credential helpers can do this directly for you or not, but you might be able to implement the same side of the protocol as git, and thus use credential helpers that already exist.
1
0
0
I have made a git command in python, want user to save email password in git config but don't want any user to understand if he opens .gitconfig file !!
how to save password to git config in encrypted format that is is not readable if .gitconfig is opened
1.2
0
0
292
21,507,956
2014-02-02T06:58:00.000
3
0
1
0
python,matplotlib
21,508,062
1
true
0
0
Creating sample data In [3]: data = {'title1': {10:20, 4:10}, 'title2':{8:10, 9:20, 10:30}} In [4]: data Out[4]: {'title1': {4: 10, 10: 20}, 'title2': {8: 10, 9: 20, 10: 30}} Iterating over data; creating x and y for each title and plotting it in new figure In [5]: for title, data_dict in data.iteritems(): ...: x = data_dict.keys() ...: y = data_dict.values() ...: plt.figure() ...: plt.plot(x,y) ...: plt.title(title) If you are not using IPython plt.show()
1
1
1
I need help plotting a dictionary, below is the data sample data set. I want to create a graph where x:y are (x,y) coordinates and title'x' would be the title of the graph.. I want to create individual graphs for each data set so one for title1':{x:y, x:y}, another one for title2:{x:y, x:y}....and so on. Any help would be greatly appreciated. Thank you. data = {'title1':{x:y, x:y},title2:{x:y,x:y,x:y},'title3':{x:y,x:y}....}
Plotting dictionaries within a dictionary in Myplotlib python
1.2
0
0
6,297
21,509,104
2014-02-02T09:43:00.000
1
1
0
0
python,webserver
21,509,226
2
false
0
0
With Flask you can do that in about ten lines of code.
1
0
0
I need to access my python programs through IP address for making it to do something in server. Creating Apache Server for only one python script is not good solution. In server it works like: python script.py --arg Now I need something like http://xxx.xxx.xxx.xxx:xxxx/script.py --arg or something else. Main idea is to send argument to program remotely without ssh. PS. Main problem with framework and python simple HTTP server was block in firewall.
Best way to create simple web server for python files
0.099668
0
1
205
21,509,623
2014-02-02T10:46:00.000
0
0
0
0
python,tkinter,raspberry-pi,on-screen-keyboard
21,511,280
1
true
0
1
You don't need to simulate keypresses if all you want to do is insert the numbers into the entry widget. Just have the buttons directly insert their value into the entry widget with the entry widget insert method.
1
0
0
I am using Tkinter to create an application which requires a 0-9 numerical keypad to be built in to the UI. I plan to do this with 10 button widgets which enter the relevant number(s) into the currently selected Entry widget. I do not want to use one of the pre-made on-screen keyboards (e.g. Matchbox-keyboard) that are available, it needs to be bespoke to the application. So essentially - how do I simulate key-press events using on-screen buttons to enter values into entry fields without taking the focus off the entry field?
In Python (on Raspberry Pi) how do I create an embedded keypad within my Tkinter window
1.2
0
0
1,024
21,509,787
2014-02-02T11:04:00.000
0
0
1
0
python,merge
21,510,352
1
false
0
0
Open the gene descripion file, and load a dictionary where key would be the gene number, and the value would be the sample description. Then open the module file, and loop on its lines. For each line, look for the corresponding gene entry in the dictionary. Print the module, gene, sample description. That's it! If you need more information, check how to read a file and use a dictionary in the python documentation.
1
0
0
@tim-pietzcker I would like to merge two tab-delimited text files that share one common column. I have an 'identifier file' that looks like this (2 columns by 1050 rows): module 1 gene 1 module 1 gene 2 .. module x gene y I also have a tab-delimited 'target' text file that looks like this (36 columns by 12000 rows): gene 1 sample 1 sample 2 etc gene 2 sample 1 sample 2 etc .. gene z sample 1 sample 2 etc I would like to merge the two files based on the gene identifier and have both the matching expression values and module affiliations from the identifier and target files. Essentially to take the genes from the identifier file, find them in the target file and create a new file with module #, gene # and expression values all in one file. Your suggestions would be welcome. Thanks!
Merge two tab delimited text files by one common column in python
0
0
0
689
21,510,739
2014-02-02T12:46:00.000
0
0
1
0
python,virtual-machine
21,511,103
2
false
0
0
Run this in command prompt python -c "from platform import python_implementation; print python_implementation()"
1
4
0
I installed Python in my PC. how to find out which VM came with it. is it cpython or ipython or jpython?
How to find out which VM i have in my Python installation?
0
0
0
68
21,514,258
2014-02-02T18:11:00.000
0
1
0
0
python,python-3.x,cgi,fork
21,541,263
1
true
0
0
Never run application from cgi scripts, It's very insecure. Use any DB and cron for this. Store data from your cgi script to DB and run from cron mail script that will sending all emails.
1
0
0
I am making a website for a sports team. there is a python 3.3 cgi script that allows a user to input match data. I would like to send an email to everyone on the mailing list to tell them that there has been a new match submitted, but I obviously don't want the person inputting the data to be waiting for ages while all the emails are sent. How can I start a python script in the background that will do this. I also need it to queue any match submits after while this is still processing. thanks for any help in advance.
How to fork a python script in the background from cgi script
1.2
0
0
217
21,514,717
2014-02-02T18:50:00.000
0
0
1
0
linux,qt,pyqt,size,python-2.x
21,546,276
1
true
0
1
I can't think of a way of doing what you want, but if you are using a standard PyQt distro, standard practice is to leave it up to the user to download and install dependencies. This could be automated by having an install script part of your ISO, that determines if pyqt is needed and if not available fetches the pyqt from your site and installs it, or automatically downloads source from riverbank site and attempts to build automatically.
1
2
0
I have a PyQt program that's apart of package which is only about 9MB. This isn't much of a concern except that the Qt dependencies that get drawn in with it combined are closer to 100MB. So my question is there any logical and safe way of including only portions of the Qt library that I could include in my package and then no longer include Qt as a dependency, or a smaller alternative to the enormous Qt library that would still be compatible with my code?
Including only minimal Qt library with a program
1.2
0
0
223
21,516,027
2014-02-02T20:48:00.000
3
0
1
0
python,pycharm,pyscripter
21,516,091
6
false
0
0
Run -> Edit configuration -> select the script you want to run and give it a display name -> OK Now you can run it with the green "Run" button. The green bug button (next to the run button) will run it in debug mode. Remark: next to the run button you can monitor the script/configuration you run by selecting it's display name.
2
16
0
Are there any smooth way to run Python scripts in the PyCharm's console? My previous IDE - PyScripter - provides me with that nice little feature. As far as I know PyCharm has 2 ways of running script in console: 1) Select a bunch of code and press Ctrl+Alt+E. 2) Save the code in a file and import it from the Console. Are the any way to do it by pressing "Run" or "Debug" buttons? I need to see the result of my script in the console and all variables available to manipulate.
Running code in PyCharm's console
0.099668
0
0
22,031
21,516,027
2014-02-02T20:48:00.000
28
0
1
0
python,pycharm,pyscripter
22,387,377
6
false
0
0
In the Run/Debug Configuration, add -i to the interpreter options. This will stop it from closing a python session even after a successful run. I.e. you will be able to see all the variable contents
2
16
0
Are there any smooth way to run Python scripts in the PyCharm's console? My previous IDE - PyScripter - provides me with that nice little feature. As far as I know PyCharm has 2 ways of running script in console: 1) Select a bunch of code and press Ctrl+Alt+E. 2) Save the code in a file and import it from the Console. Are the any way to do it by pressing "Run" or "Debug" buttons? I need to see the result of my script in the console and all variables available to manipulate.
Running code in PyCharm's console
1
0
0
22,031
21,516,287
2014-02-02T21:10:00.000
0
0
0
1
google-app-engine,python-2.7,google-cloud-endpoints
23,165,174
2
true
1
0
From what I gather, Google has enabled partial response for their APIs, but has not yet explained how to enable it for custom APIs. I'm assuming if they do let us know, it might entail annotations, and possibly overriding a method or two. I've been looking also, to no avail. I've been looking into this just due to a related question, where I'd like to know how to force the JSON object in the response from my google Endpoint API, to include even the members of the class that are null valued. I was trying to see if anything would be returned if I used a partial response with a field indicated that was null.. would the response have the property at least, or would it still not even exist as a property. Anyway, this lead me into the same research, and I do not believe we can enable partial responses in our own APIs yet.
1
0
0
I am learning endpoints and saw that other Google APIs have this "fields" query attribute. Also it appears in the api explorer. I would like to get a partial response for my api also, but when using the fields selector from the api explorer it is simply ignored by the server. Do I need to implement something in the server side? Haven't found anything in the docs. Any help is welcome.
How do you return a Partial response in app engine python endpoints?
1.2
0
1
418
21,517,296
2014-02-02T22:48:00.000
0
0
1
0
ipython,ipython-notebook
27,819,206
3
false
0
0
Updating iPython Notebook solved several problems I had with iPython Notebook; for instance, it autosaves, or auto-correction is disabled, or %matplotlib inline works now (before updating, I had to use --pylab inline in the command line when I was running $ipython notebook). As I use coda on my mac, I updated iPython Notebook via conda: $conda update ipython
1
4
0
Does anyone know if there's an option (or a suggested hack) to make IPython notebooks save automatically before executing a cell? Many times I've been working on something without saving for quite some time, then I execute a stupid command that prints so much crap to the console that my browser becomes unresponsive, leading to me losing all my work. A timed autosave might also do the trick.
How to autosave ipython notebook
0
0
0
2,023
21,517,747
2014-02-02T23:35:00.000
2
1
0
1
python,python-2.7,python-3.x,emacs,autocomplete
21,522,470
1
true
0
0
Maybe disable auto-complete at all? BTW from my feeling relying on company, not jedi, the distraction from auto-complete in most cases is far over gain. Emacs comes with a lot of great tools making edits faster: abbrev, dabbrev etc. which seem much more efficient. Well, if jedi delivers really intelligent completions, it might be part of the game.
1
3
0
I just now realize what is causing the trouble: Whenever the interpreter is busy, my Emacs buffer containing the python script buffer gets stuck, as I suspect that Emacs is trying to get the information of a function, and display it as a pop up. My usual solution is to spam C-g, but that gets old quickly. It has been bothering me for months, did anyone find a solution (such as a separate thread for the python info)? Even simply ceasing Jedi work while the interpreter is busy really would save a lot of frustration. I am using Jedi, auto-complete, Python 2.7 and Python 3.3 (the problems occur in both), on Ubuntu.
Emacs freezing when asking Jedi/Auto Complete information while Interpreter is busy
1.2
0
0
673
21,518,268
2014-02-03T00:53:00.000
1
0
0
0
python,django,mongodb,postgresql,amazon-s3
21,518,701
1
true
1
0
Its good to have different settings for production and dev. So you can just create a settings folder and have settings may be prod.py and dev.py. this will let you use diff apps for eg: you actually don't need debug tool bar on prod. And regarding the file, I feel you dont have to worry about the structure as such, you can always refer to Etag and get the file (md5 hash of the object)
1
0
0
I'm having trouble in establishing an ideal setup where I can distinguish between production and test environment for my django app. I'm using a postgresql database that stores a relative file path to a s3 bucket after I upload an image. Am I supposed to make a production copy of all the files in the s3 bucket and connect my current development code to this static directory to do testing? I certainly don't want to connect to production ... What's best practice in this situation? Also I may be doing things wrong here by having the file path in a postgresql database. Would it be more ideal to have some foreign key to a mongodb table which then holds the file path for the file path in aws s3? Another best practice question is how should the file path should be organized? Should I just organize the file path like the following: ~somebucket/{userName}/{date}/{fileNameName} OR ~somebucket/{userName}/{fileName} OR ~somebucket/{fileName} OR ~somebucket/{date}/{userName}/{fileNameName} OR ~somebucket/{fileName} = u1234d20140101funnypic.png ?? This is really confusing for me on how to build an ideal way to store static files for development and production. Any better recommendations would be greatly appreciated. Thanks for your time :)
How should I set up my dev enviornment for a django app so that I can pull on static s3 files?
1.2
1
0
41
21,518,745
2014-02-03T02:07:00.000
4
0
1
0
python,regex,sed,awk
21,518,754
2
false
0
0
No. Python provides this behavior through the re.sub function or the equivalent method on compiled regexp objects, but does not use the sed-style syntax.
1
0
0
I'm writing something in Python and I require a s/old/new/flags-style regular expression replacement method for Python, with that syntax. Is this something that Python provides, without me having to call sed or something? Thanks.
s/old/new syntax regex replacement in Python
0.379949
0
0
102
21,518,819
2014-02-03T02:22:00.000
7
0
1
0
python,c
21,518,829
4
true
0
0
This is simply not valid in Python. You can't use an assignment as an expression.
4
2
0
New to both python, and fairly beginner in C. Why will the subject code return an error in python? Does the assignment not have a return value?
why does this work in c but not in python: (a = 5) == 5
1.2
0
0
121
21,518,819
2014-02-03T02:22:00.000
1
0
1
0
python,c
21,519,846
4
false
0
0
C's design influenced Python noticeably (check out the string % operator), but some things were rejected because they were a source of errors in C code. Assignment expressions where one such. Preincrement and postincrement were rejected for similar reasons, but += (and similar) eventually made it in.
4
2
0
New to both python, and fairly beginner in C. Why will the subject code return an error in python? Does the assignment not have a return value?
why does this work in c but not in python: (a = 5) == 5
0.049958
0
0
121
21,518,819
2014-02-03T02:22:00.000
2
0
1
0
python,c
21,518,879
4
false
0
0
I am going to expand on Simeon's answer. First off, you are putting parenthesis around an expression. If you type that into the interpreter by itself you will get a syntax error. That is because parenthesis are only defined/interpreted in context - there is no context for Python when you are using an expression within the parenthesis. If you type (a-5) then it will attempt to resolve the expression and tell you that a is not defined. I hope this helps.
4
2
0
New to both python, and fairly beginner in C. Why will the subject code return an error in python? Does the assignment not have a return value?
why does this work in c but not in python: (a = 5) == 5
0.099668
0
0
121
21,518,819
2014-02-03T02:22:00.000
1
0
1
0
python,c
21,520,908
4
false
0
0
If you evaluate this statement, it comes down to True == 5 Does that make sense anywhere? I don't believe so.
4
2
0
New to both python, and fairly beginner in C. Why will the subject code return an error in python? Does the assignment not have a return value?
why does this work in c but not in python: (a = 5) == 5
0.049958
0
0
121
21,520,459
2014-02-03T05:39:00.000
-1
1
0
0
python,httprequest,buildbot
22,557,265
2
false
0
0
Just my thoughts..As far as I know it is better to use a python script from a build step. Simple and easy to control. The logic being: the entire buildbot is inside one http connection/session and sending another http request somewhere might have issues with the connection/session. from the buildbot httpstep description, you need to install additional python packages which might be not be so convenient to do on multiple slaves/masters.
1
1
0
I am using buildbot version 0.8.5 and need to send an HTTP post request from it as a step. After searching for it on internet, I found that the latest version 0.8.8 has a step called HTTPStep for doing so. Is there any similar step in the older version? I know it can be done using batch file or python program using urllib2. but is there any other way to do it?
Sending http post request in buildbot
-0.099668
0
1
268
21,521,587
2014-02-03T07:09:00.000
12
0
1
1
python,libcurl,pycurl
22,518,780
2
false
0
0
Use one of the two methods Method 1: sudo easy_install pycurl Method 2: pip install pycurl
1
5
0
I am very new to python and need help installing the pycurl library on my machine. I am running python 2.7 at the moment. A brief tutorial would be much appreciated.
Installing pycurl on mac
1
0
0
10,669
21,527,115
2014-02-03T12:11:00.000
1
0
1
0
windows,jython,python-sphinx,jython-2.5
21,824,353
1
true
1
0
I have managed to get it working. The problem was that the manual installation and the use of Jython meant that certain environment variables that were expected were not in place. Also, the use of Windows 7 (and I believe MS Windows in general) means that Python scripts without an extension cannot be run without calling them explicitly through Jython (Windows doesn't check for shebangs). Finally, file associations had not been set up (as happens automatically with CPython installation, but has not happened with Jython). For anyone else with similar problems the following setup works for me: Locations: Java Runtime: C:\Java\jre7 Jython: C:\Jython\jython2.5.2 User Environment Variables: JRE_HOME: C:\Java\jre7 JAVA_HOME: %JRE_HOME% CLASSPATH: . JYTHON_HOME: C:\Jython\jython2.5.2 PATH: %JRE_HOME%\bin;%JYTHON_HOME%\bin File Associations: At the command prompt type assoc .py=Python.File to associate 'Python.File' with the '.py' extension. At the command prompt type ftype Python.File=C:\Jython\jython2.5.2\jython.bat "%1" %* to associate the Jython command with files of type 'Python.File'. Append '.py' (;.PY) to the PATHEXT system environment variable. This will make it possible to execute Python files without having to provide their '.py' extension. (N.B. This does not make it possible to run Python files that do not have a '.py' extension.) File Extensions: Rename the four Sphinx commands to include '.py' extensions. This is remarkably difficult with vanilla Windows 7 as it does everything it can to distance the user from such 'low level' details as file extensions, however the rename command at the command prompt does the job: type ren sphinx* sphinx*.py when in the Jython bin directory. It should now be possible to call sphinx-apidoc or similar from anywhere. Once this is complete the command make html, when called from the documentation directory, should work as expected.
1
1
0
Once sphinx-apidoc has been run the command C:\path\to\doc\make html produces an error beginning: The 'sphinx-build' command was not found [snip] However the command does exist and the relevant environment variables are set. More detail: 1 - Trying to run sphinx_apidoc: 'C:\path\to\jython\bin\sphinx-apidoc' is not recognised as an internal or external command 2 - Called using Jython works: jython C:\path\to\jython\bin\sphinx-apidoc with sensible options produces the documentation *.rst files, conf.py, etc files. 3 - make html then produces the following error: The 'sphinx-build' command was not found [snip] It then recommends setting the SPHINXBUILD environment variable, and even the PATH. I already have these two environment variables set, proven to myself by calling echo %PATH% and echo %SPHINXBUILD%. This is where I get stuck. It appears that the files that Sphinx uses (sphinx-apidoc and sphinx-build in this case), which are in the C:\path\to\jython\bin\ directory, do not have any file suffixes. When called directly from Jython they work as expected (see point 2 above), however when called as part of another process (e.g. make html) they are not recognised and the execution fails (see points 1 and 3 above). Does anyone know the what, why and most importantly 'how to fix' of this problem? My setup process is on an unnetworked Windows 7 computer. Jython (2.5.2) was installed using the Jython installer. Then each of the following packages (except setuptools) was installed by extracting it locally and then running jython setup.py install in its extracted directory: setuptools: by calling jython ez_setup.py with setuptools-1.4.2.tar.gz in the same directory (so there is no attempt to download it) Jinja2 (2.5) docutils (0.11) Pygments (1.6) Sphinx (1.2.1) numpydoc (0.4) - Only mentioned because it is also isntalled on the machine.
How to get Sphinx working with Jython on an unnetworked Windows 7 computer?
1.2
0
0
376
21,527,471
2014-02-03T12:28:00.000
4
0
1
0
python,virtualenv,pip
21,527,635
2
false
0
0
virtualenv is used to create seperate environment for each project, based on its dependencies. If --no-site-packages is not set, then the virtual envrironment will only contain symbolic links ( shortcuts) to the global site-packages. If it is set, then it creates a copy of the site package to provide fully isolated environment.
1
1
0
I am very new to python. I am trying to install virtualenv and create a sample project. I could see the option like --no-site-packages. I tried(virtualenv myapp) without specifying option and try to install flask package(pip install flask). It installs in the package in lib/python2.7/site-packages/flask. What is the purpose of option --no-site-packages. PS: Virtualenv version - 1.11.2
What is --no-site-packages in virtualenv
0.379949
0
0
2,339
21,529,226
2014-02-03T13:55:00.000
1
0
0
0
python,django,unit-testing,plugins,django-cms
21,529,356
1
true
1
0
create a page with cms.api... and then get the right placeholder form page.placeholders.all() and call the add_plugin() with this.
1
0
0
My Django app needs a test that follows the following scenario: creates a page, edits it by adding a new plugin, then saves it. So far, I am stuck at adding the plugin to the page. How can I do this programatically in a test? I looked over add_plugin() from cms.api, but it needs a placeholder, which I have no idea how to link to an existing page and/or template.
Add plugin on Django-CMS page programatically in unit test
1.2
0
0
710
21,532,724
2014-02-03T16:39:00.000
1
0
0
0
python,scikit-learn
21,532,842
2
false
0
0
Clustering is not in itself that well-defined a problem (a 'good' clustering result depends on your application) and k-means algorithm only gives locally optimal solutions based on random initialization criteria. Therefore I doubt that the results you would get from clustering a random 2GB subsample of the dataset would be qualitatively different from the results you would get clustering over the entire 6GB. I would certainly try clustering on the reduced dataset as a first port of call. Next options are to subsample more intelligently, or do multiple training runs with different subsets and do some kind of selection/ averaging across multiple runs.
1
1
1
I am using scikit-learn. I want to cluster a 6gb dataset of documents and find clusters of documents. I only have about 4Gb ram though. Is there a way to get k-means to handle large datasets in scikit-learn? Thank you, Please let me know if you have any questions.
Handling K-means with large dataset 6gb with scikit-learn?
0.099668
0
0
2,177
21,535,003
2014-02-03T18:36:00.000
1
1
0
0
python,api,soundcloud
30,069,248
3
false
0
0
You can also do the following : import soundcloud token= 'user_access_token' client = soundcloud.Client(access_token=token) user_info = client.get('/me') user_favorites = client.get('/me/favorites') user_tracks = client.get('/me/tracks') and so on...
1
1
0
Issues using SoundCloud API with python to get user info I've downloaded the soundcloud library and followed the tutorials, and saw on the soundcloud dev page that user syntax is, for example /users/{id}/favorites. I just don't know how to use python to query user information. Specifically, i would like to print a list of tracks that a given user liked, (or favorited, but liked would be better). any help would be greatly appreciated. thanks!
soundcloud api python user information
0.066568
0
0
503
21,535,028
2014-02-03T18:37:00.000
2
1
0
0
python,robotframework,python-unittest
26,558,782
3
false
1
0
Robot is not at all based on xunit technologies. Personally I think it makes a great unit testing framework for python code, since you can create keywords that can directly import your modules. I use this technique for some projects I work on. With robot, you can tag your unit tests or put them all in a separate hierarchy so that you can run them separate from acceptance tests if you like, or combine them and get statistics broken out separately.
2
6
0
Our group is evaluating Robot Test Framework for our QA group, not just for BDD, but also to possibly cover a lot of our regular functionality testing needs. It certainly is a compelling project. To what extent, if any, is Robot Framework based on xunit (unittest) architecture? I see that unittest asserts can be used, but I don't see that the RF testcases themselves are based on unittest.TestCase. Ideally, our organization would like to be able to be able to write Robot Framework tests, as well as Python unittest testcases, run the testcases together from one runner and get integrated results, reuse RF's Selenium2 Library's "keywords" as functions used by our regular unittest testcases in order to share a common SE code-base. Is this a solved problem? Does anybody do this kind of thing?
Running unittest Test Cases and Robot Framework Test Cases Together
0.132549
0
0
7,792
21,535,028
2014-02-03T18:37:00.000
10
1
0
0
python,robotframework,python-unittest
21,565,221
3
false
1
0
RobotFramework is not the right tool for unit testing. Unit-tests should be written in the same language of the units (modules, classes, etc.) The ability to describe scenarios in natural language (which is one of the strongest features of systems like RF) is worthless in unit tests. At this level of testing scenarios are for input x you get output y. RF is best suited in Acceptance Testing and Integration Testing, the top-grained verification of your system. Nevertheless you can integrate RF and xunit in your QA system together. And merge reports from RF and unit-test.
2
6
0
Our group is evaluating Robot Test Framework for our QA group, not just for BDD, but also to possibly cover a lot of our regular functionality testing needs. It certainly is a compelling project. To what extent, if any, is Robot Framework based on xunit (unittest) architecture? I see that unittest asserts can be used, but I don't see that the RF testcases themselves are based on unittest.TestCase. Ideally, our organization would like to be able to be able to write Robot Framework tests, as well as Python unittest testcases, run the testcases together from one runner and get integrated results, reuse RF's Selenium2 Library's "keywords" as functions used by our regular unittest testcases in order to share a common SE code-base. Is this a solved problem? Does anybody do this kind of thing?
Running unittest Test Cases and Robot Framework Test Cases Together
1
0
0
7,792
21,535,376
2014-02-03T18:54:00.000
6
1
0
0
python,scheduler,win32com
21,536,420
1
true
0
0
Office isn't designed to run as a service, and needs to be run interactively. You'll need to change your task configuration in Task Scheduler to run the task as the currently logged-in user, on the current user's desktop, with the current user's privileges.
1
5
0
I have a python script that sends out an email using win32com and Outlook. The script runs without a hitch when I run it through an interpreter or double-click on the script. However, when I run it through the Task Scheduler, I get the following message: "Something went wrong. We couldn't start your program. Please try starting it again. If it won't start, try repairing Office from 'Programs and Features' in the Control Panel." I'm using Office 365, and Python 2.6. I've tried running the script through the scheduler after killing the Outlook process, but I ran into the same issue.
Python script involving Outlook through win32com runs when double-clicking, but not through task scheduler
1.2
0
0
2,057
21,536,786
2014-02-03T20:13:00.000
0
0
0
0
python,svg
21,537,454
3
false
0
0
I simple used circles as dots, with a tiny radius.
1
1
0
I'd like to draw a curve with svgwrite, I'd like to do it pixel by pixel because I'm doing some calculations on the coordinates. How could I do it?
Draw a pixel or point
0
0
0
772
21,538,086
2014-02-03T21:24:00.000
2
0
0
1
python,process,uwsgi
21,546,696
1
false
0
0
Use --lazy-apps, in this way the app will be loaded by each worker after the master has been fully spawned (and its external daemons started)
1
1
0
I have a separate process that I want to run alongside the python process I have managed by uWSGI. I wanted to use the attach-daemon option to start this process, but it seems that bash command specified in attach-daemon does not get called until after the python process' app gets started up. However, I need the process to be running before the python process starts up in order for everything to run correctly. Is there any way to specify which order things get started in? It's not even necessary to me that I use attach-daemon, if there's a simpler way to initialize a set of managed processes in a defined order.
uwsgi attach-daemon before python process starts
0.379949
0
0
380
21,538,859
2014-02-03T22:07:00.000
39
0
1
0
python,django,pycharm
22,899,916
16
false
1
0
To set your environment variables in PyCharm do the following: Open the 'File' menu Click 'Settings' Click the '+' sign next to 'Console' Click Python Console Click the '...' button next to environment variables Click the '+' to add environment variables
6
45
0
I have moved my SECRET_KEY value out of my settings file, and it gets set when I load my virtualenv. I can confirm the value is present from python manage.py shell. When I run the Django Console, SECRET_KEY is missing, as it should. So in preferences, I go to Console>Django Console and load SECRET_KEY and the appropriate value. I go back into the Django Console, and SECRET_KEY is there. As expected, I cannot yet run a manage.py Task because it has yet to find the SECRET_KEY. So I go into Run>Edit Configurations to add SECRET_KEY into Django server and Django Tests, and into the project server. Restart Pycharm, confirm keys. When I run a manage.py Task, such as runserver, I still get KeyError: 'SECRET_KEY'. Where do I put this key?
Pycharm: set environment variable for run manage.py Task
1
0
0
74,590
21,538,859
2014-02-03T22:07:00.000
15
0
1
0
python,django,pycharm
21,603,624
16
false
1
0
Same here, for some reason PyCharm cant see exported env vars. For now i set SECRET_KEY in PyCharm Run/Debug Configurations -> "Environment variables"
6
45
0
I have moved my SECRET_KEY value out of my settings file, and it gets set when I load my virtualenv. I can confirm the value is present from python manage.py shell. When I run the Django Console, SECRET_KEY is missing, as it should. So in preferences, I go to Console>Django Console and load SECRET_KEY and the appropriate value. I go back into the Django Console, and SECRET_KEY is there. As expected, I cannot yet run a manage.py Task because it has yet to find the SECRET_KEY. So I go into Run>Edit Configurations to add SECRET_KEY into Django server and Django Tests, and into the project server. Restart Pycharm, confirm keys. When I run a manage.py Task, such as runserver, I still get KeyError: 'SECRET_KEY'. Where do I put this key?
Pycharm: set environment variable for run manage.py Task
1
0
0
74,590
21,538,859
2014-02-03T22:07:00.000
22
0
1
0
python,django,pycharm
30,374,246
16
false
1
0
Another option that's worked for me: Open a terminal Activate the virtualenv of the project which will cause the hooks to run and set the environment variables Launch PyCharm from this command line. Pycharm will then have access to the environment variables. Likely because of something having to do with the PyCharm process being a child of the shell.
6
45
0
I have moved my SECRET_KEY value out of my settings file, and it gets set when I load my virtualenv. I can confirm the value is present from python manage.py shell. When I run the Django Console, SECRET_KEY is missing, as it should. So in preferences, I go to Console>Django Console and load SECRET_KEY and the appropriate value. I go back into the Django Console, and SECRET_KEY is there. As expected, I cannot yet run a manage.py Task because it has yet to find the SECRET_KEY. So I go into Run>Edit Configurations to add SECRET_KEY into Django server and Django Tests, and into the project server. Restart Pycharm, confirm keys. When I run a manage.py Task, such as runserver, I still get KeyError: 'SECRET_KEY'. Where do I put this key?
Pycharm: set environment variable for run manage.py Task
1
0
0
74,590
21,538,859
2014-02-03T22:07:00.000
20
0
1
0
python,django,pycharm
28,723,630
16
false
1
0
You can set the manage.py task environment variables via: Preferences| Languages&Frameworks| Django| Manage.py tasks Setting the env vars via the run/debug/console configuration won't affect the built in pycharm's manage.py task.
6
45
0
I have moved my SECRET_KEY value out of my settings file, and it gets set when I load my virtualenv. I can confirm the value is present from python manage.py shell. When I run the Django Console, SECRET_KEY is missing, as it should. So in preferences, I go to Console>Django Console and load SECRET_KEY and the appropriate value. I go back into the Django Console, and SECRET_KEY is there. As expected, I cannot yet run a manage.py Task because it has yet to find the SECRET_KEY. So I go into Run>Edit Configurations to add SECRET_KEY into Django server and Django Tests, and into the project server. Restart Pycharm, confirm keys. When I run a manage.py Task, such as runserver, I still get KeyError: 'SECRET_KEY'. Where do I put this key?
Pycharm: set environment variable for run manage.py Task
1
0
0
74,590
21,538,859
2014-02-03T22:07:00.000
0
0
1
0
python,django,pycharm
41,200,535
16
false
1
0
Please note that the answer mentioned by "nu everest" works but you will not see Console tab available unless you create a project in pycharm. As individual files can be run without creating a project in pycharm some people might be confused. Although you have also to note that settings are lost to run-configurations that do not belong to a project when pycharm is closed.
6
45
0
I have moved my SECRET_KEY value out of my settings file, and it gets set when I load my virtualenv. I can confirm the value is present from python manage.py shell. When I run the Django Console, SECRET_KEY is missing, as it should. So in preferences, I go to Console>Django Console and load SECRET_KEY and the appropriate value. I go back into the Django Console, and SECRET_KEY is there. As expected, I cannot yet run a manage.py Task because it has yet to find the SECRET_KEY. So I go into Run>Edit Configurations to add SECRET_KEY into Django server and Django Tests, and into the project server. Restart Pycharm, confirm keys. When I run a manage.py Task, such as runserver, I still get KeyError: 'SECRET_KEY'. Where do I put this key?
Pycharm: set environment variable for run manage.py Task
0
0
0
74,590
21,538,859
2014-02-03T22:07:00.000
4
0
1
0
python,django,pycharm
65,267,215
16
false
1
0
When using PyCharm along with Django, there are multiple sections where you can set environment variables (EVs): File > Settings > Languages and Frameworks > Django There's no purpose to set EVs here File > Settings > Build, Execution, Deployment > Console > Python Console There's no purpose to set EVs here File > Settings > Build, Execution, Deployment > Console > Django Console Set EVs here and they'll be accesible when using the PyCharm Python Console (which in a Django project opens a Django shell) File > Settings > Tools > Terminal Set EVs here and they'll be accesible when using the PyCharm Terminal (i.e when running python manage.py commands in the terminal) Run > Edit configurations > [Your Django run configuration] Set EVs here and they'll be accesible when using the PyCharm Run button Tested on PyCharm 2020.2 using a virtual environment.
6
45
0
I have moved my SECRET_KEY value out of my settings file, and it gets set when I load my virtualenv. I can confirm the value is present from python manage.py shell. When I run the Django Console, SECRET_KEY is missing, as it should. So in preferences, I go to Console>Django Console and load SECRET_KEY and the appropriate value. I go back into the Django Console, and SECRET_KEY is there. As expected, I cannot yet run a manage.py Task because it has yet to find the SECRET_KEY. So I go into Run>Edit Configurations to add SECRET_KEY into Django server and Django Tests, and into the project server. Restart Pycharm, confirm keys. When I run a manage.py Task, such as runserver, I still get KeyError: 'SECRET_KEY'. Where do I put this key?
Pycharm: set environment variable for run manage.py Task
0.049958
0
0
74,590
21,540,126
2014-02-03T23:39:00.000
2
1
1
0
python,c,programming-languages,yacc,ply
21,540,275
1
true
0
1
If you are implementing a compiler in PLY, the compilation may take longer - but that's irrelevant the execution speed of your program. For example, you could use PLY to write a C compiler. The compiler may or may not be faster than your other C compiler, but the resulting executable should run at a similar speed (unless you miss a lot of optimisations etc.)
1
0
0
I'm interested in creating my own programming language and I would like to use python. My question is, would a language written in Python using the PLY library be considerably slower than CPython or would they be about the same in terms of program execution speed? Also in terms of performance how much better would it be if I implemented it in C? Thanks, Francis
Would a language written in Python using PLY be slow?
1.2
0
0
243
21,545,072
2014-02-04T06:02:00.000
1
0
1
0
python,pip,ipython,conda
21,581,989
2
false
0
0
If you're worried about it, you can just delete your Anaconda installation and start over. Or you can create a new conda environment conda create and work from that.
2
8
0
I'm trying to deal with iPython and the associated tools, but and in the process, I ended up installing ipython, numpy, scipy and other packages on both pip and conda (conda comes with a bunch of these goodies). Any ideas/suggestions on what to do about resolving this? It hasn't caused me any problems yet, but I'm afraid it will be a big headache at some point. I have no idea now what python is importing now and when I run ipython, I don't seem to have control over which installation is running. I guess I could just uninstall pip and all its packages... Does that sound good? Thanks
Python packages duplicates installed with pip and conda
0.099668
0
0
3,444
21,545,072
2014-02-04T06:02:00.000
5
0
1
0
python,pip,ipython,conda
21,571,529
2
false
0
0
A couple of points of clarification: conda is the packaging tool used in the Anaconda python distribution. So, when you say "conda comes with a bunch of these goodies", I'm assuming you mean Anaconda. If you pip installed a bunch of packages, and then installed Anaconda, you should be fine: After a successful installation of Anaconda, the python interpreter that loads up will be the Anaconda python, and it will see all of the packages included with the distribution. If you have Anaconda installed, you should not have needed to use "pip" to install any of those packages. If you do "which python", you will see the path to the python interpreter you fire up. If this path has "anaconda/" anywhere in it, then you're using Anaconda python. Additionally, the very first line that shows up when you run python in interactive mode should also have "Anaconda 1.x.x" right after the Python version. One thing that can sometimes trigger oddness is if your PYTHONPATH environment variable is set, and is pointing to various directories that include additional packages that might be incompatible with the tested set of packages in Anaconda. You shouldn't need to uninstall pip itself, just the packages that are duplicates of the ones included in Anaconda. But, as I said before, if you have an actual installation of Anaconda, it should basically be able to run self-contained and independent of any packages you installed before, unless you have a PYTHONPATH set.
2
8
0
I'm trying to deal with iPython and the associated tools, but and in the process, I ended up installing ipython, numpy, scipy and other packages on both pip and conda (conda comes with a bunch of these goodies). Any ideas/suggestions on what to do about resolving this? It hasn't caused me any problems yet, but I'm afraid it will be a big headache at some point. I have no idea now what python is importing now and when I run ipython, I don't seem to have control over which installation is running. I guess I could just uninstall pip and all its packages... Does that sound good? Thanks
Python packages duplicates installed with pip and conda
0.462117
0
0
3,444
21,545,635
2014-02-04T06:40:00.000
1
0
0
1
python,google-app-engine
37,264,173
2
false
1
0
Sorry to revive this old question, but I have a solution for this issue given a few constraints with possible workarounds. Basically, the cursors for previous pages can be stored and reused for revisiting that page. Constraints: This requires that pagination is done dynamically (e.g. with Javascript) so that older cursors are not lost. Workaround if pagination is done across html pages, the cursors would need to be passed along. Users would not be able to arbitrarily select a forward page, and would only be given next/back buttons. Though any previously visited page could easily be jumped to. Workaround could be to internally iterate and discard entries while generating cursors at pagination points until finally reaching the desired results. Then return the list of previous page cursors as well. All of this requires a lot of extra bookkeeping and complexity, which almost makes the solution purely academic, but I suppose that would depend on how much more efficient cursors are than simply limit/offset. This could be a worthwhile endeavor if your data is such that you don't expect your users to want to jump ahead more than one page at a time (which includes most type of searches).
1
6
0
I want to do pagination in google app engine search api using cursors (not offset). the forward pagination is straight forward , the problem is how to implement the backward pagination.
Pagination in Google App EngineSearch API
0.099668
0
0
575