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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19,534,230 | 2013-10-23T06:20:00.000 | 2 | 1 | 1 | 0 | python | 19,534,829 | 4 | false | 0 | 0 | This sounds like you want to use virtualenv. It's a tool for creating isolated python environments with hooks for individual settings. Just put them in the bin/activate of your virtualenv. | 1 | 1 | 0 | I've heard about the PYTHONSTARTUP file as a way to automatically load specified modules and other code when starting python. But PYTHONSTARTUP is a global thing, for all instances of python. Is there such a thing as PYTHONSTARTUP that I can place in a specific directory and runs only when I start python in that dire... | A PYTHONSTARTUP file for a specific directory | 0.099668 | 0 | 0 | 2,921 |
19,539,031 | 2013-10-23T10:22:00.000 | 0 | 0 | 0 | 0 | python,winapi,pyqt,nfc,rfid | 19,565,664 | 1 | false | 0 | 1 | Unfortunately there is pretty much no way we can know how a particular rfid reader will work. Your best would just be to assume that it will fire off events somehow, and implement a fake rfid reader that sends off a string of data (that you expect to get from an rfid chip) when you want. Once you get an rfid reader, y... | 1 | 0 | 0 | I'm building a medical application that should respond to a RFID card scan (and pop up some information). I'm using PyQT to build this, btw.
Could someone tell me what tool to use to simulate rfid scans on the machine ? I'm a little noob to this, but I'm assuming I'll use a USB based reader and I should be able to some... | What tool to simulate rfid events on windows (python-win32 compatible?) | 0 | 0 | 0 | 331 |
19,545,847 | 2013-10-23T15:22:00.000 | 2 | 0 | 0 | 0 | python,macos,scrapy | 20,172,902 | 1 | false | 1 | 0 | Some questions from osx 10.9. try xcode-select --install | 1 | 2 | 0 | I recently updated from OS X 10.8 to OS X 10.9. It looks like the upgrade removed the previous version of Python and all the libraries that were installed. I am trying to re-install Scrapy on OS X 10.9 but I keep getting an error using both pip and easy_install.
Here is the error message I am encountering.
/private/tm... | Using Scrapy with OS X 10.9 | 0.379949 | 0 | 1 | 1,390 |
19,546,104 | 2013-10-23T15:34:00.000 | 1 | 0 | 0 | 0 | python,tkinter | 52,703,943 | 3 | false | 0 | 1 | One way to do this is build your own msg queue with a lightweight caller and scheduler to process msg and state of widget. This class or function is usually there without such name as queue manager because having back-end class is general-purpose item for application. Adding to simple event transfer queue could have th... | 2 | 4 | 0 | I have been playing with using tkinter to make overlays so some information would appear on top of the rest of the screen.
I'd rather not have this window block the mouse. Is there any way I can have it so click events pass though my overlay? So the window below my tkinter app receives the event. | How to make click events pass though a tkinter window? | 0.066568 | 0 | 0 | 2,078 |
19,546,104 | 2013-10-23T15:34:00.000 | 2 | 0 | 0 | 0 | python,tkinter | 19,547,637 | 3 | true | 0 | 1 | No, there is nothing built in to tkinter that would allow you to do that. The best that you could hope for is to capture an event, then use some sort of platform-specific tool that lets you create new events, and use the coordinates from the captured event to generate a new, non-tkinter event. | 2 | 4 | 0 | I have been playing with using tkinter to make overlays so some information would appear on top of the rest of the screen.
I'd rather not have this window block the mouse. Is there any way I can have it so click events pass though my overlay? So the window below my tkinter app receives the event. | How to make click events pass though a tkinter window? | 1.2 | 0 | 0 | 2,078 |
19,549,655 | 2013-10-23T18:31:00.000 | 3 | 0 | 0 | 0 | python,django,multithreading,thread-safety | 19,551,006 | 1 | true | 1 | 0 | As far as we speak about save versus get and query, you are safe, since distinct querysets objects are involved. In fact, every query, filter, get call and so on creates a new queryset instance, and do not modify any previously existed object.
But obviously, you can run into issues when accessing/modifying same db reco... | 1 | 1 | 0 | Specifically, I'm only talking about modifying separate instances of a Model (not sharing the same exact instance) across threads. But is it safe to be calling save() from one thread, while multiple other threads are invoking Model.objects.query() or Model.objects.get() for example? | Is Django's "Model" API thread-safe? | 1.2 | 0 | 0 | 1,406 |
19,550,982 | 2013-10-23T19:49:00.000 | 2 | 0 | 1 | 0 | python,windows | 19,551,107 | 3 | false | 0 | 0 | If you're going to use Python, which I think is a good choice, you'll use the glob module to get all the file names and the os module to rename the files. You'll want to figure out what delimeter you're looking for. In Python, strings have a split method. For each file name, split the file name at the delimeter, and re... | 1 | 0 | 0 | I have a bunch of mp3's that all have a long title, followed by "part 3" or "part 4", etc. So it's like "aasasdfjklakjsdf - part 3" and "aasasdfjklakjsdf - part 4" and "aasasdfjklakjsdf - part 5" and so on.
I have over 100 of these and I would like to simply remove the "aasasdfjklakjsdf - " part from the title of each ... | What's the simplest way to write a program/script to remove the same string from the beginning of a bunch of file names? | 0.132549 | 0 | 0 | 87 |
19,552,327 | 2013-10-23T21:09:00.000 | 2 | 0 | 1 | 0 | python,python-import,python-module | 19,552,441 | 1 | true | 0 | 0 | It is both; importing a Python module is a process that loads Python code from a file, compiles it (or loads cached bytecode), then executes the bytecode to form a module object with attributes. Loading from a file is input.
And it is neither; a process can also refer to a distinct program managed by the OS, each with ... | 1 | 1 | 0 | This question is really puzzling me, and I cannot work it out. At the start of almost every python program, we import things. I am unsure if it is a process, as it is loading something, or if it is an input, as it is inputting the module so that I can use it. | Is importing a module an input or a process? | 1.2 | 0 | 0 | 770 |
19,552,495 | 2013-10-23T21:18:00.000 | 2 | 0 | 0 | 0 | python,pyqt4,qfilesystemmodel | 19,566,575 | 1 | true | 0 | 1 | AFAIK QFileSystemModel relies on QFileIconProvider to get the correct icon.
You can do the same in your implementation by using the icon (const QFileInfo &info) method.
This may work or not depending on the Desktop Environment you use. | 1 | 1 | 0 | I have the path to a file/folder. How can I get the icon image in the system for this file/folder? I'm writing a customized file browse model for a QTreeView and would like to display the icon like what the QFileSystemModel does. | How do I retrieve the system icon for a file in python or qt? | 1.2 | 0 | 0 | 688 |
19,554,835 | 2013-10-24T00:33:00.000 | 6 | 0 | 1 | 0 | php,python | 19,554,860 | 2 | true | 0 | 0 | Assuming normal conventions are used in PHP:
single underscore indicates a protected member variable or method
double underscore indicates a private member variable or method
This stems from when PHP had weak OOP support and did not have a concept of private and protected (everything was public). This convention allo... | 1 | 3 | 0 | I have seen functions and variables beginning with underscores in various programming languages(PHP and Python) and am confused about the meaning behind it. | Functions and variables beginning with a single or double underscore | 1.2 | 0 | 0 | 1,895 |
19,555,523 | 2013-10-24T01:55:00.000 | 1 | 0 | 1 | 0 | python | 19,555,588 | 4 | false | 0 | 0 | You'll probably need two loops -- an outer one to loop thru the values, and an inner one to process the binary digits for each value.
You can either loop thru the values as integers & convert them to binary -- or you can carry a "current value" in binary around the loop, copying & incrementing it. | 1 | 0 | 0 | Each binary number should be represented as a tuple. When the function is called, the result should be a tuple containing 2^N binary numbers.
Ex. Binary(2)----> ((0,0), (0,1), (1,0), (1,1))
I am trying to use a while loop to do this.
Just some advice on where I could begin would be very helpful. | How can I write a function to return all the binary numbers with N digits, and in sorted order? | 0.049958 | 0 | 0 | 189 |
19,556,223 | 2013-10-24T03:11:00.000 | 0 | 0 | 0 | 0 | python,cherrypy | 19,556,266 | 2 | false | 0 | 0 | This is a HTTP protocol problem and has nothing to do with python or cherrypy.
HTTP clients don't send their hostname along with requests. | 2 | 2 | 0 | I have a cherrypy server on a machine, and i want to get the client identifier from the request. Now i can get the client IP by cherrypy.request.remote.ip, but if the client user use a proxy then the IP address will be the proxy address that i don't want, so is there any way for getting the host name of the client mach... | Is there a way to get client host name by cherrypy server | 0 | 0 | 1 | 5,019 |
19,556,223 | 2013-10-24T03:11:00.000 | 1 | 0 | 0 | 0 | python,cherrypy | 19,593,632 | 2 | true | 0 | 0 | Original client IP is usually passed along by proxy with X-Forwarded-For header. You can either study the header or use tools.proxy setting to automatically rewrite cherrypy.request.remote.ip. See cherrypy.lib.cptools.proxy for details. | 2 | 2 | 0 | I have a cherrypy server on a machine, and i want to get the client identifier from the request. Now i can get the client IP by cherrypy.request.remote.ip, but if the client user use a proxy then the IP address will be the proxy address that i don't want, so is there any way for getting the host name of the client mach... | Is there a way to get client host name by cherrypy server | 1.2 | 0 | 1 | 5,019 |
19,556,467 | 2013-10-24T03:38:00.000 | 0 | 0 | 0 | 0 | python,basehttprequesthandler | 19,556,787 | 2 | false | 0 | 0 | I think you have two choices.
1) Listen to all interfaces, but override BaseHTTPRequestHandler.init to check the client address and drop the connection if it comes from an undesired interface
2) Create multiple sockets, one per address you want to listen on. SocketServer.serve_forever() is blocking, so you will either... | 2 | 0 | 0 | My server has 3 ip addresses, 127.0.0.1, 192.168.0.100 and an internet ip address. I'm going to run a service written by python on this server, but I don't want it to expose on internet.
I'm using BaseHTTPRequestHandler class to implement this service, so how to bind only 127.0.0.1 and 192.168.0.100 but not the other o... | how to bind multiple specified ip address on BaseHTTPRequestHandler of python | 0 | 0 | 1 | 758 |
19,556,467 | 2013-10-24T03:38:00.000 | 0 | 0 | 0 | 0 | python,basehttprequesthandler | 19,556,500 | 2 | false | 0 | 0 | Generally, routers have an option where you can allow servers to be visible or not visible. If on the router you set you server to not be visible, then your server will not be accessible through the internet. | 2 | 0 | 0 | My server has 3 ip addresses, 127.0.0.1, 192.168.0.100 and an internet ip address. I'm going to run a service written by python on this server, but I don't want it to expose on internet.
I'm using BaseHTTPRequestHandler class to implement this service, so how to bind only 127.0.0.1 and 192.168.0.100 but not the other o... | how to bind multiple specified ip address on BaseHTTPRequestHandler of python | 0 | 0 | 1 | 758 |
19,560,701 | 2013-10-24T08:23:00.000 | 1 | 0 | 1 | 1 | python,macos,py2app | 19,920,707 | 2 | true | 0 | 0 | You can use packagemaker. It makes myapp.pkg file that when double-clicked installa an app in Applications location. | 2 | 1 | 0 | I had developed an app in python on mac osx for opening different file types on double-clicking any file. Then I converted into app by using py2app. py2app creates a myapp.app within dist folder. I moved myapp.app from dist folder to Applications location. Now, I am able to open any file through myapp just by double-cl... | How to place myapp in Applications location developed through py2app on mac osx | 1.2 | 0 | 0 | 382 |
19,560,701 | 2013-10-24T08:23:00.000 | 0 | 0 | 1 | 1 | python,macos,py2app | 19,619,226 | 2 | false | 0 | 0 | py2app has a "--dist-dir" option for selecting the output directory (default is "diet"). That said, I have never tested using that option for installation in a directory containing other programs and don't know if "python setup.py py2app --dist-dir=/Applications" is save to use.
The alternative is to use a script that ... | 2 | 1 | 0 | I had developed an app in python on mac osx for opening different file types on double-clicking any file. Then I converted into app by using py2app. py2app creates a myapp.app within dist folder. I moved myapp.app from dist folder to Applications location. Now, I am able to open any file through myapp just by double-cl... | How to place myapp in Applications location developed through py2app on mac osx | 0 | 0 | 0 | 382 |
19,560,838 | 2013-10-24T08:30:00.000 | 2 | 0 | 0 | 0 | python,sql,django,serialization | 19,561,000 | 3 | false | 1 | 0 | According to your answer,
User passes some content-specific parameters into a form, then view function, that recieves POST, constructs query
one option is to store parameters (pickle'd or json'ed, or in a model) and reconstruct query with regular django means. This is somewhat more robust solution, since it can hand... | 2 | 2 | 0 | My use case is that I need to store queries in DB and retrieve them from time to time and evaluate. Thats needed for mailing-app where every user can subscribe to a web-site content selected by individually customized query.
Most basic solution is to store raw SQL and use it with RawQuerySet. But I wonder is there bett... | How to serialize and deserialize Django ORM query (not queryset)? | 0.132549 | 0 | 0 | 1,324 |
19,560,838 | 2013-10-24T08:30:00.000 | 1 | 0 | 0 | 0 | python,sql,django,serialization | 19,561,051 | 3 | false | 1 | 0 | You could create a new model user_option and store the selections in this table.
From your question, it's hard to determine whether it is a better solution, but it would make your user's choices more explicit in your data structure. | 2 | 2 | 0 | My use case is that I need to store queries in DB and retrieve them from time to time and evaluate. Thats needed for mailing-app where every user can subscribe to a web-site content selected by individually customized query.
Most basic solution is to store raw SQL and use it with RawQuerySet. But I wonder is there bett... | How to serialize and deserialize Django ORM query (not queryset)? | 0.066568 | 0 | 0 | 1,324 |
19,561,727 | 2013-10-24T09:14:00.000 | 0 | 0 | 0 | 0 | python,tkinter,ttk | 67,762,390 | 6 | false | 0 | 1 | It is just a matter of the design of a GUI Window. So Tkinter is a really easy-to-use efficient and useful GUI toolkit. But it looks a bit outdated. Tkinter Ttk widgets are similar to that of Tkinter. It is basically a sub-module of Tkinter. So, in Tkinter Ttk, almost many widgets are the same but to use them is differ... | 3 | 68 | 0 | The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.).
So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button.
Do you know what is the difference between them? Why would you choose one or ... | What is the difference between the widgets of tkinter and tkinter.ttk in Python? | 0 | 0 | 0 | 51,337 |
19,561,727 | 2013-10-24T09:14:00.000 | 8 | 0 | 0 | 0 | python,tkinter,ttk | 53,561,414 | 6 | false | 0 | 1 | My opinion for beginners who are starting to learn Tkinter, is to use Tkinter widgets, because they're really easy to learn. But on the other hand Tkinter.ttk is a module designed to make Tkinter widgets look really perfectly, but is really hard to learn and there are no easy options there. Like there are no -fg, -bg. ... | 3 | 68 | 0 | The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.).
So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button.
Do you know what is the difference between them? Why would you choose one or ... | What is the difference between the widgets of tkinter and tkinter.ttk in Python? | 1 | 0 | 0 | 51,337 |
19,561,727 | 2013-10-24T09:14:00.000 | 90 | 0 | 0 | 0 | python,tkinter,ttk | 19,564,114 | 6 | true | 0 | 1 | The widgets in tkinter are highly and easily configurable. You have almost complete control over how they look - border widths, fonts, images, colors, etc.
ttk widgets use styles to define how they look, so it takes a bit more work if you want a non-standard button. ttk widgets are also a little under-documented. Under... | 3 | 68 | 0 | The main tkinter module and its submodule ttk in Python 3 appear to contain identical widgets (i.e. Buttons, CheckButtons, etc.).
So, when creating a button, one has the freedom to either use a tkinter.Button widget or a tkinter.ttk.Button.
Do you know what is the difference between them? Why would you choose one or ... | What is the difference between the widgets of tkinter and tkinter.ttk in Python? | 1.2 | 0 | 0 | 51,337 |
19,564,587 | 2013-10-24T11:23:00.000 | 0 | 0 | 1 | 0 | python | 19,564,805 | 3 | false | 0 | 0 | No, in Python (both 2.x and 3.x), using ++var will return the same value of the variable as it was previously, provided that the variable's value was actually a number. And using var++ will raise an exception.
Also, in Python the ++var operation's behavior is not as same as some other languages, like PHP, JS, C++, wh... | 1 | 4 | 0 | Python doesn't support C-style ++a increment but, to my surprise, it doesn't complain either leading to me being temporarily baffled as to why my loop wasn't working.
Trying a few things (having first initialised with a=0) I find that a++ and a-- produce a syntax error, but ++a doesn't. While --a produces a syntax erro... | What is ++ operator doing in Python? | 0 | 0 | 0 | 1,128 |
19,568,232 | 2013-10-24T14:04:00.000 | -2 | 0 | 1 | 0 | python,dictionary,multiprocessing,shared-memory | 24,506,459 | 3 | false | 0 | 0 | iteritems() is for a list dict. You could use a for loop. Or you could say sorted() which will return keys in a sorted list and then iterate over that list and do dict[key]. Hope that helps. If there is any better way. DO share with me. I am dying to know. | 1 | 16 | 0 | I'm using Python's multiprocessing.Manager to share access to a dataset that one process will generate and others will view. However, I'm running into the problem that a dict proxy returned by manager.dict() doesn't support iteritems().
I could iterate over items(), but that means constructing a new tuple of all the it... | How to iterate over a dict proxy in Python? | -0.132549 | 0 | 0 | 9,690 |
19,570,490 | 2013-10-24T15:42:00.000 | 2 | 1 | 0 | 1 | python,nginx,webserver,reverse-proxy,uwsgi | 19,688,569 | 1 | true | 1 | 0 | Simply put, when you use HttpUwsgiModule NGINX speaks the uwsgi protocol and it can leave out useless informations of the http protocol leading to less overhead and thus better performance. | 1 | 1 | 0 | Using HttpUwsgiModule with NGINX to control uWSGI has become quite popular since its release.
I was wondering though, what is the advantage of it, compared to using NGINX as a reverse-proxy to uWSGI application?
What are the gains and losses in two differing use cases? | What is the difference between using HttpUwsgiModule for NGINX and using NGINX as a reverseproxy to uWSGI? | 1.2 | 0 | 0 | 125 |
19,574,210 | 2013-10-24T18:53:00.000 | 8 | 1 | 0 | 0 | python,shell,ssh,ipython | 19,574,232 | 1 | true | 0 | 0 | Yes. Use screen, tmux (superior), or similar software. Both use the concept of sessions that you attach to and detach from.
With tmux:
Run tmux and then ipython.
When you're finished, <Ctrl+b> d to detach. You're back in the normal shell.
When you come back, tmux attach will take you back to ipython.
Using screen, th... | 1 | 4 | 0 | I work on a machine per ssh where I run ipython for interactive work. Can I start a long-running Python function from IPython, sever the ssh connection and log back in later into the IPython session to observe the result? | Is it possible to start an IPython session via ssh and log back in later? | 1.2 | 0 | 0 | 467 |
19,574,683 | 2013-10-24T19:18:00.000 | 1 | 0 | 1 | 0 | python,python-2.7 | 19,574,766 | 1 | true | 0 | 0 | Unless you've somehow messed up your PYTHONPATH environment variable, it doesn't matter at all where you've stored your script. import random should always work.
However, if you have a script named random.py in the same directory as your current script, then Python will attempt to import that first, before hitting the ... | 1 | 2 | 0 | I am working through some exercises in Learning Python the Hard Way (LPTHW) and I am having some trouble while attempting to write some original code for a text-game I have made.
My issue is importing the "random" module from the python standard library.
The problem stems from NOT having my .py file in the main Python... | Unsure how to import module from Python Standard Library | 1.2 | 0 | 0 | 344 |
19,577,144 | 2013-10-24T21:36:00.000 | 2 | 0 | 1 | 0 | python,mcmc,pymc | 19,730,095 | 2 | true | 0 | 0 | Are you talking about the batchsd function? That is what is used to calculate the MC error in PyMC 2. Its located in the pymc.database.base module, and can be used on any array, really.
The pymc.diagnostics module contains all the convergence diagnostics functions, and should work on numpy arrays. | 1 | 2 | 0 | I'd like to use the pymc diagnostic and summary functions on samples I have generated without using pymc. As one example, I'd like to use pymc's mc_error routine on my own set of samples.
Some of the pymc diagnostic functions can take an np.array of samples, but, if I understand correctly, others seem to require a trac... | Using pymc diagnostics and posterior summaries on samples not from pymc | 1.2 | 0 | 0 | 413 |
19,578,392 | 2013-10-24T23:15:00.000 | 2 | 1 | 0 | 1 | python,linux,background,ssh | 19,578,445 | 3 | false | 0 | 0 | You can use screen, as Robin Krahl recommended, or you can just run your command with nohup, which suppresses the SIGHUP (hangup) signal from your SSH session disconnecting.
nohup "python -u test.py > output.txt" & | 1 | 3 | 0 | I need to run a python code that takes several hours and my computer disconnects from the ssh after a certain amount of inactive time.
I have tried python test.py > output.txt & but my output file is empty. However, the python code "test" is still running after I log off and log back in to the ssh. I also tried pytho... | Running python code in background | 0.132549 | 0 | 0 | 183 |
19,578,777 | 2013-10-24T23:52:00.000 | 0 | 0 | 1 | 0 | python,string,list,eval | 21,247,627 | 4 | false | 0 | 0 | Here's one way:
exec("list = "+foo)
This should make a variable 'list' with the list in string converted to a real list.
This also works for dictionaries, arrays, bools, etc in strings. | 1 | 4 | 0 | I have a string, something like this: "[['Cheese', 72], ['Milk', 45], ['Bread', 22]]".
I want to convert this to a list. I know I can use eval(string) to get the list, but eval scares me because of its potential for catastrophe (and because I can get a non-list as valid output). Is there another saner/safer way to turn... | Convert String to List in Python Without Using Eval? | 0 | 0 | 0 | 3,294 |
19,579,546 | 2013-10-25T01:21:00.000 | 0 | 0 | 1 | 1 | ipython-notebook,ipython-magic | 19,583,164 | 7 | false | 0 | 0 | No, %%script magic are autogenerated and don't do any magic inter-process data communication. (which is not the case for %%R but which is a separate magic in its own class with extra care from R peoples)
But writing your own magic that does it is not too hard to do. | 1 | 81 | 0 | Is there a way to access variables in the current python kernel from within a %%bash or other %%script cell?
Perhaps as command line arguments or environment variable(s)? | Can I access python variables within a `%%bash` or `%%script` ipython notebook cell? | 0 | 0 | 0 | 40,694 |
19,579,978 | 2013-10-25T02:09:00.000 | 2 | 0 | 1 | 1 | python,unix,multiprocessing,xargs | 19,580,680 | 1 | true | 0 | 0 | The xargs program will collect multiple arguments from standard input, and glue them together to make one long command line. If there are many many many arguments, too long for one command line, then it will build and execute multiple command lines, as many as needed.
This means less overhead for starting up processes... | 1 | 1 | 0 | I have a question on the performance scalability with xargs. Currently I have a batch processing program written in python with multiprocessing and subprocess. Each process spawns an independent subprocess.popen() to execute an external command. Recently I realized that the whole process can be redone with xargs. Howev... | performance for xarg vs. python multiprocessing+subprocess | 1.2 | 0 | 0 | 575 |
19,582,197 | 2013-10-25T06:02:00.000 | 0 | 0 | 0 | 0 | python,linear-algebra | 19,650,488 | 3 | false | 0 | 0 | Writing a program to solve an eigenvalue problem is about 100 times as much work as fixing the library mismatch problem. | 1 | 3 | 1 | I need to calculate eigenvalues and eigenvectors in python. numpy and scipy do not work. They both write Illegal instruction (core dumped). I found out that to resolve the problem I need to check my blas/lapack. So, I thought that may be an easier way is to write/find a small function to solve the eigenvalue problem. D... | How to find eigenvectors and eigenvalues without numpy and scipy? | 0 | 0 | 0 | 12,872 |
19,583,656 | 2013-10-25T07:26:00.000 | 0 | 0 | 0 | 1 | python,linux,solaris,expect | 19,831,707 | 5 | true | 0 | 0 | The only solution top this problem seems using uname to get the OS and
set the df accordingly... same as what i had stated in the problem!!! | 2 | 0 | 0 | The df command displays the amount of disk space occupied by mounted or unmounted file systems, the amount of used and available space, and how much of the file system's total capacity has been used.
Linux has df command in the following location /bin whereas in Solaris in the following location /usr/gnu/bin...
If su... | df command across multiple os | 1.2 | 0 | 0 | 752 |
19,583,656 | 2013-10-25T07:26:00.000 | 0 | 0 | 0 | 1 | python,linux,solaris,expect | 19,639,734 | 5 | false | 0 | 0 | Are the target systems somehow under your control, and does this involve a limited set of servers?
If so, how about adding a soft link in both the Solaris and Linux servers, in the same location and with the same name?
Something like:
Solaris: ln -s /usr/gnu/bin/df /usr/bin/my_df
Linux: ln -s /bin/df /usr/bin/my_df
T... | 2 | 0 | 0 | The df command displays the amount of disk space occupied by mounted or unmounted file systems, the amount of used and available space, and how much of the file system's total capacity has been used.
Linux has df command in the following location /bin whereas in Solaris in the following location /usr/gnu/bin...
If su... | df command across multiple os | 0 | 0 | 0 | 752 |
19,585,830 | 2013-10-25T09:17:00.000 | 0 | 0 | 0 | 0 | python,mysql,database,cloud,rackspace-cloud | 19,761,340 | 2 | true | 1 | 0 | I released version 1.6.1 of pyrax a few days ago that adds support for the 'host' parameter for users, as well as for Cloud Database backups. | 1 | 1 | 0 | Rackspace has added the feature to select certain cloud servers (as hosts) while creating a user in a cloud database instance. This allows the specified user to be accessed, only from those cloud servers.
So I would like to know whether there is an API available in pyrax(python SDK for Rackspace APIs) to accomplish thi... | Host Parameter While Creating a User in Rackspace Cloud Database Instance | 1.2 | 1 | 0 | 70 |
19,586,583 | 2013-10-25T09:52:00.000 | 1 | 0 | 1 | 0 | python,video,mpeg | 19,589,146 | 2 | false | 0 | 0 | gstreamer is the tool you are looking for. you'll probably need an appsrc or something like that. | 1 | 0 | 0 | I'm looking for a Python library that can combine images into a video.
A library that just allows you to create an empty video and feed images into it as frames is ideal.
Preferably with support for MPEG compression of the video file as well. | Combine images as frames to make a video with Python | 0.099668 | 0 | 0 | 1,225 |
19,588,634 | 2013-10-25T11:30:00.000 | 3 | 0 | 1 | 0 | python,random,header | 19,589,554 | 3 | false | 0 | 0 | here's a list of options with their associated problems:
use a random number. you will get a collision (non-unique value) in about half the bits (this is the "birthday collision"). so for 32 bits you get a collision after 2*16 messages. if you are sending less than 65,000 messages this is not a problem, but 65,000 ... | 1 | 0 | 0 | I need to generate a 32 bit random int but depending of some arguments. The idea is generate a unique ID for each message to send through a own P2P network. To generate it, I would like as arguments: my IP and the time stamp. My question is, how can I generate this 32 bit random int from these arguments?
Thanks again! | Python - Generate a 32 bit random int with arguments | 0.197375 | 0 | 1 | 3,076 |
19,591,907 | 2013-10-25T13:59:00.000 | 0 | 0 | 1 | 0 | python,scipy,enthought,scikits,canopy | 19,674,497 | 1 | false | 0 | 0 | You can try to download the package tar.gz and use easy_install . Or you can unpack the package and use the standard way of python setup.py install. I believe both ways require a fortran compiler. | 1 | 0 | 1 | I need to use scikits.bvp_solver in python.
I currently use Canopy as my standard Python interface, where this package isn't available. Is there another available package for solving boundary value problems? I have also tried downloading using macports but the procedure sticks when it tries building gcc48 dependency. | Installing scikits.bvp_solver | 0 | 0 | 0 | 611 |
19,598,213 | 2013-10-25T19:44:00.000 | 0 | 0 | 0 | 0 | python,django,django-templates | 19,624,727 | 2 | true | 1 | 0 | This cannot be done in Django templates as of this writing without writing a custom template tag in Python. | 1 | 3 | 0 | I have a date in my template context, and I want to display that date plus 7 days in the rendered output.
Something like this (which does not exist):
{{some_date|plus_days:7}}
How can I do this in a Django template without writing any Python code? | Generating a date relative to another date in Django template | 1.2 | 0 | 0 | 3,339 |
19,598,454 | 2013-10-25T19:57:00.000 | 0 | 0 | 1 | 0 | python,regex | 19,598,658 | 3 | false | 0 | 0 | You can compare Python strings alphabetically with < and >. For instance, "block_number_0" < "block_number_alt567" is True.
If I understand you correctly, then you can stop looking if the regular expression doesn't match and the string is greater than "block_number_0" (or any other number). | 1 | 1 | 0 | I am looking for matches between an alphabetically sorted list of strings and a regular expression using python.
The regular expression is relatively simple, something like "block_number_[0-9]+", representing "block_number_" followed by any string that represents a number, e.g. "block_number_1234".
Beyond the alphabeti... | String greater-than-less-than Tests Against a Regular Expression | 0 | 0 | 0 | 916 |
19,600,545 | 2013-10-25T22:46:00.000 | 0 | 0 | 1 | 0 | python,python-2.7 | 47,374,011 | 3 | false | 0 | 0 | it has role similar to path. this variable tells the python interpreter where to
locate the module files imported into a program. it should include the python source library directory and the directories contain in python source code | 1 | 0 | 0 | On windows 7, I currently don't have a python path. Can I safely make one? If so, how do I do it?
Upon making this variable, I can no longer load Spyder (IDE) without it crashing. Does anyone know why?
I would like to edit my existing python path if possible, but just don't know why it isn't already there in environmen... | What is the purpose of the environmental variable PYTHONPATH | 0 | 0 | 0 | 1,331 |
19,601,598 | 2013-10-26T00:50:00.000 | 11 | 0 | 0 | 1 | macos,python-2.7,resume | 19,601,896 | 1 | true | 0 | 0 | This was originally a comment, but it seems to be what OP wants, so I'm reposting it as an answer
I would use ctrl+z to suspend your live, running process. This will leave you with a PID, which you can later resume with a call to fg: fg <job-number>.
This shouldn't have any implications with changed network settings (l... | 1 | 3 | 0 | I run python scripts on my macbook air that process data from external API's and often take several hours or occasionally even days.
However, sometimes I need to suspend my laptop in the middle of running a script so I can go to work or go home or similar.
How can I simply pause/resume these scripts in the middle of t... | How do I pause/resume a Python script? | 1.2 | 0 | 1 | 7,855 |
19,605,580 | 2013-10-26T10:25:00.000 | 1 | 0 | 0 | 0 | python,postgresql,ms-access,psycopg2,pyodbc | 20,310,119 | 1 | false | 0 | 0 | Your query syntax differences will depend on PostgreSQL extensions vs MS Access-specific quirks. The psycodb and pyodbc will both provide a query interface using whatever SQL dialect (with quirks) the underlying db connections provide. | 1 | 0 | 0 | We are building a datawarehouse in PostgreSQL. We want to connect to different data sources. Most data will come from ms access. We not not python experts (yet :-)).
We found several database connectors. We want to use (as much as possible) standard SQL for our queries.
We looked at pyodbc pscopg2.
Given that we use MS... | python postgresql ms access driver advice | 0.197375 | 1 | 0 | 126 |
19,606,275 | 2013-10-26T11:43:00.000 | 0 | 0 | 1 | 0 | ipython,ipython-notebook | 51,346,139 | 6 | false | 0 | 0 | If you want completely from beginning, Just go and delete the following file manually(It worked for me)
/home/user/.ipython/profile_default/history.sqlite | 2 | 40 | 0 | I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist. Not so good.
I therefore need to get rid of particular parts of what is stored in %hist. Saying that, I do not want to wipe the whole history. - Only the parts where I have been careless e... | IPython: How to wipe IPython's history selectively & securely? | 0 | 0 | 0 | 17,232 |
19,606,275 | 2013-10-26T11:43:00.000 | 1 | 0 | 1 | 0 | ipython,ipython-notebook | 52,141,421 | 6 | false | 0 | 0 | I couldn't find the way to wipe IPython's history selectively, but I found out how to wipe data by built-in func, non-sqlite way:
%clear out #it clears output history
by the way, you can also clear in history by %clear in | 2 | 40 | 0 | I have been learning how to use the paramiko package only to discover that all I stored passwords in plain text in IPython's %hist. Not so good.
I therefore need to get rid of particular parts of what is stored in %hist. Saying that, I do not want to wipe the whole history. - Only the parts where I have been careless e... | IPython: How to wipe IPython's history selectively & securely? | 0.033321 | 0 | 0 | 17,232 |
19,609,041 | 2013-10-26T16:28:00.000 | 2 | 0 | 1 | 0 | python,virtualenv,pip | 19,612,064 | 4 | false | 0 | 0 | Alternative way is to name each dependency of your project in your "setup.py" or "requirements.txt". Exercise setup.py or pip install cat requirements.txt multiple times with virtualenv in order to run your application successfully. After that, manually add the new dependency to one of the files to keep your dependency... | 3 | 20 | 0 | How can I keep track of the packages when I install them using pip inside a virtualenv?
It seems like a mess now; if I install package A, it automatically install its dependancies; B, C and D. Then I decide to use package N instead which installs its dependancies as well.
Now when I remove package A, its dependancies a... | How can I remove unused packages from virtualenv? | 0.099668 | 0 | 0 | 28,191 |
19,609,041 | 2013-10-26T16:28:00.000 | 6 | 0 | 1 | 0 | python,virtualenv,pip | 19,609,288 | 4 | false | 0 | 0 | To get a clean environment, create a new one. Some pip hooks can help you on this path:
pip freeze to get list of installed packages and their versions, wich can later be used with
-r <file> to install list of packages, stated in a requirements file
--build <dir> to place builds in a specific directory
--no-clean to n... | 3 | 20 | 0 | How can I keep track of the packages when I install them using pip inside a virtualenv?
It seems like a mess now; if I install package A, it automatically install its dependancies; B, C and D. Then I decide to use package N instead which installs its dependancies as well.
Now when I remove package A, its dependancies a... | How can I remove unused packages from virtualenv? | 1 | 0 | 0 | 28,191 |
19,609,041 | 2013-10-26T16:28:00.000 | 12 | 0 | 1 | 0 | python,virtualenv,pip | 19,609,202 | 4 | true | 0 | 0 | Making virtualenvs is relatively cheap. You could just create a new virtualenv whenever you get into this situation and run your pip install again.
Not very elegant, but it gets the job done. Of course you need to be maintaining some requirements file for the pip install and it will go faster if you have some local ind... | 3 | 20 | 0 | How can I keep track of the packages when I install them using pip inside a virtualenv?
It seems like a mess now; if I install package A, it automatically install its dependancies; B, C and D. Then I decide to use package N instead which installs its dependancies as well.
Now when I remove package A, its dependancies a... | How can I remove unused packages from virtualenv? | 1.2 | 0 | 0 | 28,191 |
19,611,177 | 2013-10-26T19:52:00.000 | 2 | 0 | 1 | 0 | python,algorithm,3d,point | 19,611,533 | 1 | false | 0 | 0 | Given 2 points, (x1,y1,z1) and (x2,y2,z2), you can take the difference between the two, so you end up with (x2-x1,y2-y1,z2-z1). Take the norm of this (i.e. take the distance between the original 2 points), and divide (x2-x1,y2-y1,z2-z1) by that value. You now have a vector with the same slope as the line between the f... | 1 | 2 | 1 | I need to write a script in python which given coordinates of 2 points in 3d space finds a collinear point in distane 1 unit from one the given points. This third point must lay between those two given.
I think I will manage with scripting but I am not really sure how to calculate it from mathematical point of view. I ... | Find a point in 3d collinear with 2 other points | 0.379949 | 0 | 0 | 1,351 |
19,612,221 | 2013-10-26T21:42:00.000 | 0 | 1 | 0 | 1 | eclipse,python-3.x,command-line-arguments,pydev,windows-8.1 | 19,624,100 | 1 | false | 0 | 0 | I answered my own question in the comment above. I just had to wait to post an answer due to the fact that I just created a stackoverflow account yesterday. | 1 | 0 | 0 | This goes out to anyone who is well versed in the Eclipse IDE and or PyDev perspective plug-in who is willing to offer some technical support.
I am trying to write a python module that must take in arguments from the command prompt with sys.argv function calls. Rather than printing out the correct output when I enter E... | Python module will not run correctly from command prompt | 0 | 0 | 0 | 213 |
19,612,642 | 2013-10-26T22:37:00.000 | 1 | 0 | 0 | 1 | java,android,python,google-app-engine | 19,613,781 | 1 | true | 1 | 0 | Yes, you can use Python to do what you want.
Google designs their services (such as GAE and endpoints) to be language agnostic, e.g. using JSON to serialize objects.
There are a few advantages to using Java on both, such as being able to share code between client and service projects, but Google does not promote such d... | 1 | 0 | 0 | Am I confused as to what is possible between an Android Client and Google App Engine? I would like to be able to create a Python API that would handle requests between GAE services such as Datastore, and an Android Client.
I have found some examples that detail how to make a call from within an Android Client, but it d... | Android Client and Google App Engine APIs | 1.2 | 0 | 0 | 127 |
19,612,872 | 2013-10-26T23:07:00.000 | 0 | 0 | 0 | 0 | python,regex,excel,macos,applescript | 20,011,728 | 1 | false | 0 | 0 | I don't know what format your original list is in, but this sounds like a job for conditional formatting, if you can get the list into Excel. You can do conditional formatting based on a formula, and you can use a VLOOKUP() formula to do it. | 1 | 2 | 0 | The goal is to find values in an Excel spreadsheet which match values in a separate list, then highlight the row with a fill color (red) where matches are found. In other words:
Excel file A: source list (approximately 200 items)
Excel file B: has one column containing the list we are checking; must apply fill color (... | Find text in Excel file matching text in separate file, then apply fill color to row | 0 | 1 | 0 | 961 |
19,615,178 | 2013-10-27T06:07:00.000 | 1 | 0 | 1 | 0 | python-3.x,command-line,terminal | 19,616,785 | 2 | false | 0 | 0 | It looks like readline is not installed or working. Try running import readline and see whether it imports. This is usually because of building Python and not having the readline headers. In Debian/Ubuntu, one can install the libreadline-dev package. Then if you have compiled Python, rebuild Python with make to add rea... | 1 | 0 | 0 | Like the title whenever I try to move around a command line in python3 through terminal, I get this ^[[D, ^[[A, ^[[B, and ^[[C. So I can't move between characters. What is going on? | When I use python3 in the terminal, I can't move around with my direction buttons on my keyboard | 0.099668 | 0 | 0 | 121 |
19,616,817 | 2013-10-27T10:02:00.000 | 2 | 0 | 0 | 0 | python,django,session,testing,cookies | 19,616,880 | 1 | true | 1 | 0 | The two statements do not contradict one another.
You can use self.client more than once during one test. You can log in, and the cookie handling in the test client will 'remember' your session, for subsequent requests.
Only when the test is done, is that state cleared.
You do not need to log out, because that's a clie... | 1 | 1 | 0 | While reading the documentation I've come across two contradicts paragraphes that I couldn't really understand
First one says:
The test client is stateful. If a response returns a cookie, then that cookie will be stored >in the test client and sent with all subsequent get() and post() requests.
Expiration policies fo... | Testing Django application cookies , sessions and states | 1.2 | 0 | 0 | 1,147 |
19,618,735 | 2013-10-27T13:44:00.000 | 0 | 0 | 0 | 0 | python,scrapy | 19,618,864 | 2 | false | 1 | 0 | I will be interested to see what other answers come up for this. I have done some web crawling / scrapping with code that I have written myself using urllib to get the html then just searching the html for what I need, but not tried scrapy yet.
I guess to see if there are differences you may just need to compare the p... | 1 | 2 | 0 | I need help defining an architecture for a tool that will scrape more than 1000 big websites daily for new updates.
I'm planning to use Scrapy for this project:
Giving that Scrapy needs a project for each website, how can I handle scraping 1000+ websites and storing it's data with Scrapy in just one project? I tried a... | Crawl and monitor +1000 websites | 0 | 0 | 1 | 3,232 |
19,619,253 | 2013-10-27T14:37:00.000 | 0 | 0 | 0 | 0 | python,scipy,openshift | 19,621,115 | 2 | false | 0 | 0 | You will probably find more info sshing into your app ad typing tail_all. | 1 | 1 | 1 | I want to install scikit-learn but this library needs scipy and numpy too.
I tried to add them on the setup.py but I had an error with numpy. I handle to install scikit-learn and numpy from virtenv, but I cannot install scipy.
I tried pip install scipy. The procedure finished without any problem but there isn't any sci... | cannot install scipy on openshift | 0 | 0 | 0 | 651 |
19,622,526 | 2013-10-27T19:34:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,binary,numbers,decimal | 19,622,796 | 5 | false | 0 | 0 | The general formula for base B is as follows:
(B^N + ... + B^1 + B^0)*(B-1) =
(B^(N+1) + ... + B^2 + B^1) - (B^N + ... + B^1 + B^0) =
B^(N+1) - B^0 = B^(N+1)-1
Examples:
B=2 and N=3 gives 2^4 - 1 = 1111 binary
B=10 and N=3 gives 10^3 - 1 = 999 decimal | 4 | 2 | 0 | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | Binary to decimal conversion - formula explanation | 0 | 0 | 0 | 426 |
19,622,526 | 2013-10-27T19:34:00.000 | 1 | 0 | 1 | 0 | python,python-3.x,binary,numbers,decimal | 19,622,562 | 5 | false | 0 | 0 | Think of it like this, 111 is 1 less than 1000 (8 in binary). | 4 | 2 | 0 | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | Binary to decimal conversion - formula explanation | 0.039979 | 0 | 0 | 426 |
19,622,526 | 2013-10-27T19:34:00.000 | 2 | 0 | 1 | 0 | python,python-3.x,binary,numbers,decimal | 19,622,553 | 5 | true | 0 | 0 | It is a unique property of number 2 that the sum of it's previous powers is equal to the next power level subtracted by 1.
In other words:
2^n=2^0+2^1+2^2+...+2^(n-1)+1 for n in (1,2,3...)
If you need proof, use mathematical induction.
Base: n=1; 2^1=2=2^0+1=1+1
Suppose that for n=k the property 2^n=2^0+2^1+...+2^(n-... | 4 | 2 | 0 | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | Binary to decimal conversion - formula explanation | 1.2 | 0 | 0 | 426 |
19,622,526 | 2013-10-27T19:34:00.000 | 1 | 0 | 1 | 0 | python,python-3.x,binary,numbers,decimal | 19,622,560 | 5 | false | 0 | 0 | Add 1 to 111: the result is 1000.
It follows, therefore, that:
111 + 1 = 1000 → 1000 - 1 = 111
Now, 1000 is 23, hence:
23 - 1 = 111
Of course, you can say something similar about binary numbers with any number of 1s | 4 | 2 | 0 | can anyone explain me how to see why the number in binary form: 111 is 2^3 - 1 ?
I know that the number is calculated by 1*2^0 + 1*2^1 + 1*2^2 but I can't see how to get from here to 2^3-1 ... can't see any power rule or something.. | Binary to decimal conversion - formula explanation | 0.039979 | 0 | 0 | 426 |
19,624,484 | 2013-10-27T22:38:00.000 | 0 | 0 | 0 | 0 | python,ajax,django,django-admin | 19,624,592 | 1 | true | 1 | 0 | For an easy implantation you could set up a button to only refresh the changelist through an ajax call instead of the whole page (though setting it up with a view would be easier than changing the built in admin site without breaking anything). You can also set that function to refresh on a given interval.
Another opti... | 1 | 0 | 0 | I use the Django admin "change list" page to monitor the state of objects created and updated by my site's users. I find myself frequently refreshing the page as my users do their work. Is there a good way to make it automatically refresh, so that I can see new changes within a few seconds? Looking for a technique that... | Django admin: live update of change list page | 1.2 | 0 | 0 | 665 |
19,624,968 | 2013-10-27T23:30:00.000 | 0 | 0 | 0 | 0 | python | 54,815,571 | 1 | false | 0 | 1 | I had the same issue caused by a top level window I had created and withdrawn but didn't destroy. Properly destroying it fixed my issue. | 1 | 1 | 0 | I made a program, which uses tkinter to create a window where stuff happens. It contains images and loops to constantly shift and move the images.
Now, when I close the window, the scripts are still running and it creates error messages that it has nowhere to place the images with new coordinates.
I think that the loop... | Closing a python program window leaves program still running in the background | 0 | 0 | 0 | 1,700 |
19,627,743 | 2013-10-28T05:30:00.000 | 0 | 1 | 0 | 1 | python,apache,unix,path,fastcgi | 19,962,347 | 3 | true | 1 | 0 | I had a call to python interpreter via env program in my fast cgi dispatch script. When I explicitly put path to 2.7 to the first line of the script it works as expected. | 2 | 1 | 0 | I have a VPS with system-wide installed python 2.5.
I installed python 2.7 to one of the user's home dir (using --prefix). added it to bashrc and bash_profile, exported python variable to env, and now when I type python in console python 2.7 is running.
But when I checked python version from my application (Django usi... | Issue with path to python/pythonpath | 1.2 | 0 | 0 | 137 |
19,627,743 | 2013-10-28T05:30:00.000 | 0 | 1 | 0 | 1 | python,apache,unix,path,fastcgi | 27,295,744 | 3 | false | 1 | 0 | I've set PYTHONPATH in my /home/me/.bashrc and all worked ok from terminal, but when Apache w/ mod_wsgi starts my python scripts, it acts under sysem or dedicated user, which knows nothing of my .bashrc.
For this particular situation, I just used apache config (apache2.conf) to set python path for apache (WSGIPythonPat... | 2 | 1 | 0 | I have a VPS with system-wide installed python 2.5.
I installed python 2.7 to one of the user's home dir (using --prefix). added it to bashrc and bash_profile, exported python variable to env, and now when I type python in console python 2.7 is running.
But when I checked python version from my application (Django usi... | Issue with path to python/pythonpath | 0 | 0 | 0 | 137 |
19,628,571 | 2013-10-28T06:44:00.000 | 3 | 0 | 0 | 0 | python,c | 19,628,620 | 3 | false | 0 | 0 | A program never return string. You can output a string to standard output and pipe it in your python code. | 3 | 0 | 0 | I know that C program generally ends with return, where we return the status of the program. However, I want to return a string.
I will be calling the C-executable from a Python script and printing the returned string.
Since main can't return a string, How do I do this? | Can I return a string from C main() program | 0.197375 | 0 | 0 | 166 |
19,628,571 | 2013-10-28T06:44:00.000 | 6 | 0 | 0 | 0 | python,c | 19,628,608 | 3 | true | 0 | 0 | the return value must be an integer (in general)
What you can do is have the C program print out results (using printf, for example) and have the python script read the standard output of the process (popen functions that give access to child_stdout) | 3 | 0 | 0 | I know that C program generally ends with return, where we return the status of the program. However, I want to return a string.
I will be calling the C-executable from a Python script and printing the returned string.
Since main can't return a string, How do I do this? | Can I return a string from C main() program | 1.2 | 0 | 0 | 166 |
19,628,571 | 2013-10-28T06:44:00.000 | 3 | 0 | 0 | 0 | python,c | 19,628,593 | 3 | false | 0 | 0 | No, as per the C Standard main should return an int and not a char * or char [].
(5.1.2.2.1) It (main) shall be defined with a return type of int and with no parameters ... or with two parameters ... or in some other implementation-defined manner | 3 | 0 | 0 | I know that C program generally ends with return, where we return the status of the program. However, I want to return a string.
I will be calling the C-executable from a Python script and printing the returned string.
Since main can't return a string, How do I do this? | Can I return a string from C main() program | 0.197375 | 0 | 0 | 166 |
19,630,089 | 2013-10-28T08:29:00.000 | 4 | 0 | 1 | 0 | python,xml,multithreading,openerp | 19,630,408 | 1 | true | 0 | 0 | you won't find any example because it's not the way of doing it. just use Schedulers, and that will do the trick.
Cheers,
Parthiv | 1 | 0 | 0 | Please can anyone give me a example for OpenERP [python] threads.
my requirement is Need to read attendance [text based file] hourly and store it and backup
i searched in forums & workspace also for example but still didn't get any
please help me
thanks a lot :-) | Openerp Timer task using python Threads | 1.2 | 0 | 0 | 199 |
19,630,611 | 2013-10-28T09:01:00.000 | 3 | 0 | 1 | 0 | python,jython,shared-memory,grinder | 19,670,363 | 1 | true | 0 | 0 | There are a couple of approaches you could take:
When your dictionary is calculated, store it to a common external location everyone can read. (e.g. zookeeper, a shared network drive, a database, etc.) Ideally this could happen somewhere in module-level code, so that it's not being done by each agent thread.
Generat... | 1 | 1 | 0 | Here is the requirement :
In simple words, I have a static dictionary(say dictionaryX) in a class (say ClassX in shared.py file) that needs to be shared across multiple agents and multiple processes in grinder.
How do I achieve this..?
Any help would be greatly appreciated. Thanks in advance | Sharing resources across agents, across processes in grinder | 1.2 | 0 | 0 | 71 |
19,632,667 | 2013-10-28T10:45:00.000 | 2 | 1 | 0 | 0 | python,authentication,python-2.7,authorization,pyramid | 19,646,493 | 1 | false | 0 | 0 | if you are using the cookies based authenticate, then you can also save the user name into the cookies. For password, I am not sure it is a good idea to save it in client side.
I think the better way is to use authenticated_userid to identity the user and return whatever necessary to the request. | 1 | 2 | 0 | Following the tutorial,
I have built the authentication system using Auth. APIs of Pyramid.
I would like to learn how to introduce two things (tick boxes) to the login though:
Remember my name
Remember my password
How can I achieve this? What do I need to do?
Thank you. | Intoducing "remember my name" and "remember my password" options to Pyramid's Authentication | 0.379949 | 0 | 0 | 135 |
19,635,133 | 2013-10-28T12:44:00.000 | 1 | 0 | 1 | 0 | python,tkinter,truetype | 19,635,408 | 1 | true | 0 | 1 | You cannot dynamically load fonts with tkinter. | 1 | 1 | 0 | How do I load a TrueType font file in Tkinter without installing it in the font directories and beside the running script, like for example in Windows/Linux?
I'm trying to create a script with the fonts not need to be installed separately and already included in my main package. | Loading a TrueType font file in Tkinter without installing it in fonts folder | 1.2 | 0 | 0 | 1,254 |
19,638,019 | 2013-10-28T14:53:00.000 | 1 | 0 | 0 | 0 | python,postgresql | 19,703,149 | 2 | true | 0 | 0 | Thanks for all the comments, even if they are mostly "don't do this!" ;)
Given:
The dump is always produced in the same format from a 3rd-party system
I need to be able to automate reading it on another 3rd-party system without postgres
I've gone for writing my own basic parser, which is doing a good enough job for w... | 1 | 3 | 0 | I'd like my Python script to read some data out of a postgresql dump file. The Python will be running on a system without postgresql, and needs to process the data in a dump file.
It looks fairly straightforward to parse the CREATE TABLE calls to find the column names, then the INSERT INTO rows to build the contents. ... | How to read postgresql dump file in Python | 1.2 | 1 | 0 | 4,660 |
19,643,855 | 2013-10-28T19:52:00.000 | 3 | 0 | 1 | 0 | python,iterator | 19,643,906 | 3 | false | 0 | 0 | Yes, because every iterator is also an iterable.
An object is iterable if it defines the __iter__() method. Every iterator has this method, it returns the iterator itself. | 1 | 6 | 0 | I know iterator is iterable, but only 1 pass.
For example, many functions in itertools take iterable as parameter, e.g islice. Can I always pass in iterator if I see the api says iterable?
As @delnan pointed out:
Although every iterator is an iterable, some people (outside the
core team) say "iterable" when they mea... | Does a function which takes iterable as parameter always accept iterator? | 0.197375 | 0 | 0 | 3,097 |
19,645,527 | 2013-10-28T21:36:00.000 | 22 | 0 | 1 | 0 | python,pycharm | 19,651,990 | 12 | false | 0 | 0 | Go to File->Settings->Project Settings->Project Interpreter->Python Interpreters
There will be a "+" sign on the right side. Navigate to your python binary, PyCharm will figure out the rest. | 6 | 65 | 0 | I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty. | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | 1 | 0 | 0 | 244,164 |
19,645,527 | 2013-10-28T21:36:00.000 | 3 | 0 | 1 | 0 | python,pycharm | 39,558,254 | 12 | false | 0 | 0 | During the install of python make sure you have "Install for all users" selected.
Uninstall python and do a custom install and check "Install for all users". | 6 | 65 | 0 | I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty. | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | 0.049958 | 0 | 0 | 244,164 |
19,645,527 | 2013-10-28T21:36:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 51,201,307 | 12 | false | 0 | 0 | If you are using Ubuntu, Python has already been downloaded on your PC.
so, go to -> ctrl + alt + s -> search interpreter -> go to project interpreter than select Python 3.6 in the dropdown menu.
Edit: If there is no Python interpreter in drop-down menu, you should click the gear icon that on the right of the drop-down... | 6 | 65 | 0 | I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty. | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | 0.016665 | 0 | 0 | 244,164 |
19,645,527 | 2013-10-28T21:36:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 59,015,130 | 12 | false | 0 | 0 | In my case, there are several interpreters, but I have to manually add them.
To the right of where you see "No Interpreters", there is a gear icon. Click the gear icon -> Click "Add...", then you can add the ones you need. | 6 | 65 | 0 | I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty. | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | 0.016665 | 0 | 0 | 244,164 |
19,645,527 | 2013-10-28T21:36:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 63,027,128 | 12 | false | 0 | 0 | In Linux, it was solved by opening PyCharm from the terminal and leaving it open. After that, I was able to choose the correct interpreter in preferences. In my case, linked to a virtual environment (venv). | 6 | 65 | 0 | I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty. | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | 0.016665 | 0 | 0 | 244,164 |
19,645,527 | 2013-10-28T21:36:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 69,233,742 | 12 | false | 0 | 0 | I had the same problem and stumbled onto this solution.
I ran PyCharm (as administrator, though not sure if necessary).
After PyCharm has completely loaded (green tick mark top right), see bottom right. Click on it.
An interface will open. In my case the path was already there. I just clicked OK and all was fine.
clos... | 6 | 65 | 0 | I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty. | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | 0 | 0 | 0 | 244,164 |
19,645,619 | 2013-10-28T21:42:00.000 | 0 | 0 | 1 | 0 | python,regex,bash | 19,645,676 | 4 | false | 0 | 0 | what are you looking for?
there is always range(19,22) which is depending on what you are looking close to curly expansion | 1 | 1 | 0 | Does python's regular expression have anything equivalent to match numbers in a given range?
For example in bash, you can match test19.txt, test20.txt, test21.txt by test{19..21}.txt
I am not looking for regular expression to match all digits like [1-2][0-9].
I want to match only a particular series of numbers starting... | Python regex equivalent of bash's {1..4} | 0 | 0 | 0 | 1,470 |
19,645,720 | 2013-10-28T21:49:00.000 | -1 | 0 | 1 | 0 | python,time,schedule | 19,645,758 | 8 | false | 0 | 0 | you could use a while loop and sleep to not eat up the processor too much | 1 | 5 | 0 | I have a function that I want to trigger at every turn of the minute — at 00 seconds. It fires off a packet over the air to a dumb display that will be mounted on the wall.
I know I can brute force it with a while loop but that seems a bit harsh.
I have tried using sched but that ends up adding a second every minute.
W... | Trigger a Python function exactly on the minute | -0.024995 | 0 | 0 | 18,985 |
19,648,377 | 2013-10-29T02:03:00.000 | 1 | 0 | 0 | 0 | python,shopify | 19,648,899 | 1 | false | 1 | 0 | I created a test recurring charge, it worked fine but I was not able to locate where to accept the charge in my test Shopify shop using admin.
When you created your charge, you had to provide a callback so that Shopify could send the charge for you to accept. I would look there for it. | 1 | 0 | 0 | While testing Shopify recurring application charge today I got stuck in following issues, can anyone please look into this....
I created a test recurring charge, it worked fine but I was not able to locate where to accept the charge in my test Shopify shop using admin.
I can see or query the newly created test recurri... | Shopify Recurring Application Charge related issue | 0.197375 | 0 | 0 | 482 |
19,655,585 | 2013-10-29T10:28:00.000 | 0 | 0 | 1 | 0 | python,loops | 19,655,663 | 2 | false | 0 | 0 | Either combine boolean flags and breaks or wrap loop in try: except: ... and raise an exception instead of loop. Second option probably is not that efficient but can be simpler and more reliable then tinkering with boolean flags. | 2 | 0 | 0 | I am making a game in python 3.3 and am using while True: and break to make a loop this is
while True:
print ("")
print ("You must answer all questions in block capitals")
print ("Welcome to maze runner")
print ("To learn about the controls press C")
... | looping back to a certain point in Python | 0 | 0 | 0 | 1,052 |
19,655,585 | 2013-10-29T10:28:00.000 | 0 | 0 | 1 | 0 | python,loops | 19,655,682 | 2 | false | 0 | 0 | Not like you do it.
Restructure your code so that everything in the inner loop is in a function. | 2 | 0 | 0 | I am making a game in python 3.3 and am using while True: and break to make a loop this is
while True:
print ("")
print ("You must answer all questions in block capitals")
print ("Welcome to maze runner")
print ("To learn about the controls press C")
... | looping back to a certain point in Python | 0 | 0 | 0 | 1,052 |
19,656,964 | 2013-10-29T11:26:00.000 | 1 | 0 | 1 | 0 | python,matplotlib,ipython,pythonxy,wing-ide | 19,658,785 | 1 | false | 0 | 0 | Wing looks for 'python' on the path or if none tries to find Python on your path or (on Windows) in the registry. Look at sys.executable in the IPython notebook and set Python Executable in Wing's Project Properties (from the Project menu) to that full path. Then the debugger should use the right Python.
Note that ... | 1 | 1 | 0 | I am developing algorithms in python and mostly use IPython notebook, but when ever I need to debug I usually use Wing IDE. I'm currently having a strange problem. In the notebook, I do have a method from the matplotlib package (subplot2grid) but in Wing, I do not have this method.
most of my packages were installed w... | Python modules are different between IDE's | 0.197375 | 0 | 0 | 244 |
19,657,370 | 2013-10-29T11:46:00.000 | 0 | 0 | 1 | 0 | python,django,debugging,exception,pycharm | 19,657,857 | 1 | false | 1 | 0 | This should happen automatically in PyCharm. What you need to do is set no breakpoints, but run as debug (click on the green bug icon). When the exception occurs, execution should automatically halt. | 1 | 1 | 0 | I debug django application and want to suspend code execution at the point where exception occurs with cursor pointing to problematic place in code. Pretty HTML display by django would be helpful either but not mandatory. My IDE is PyCharm.
If I set pycharm to suspend on termination of exception, then I never catch it,... | Suspend on exceptions caused inside Django app in PyCharm | 0 | 0 | 0 | 277 |
19,657,719 | 2013-10-29T12:03:00.000 | 3 | 0 | 1 | 1 | python,python-2.7,tornado,keyword-argument | 19,716,110 | 2 | false | 0 | 0 | The tornado.options philosophy is that any module may define options, not just the main entry point. So if you might need a bluetooth mac address, you'd define that option in the module that interacts with bluetooth. (and if you might need more than one you can set multiple=True). The only tricky part is that you mu... | 1 | 3 | 0 | I'm using Tornado options to define command-line arguments. However, I would like to be able to throw arbitrary configuration options, not defined in code, to my program. These will differ, depending on what the program is supposed to do. For instance, connect to a bluetooth device using a MAC address or connect to a s... | Handling of arbitrary options using Tornado options, i.e. like **kwargs | 0.291313 | 0 | 0 | 4,015 |
19,659,864 | 2013-10-29T13:40:00.000 | 0 | 0 | 1 | 0 | ipython | 19,662,546 | 3 | false | 0 | 0 | NBconvert does not run your code. So if you haven't plotted with SVG matplotlib backend it is not possible.
If you did so, then you need to write a nbconvert preprocessor that does svg-> eps and extend the relevant template to know how to embed EPS. | 1 | 10 | 1 | I have an iPython notebook that contains an inline plot (i.e. it contains the command plot(x,y)). When I issue the command ipython nbconvert --to latex --post PDF --SphinxTransformer.author='Myself' MyNotebook.ipynb the resulting .PDF file contains the figure, but it has been exported to .PNG, so it doesn't look very g... | iPython nbconvert and latex: use .eps instead of .png for plots | 0 | 0 | 0 | 5,738 |
19,661,874 | 2013-10-29T15:03:00.000 | 1 | 0 | 1 | 1 | python,api,subprocess | 19,662,004 | 2 | false | 0 | 0 | The only way that i see myself using subprocess instead of a native python api is if some option of the program is not provided in the api. | 2 | 2 | 0 | In case both options available: to call a command line tool with subprocess (say, hg) or to make use of native python API (say, mercurial API), is there a case where it's more favorable to use the former? | Python: subprocess vs native API | 0.099668 | 0 | 0 | 322 |
19,661,874 | 2013-10-29T15:03:00.000 | 3 | 0 | 1 | 1 | python,api,subprocess | 19,662,115 | 2 | true | 0 | 0 | If you want to execute some third party native code which you know is not stable and may crash with a segvault then it is better to execute it as a subprocess - you will be able to safely handle the possible crashes from your Python process.
Also, if you want to call several times some code which is known to leak memo... | 2 | 2 | 0 | In case both options available: to call a command line tool with subprocess (say, hg) or to make use of native python API (say, mercurial API), is there a case where it's more favorable to use the former? | Python: subprocess vs native API | 1.2 | 0 | 0 | 322 |
19,663,625 | 2013-10-29T16:12:00.000 | 6 | 0 | 1 | 0 | python,python-3.x,word-wrap | 19,664,045 | 1 | false | 0 | 0 | Text wrapping is a function of your terminal, not python. All that python does is send a string to the terminal - think about it, when you say print "abcdef\n", there's no character in there that tells the terminal to wrap-text!
You just need to configure the environment you're coding in. There should be a pretty easi... | 1 | 1 | 0 | I’m trying to print a string that is too long to be displayed on one line, so it automatically wraps to the next line. The problem is that I need it to all stay on one line and just go off the screen (where I can just scroll left to right to see it all).Is there a way to to disable word wrap in python IDLE
by changing ... | how to disable WORD WRAP in python IDLE | 1 | 0 | 0 | 6,081 |
19,664,732 | 2013-10-29T17:05:00.000 | 1 | 0 | 0 | 0 | python,django,postgresql | 19,665,116 | 2 | false | 1 | 0 | I guess you forgot to enter semicolon:
SELECT * FROM myapp_stories; | 2 | 1 | 0 | I'm using Django + Postgres. When I do a SQL query using psql,
e.g. \d+ myapp_stories
correctly shows the columns in the table
But when I do SELECT * FROM myapp_stories, it returns nothing. But querying the same database & table from my python code returns data just fine. So there is data in the table. Any thoughts? I... | SELECT using psql returns no rows even though data is there | 0.099668 | 1 | 0 | 82 |
19,664,732 | 2013-10-29T17:05:00.000 | 1 | 0 | 0 | 0 | python,django,postgresql | 19,666,882 | 2 | false | 1 | 0 | Prefix the table in your query with the schema, as the search_path might be causing your query (or psql) to look in a schema other than what you are expecting. | 2 | 1 | 0 | I'm using Django + Postgres. When I do a SQL query using psql,
e.g. \d+ myapp_stories
correctly shows the columns in the table
But when I do SELECT * FROM myapp_stories, it returns nothing. But querying the same database & table from my python code returns data just fine. So there is data in the table. Any thoughts? I... | SELECT using psql returns no rows even though data is there | 0.099668 | 1 | 0 | 82 |
19,668,027 | 2013-10-29T20:05:00.000 | 0 | 0 | 0 | 0 | python,file-upload,pyramid | 19,686,469 | 1 | true | 1 | 0 | This sounds like your browser is caching the images. Try setting the cache_max_age=0 on your add_static_view, or viewing the page in your browser's incognito mode where it'll use a different cache. | 1 | 1 | 0 | I created new directory via 'myimages' under static directory. And whenever user upload files, file get stores in that directory. Once file uploaded I can access that on html using '/static/myimages/imagename.png'. It works fine whenever I am uploading new image. But whenver I try to override image. It shows me old ima... | pyramid static view and file upload | 1.2 | 0 | 0 | 198 |
19,671,933 | 2013-10-30T00:55:00.000 | 2 | 0 | 0 | 0 | python,user-interface,wxpython,xrc | 19,686,565 | 1 | true | 0 | 1 | You should learn wxPython. XRC does have its advantages, but it only covers the core widgets. If you want access to the rest of wxPython, then you'll have to figure out how to make XRC wrap the unsupported widgets, which is non-trivial and will require you to learn wxPython anyway.
There are tons of wxPython tutorials,... | 1 | 1 | 0 | After some research I've decided to use wxWidgets to build user interfaces for my Python programs. I learnt this could be done in two ways: either I blend my "behind the scenes" raw Python code with interface related wxPython code, or I could separate the interface from the main code, creating a separated XRC file for ... | Should I learn wxPython code or XRC code? | 1.2 | 0 | 0 | 612 |
19,672,150 | 2013-10-30T01:21:00.000 | 2 | 0 | 1 | 0 | python | 21,016,755 | 2 | false | 0 | 0 | This is a compatibility issue between 32 bit and 64 bit. So, either try 64 bit Python or 32 bit Python with 32 bit pywin32 installer. | 1 | 1 | 0 | I have a 64 bit architecture system. I installed Python 2.7.5. I then started the installation of pywin32-214.win-amd64-py2.7. That failed with the "ImportError: DLL load failed: %1 is not a valid Win32 application" error message.
Any suggestions? | ImportError: DLL load failed: %1 is not a valid Win32 application | 0.197375 | 0 | 0 | 4,144 |
19,673,279 | 2013-10-30T03:27:00.000 | 0 | 0 | 0 | 0 | python,classification,scikit-learn | 19,696,243 | 1 | false | 0 | 0 | CCA doesn't support sparse matrices. By default, you should assume scikit-learn estimators do not grok sparse matrices and check their docstrings to find out if by chance you found one that does.
(I admit the warning could have been friendlier.) | 1 | 0 | 1 | I am trying to run CCA for a multi label/text classification problem but keep getting following warning and an error which I think are related
warnings.warn('Maximum number of iterations reached')
/Library/Python/2.7/site-packages/sklearn/cross_decomposition/pls_.py:290:
UserWarning: X scores are null at iteratio... | UserWarning: X scores are null at iteration | 0 | 0 | 0 | 877 |
19,674,364 | 2013-10-30T05:16:00.000 | 0 | 0 | 1 | 0 | python,call,mousemove,xdotool | 19,674,382 | 2 | false | 0 | 0 | Remove the quotes. If you keep quotes, it will treat as a string.
call(["xdotool", "mousemove", "500","600"]) | 1 | 0 | 0 | I am using Python on Ubuntu.
call(["xdotool", "mousemove", "500","600"])works fine.
But if x=500, y=600,
call(["xdotool", "mousemove", "x","y"])
does not work.
What should be the syntax of x and y? | In Python how to use variables in call function? | 0 | 0 | 0 | 159 |
19,676,538 | 2013-10-30T07:44:00.000 | 155 | 0 | 1 | 0 | python,arrays,numpy | 19,676,762 | 3 | true | 0 | 0 | All three versions do different things:
B = A
This binds a new name B to the existing object already named A. Afterwards they refer to the same object, so if you modify one in place, you'll see the change through the other one too.
B[:] = A (same as B[:]=A[:]?)
This copies the values from A into an existing array B. T... | 2 | 127 | 1 | For example, if we have a numpy array A, and we want a numpy array B with the same elements.
What is the difference between the following (see below) methods? When is additional memory allocated, and when is it not?
B = A
B[:] = A (same as B[:]=A[:]?)
numpy.copy(B, A) | Numpy array assignment with copy | 1.2 | 0 | 0 | 76,805 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.