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
9,864,493
2012-03-25T22:01:00.000
3
0
1
0
python,regex,regex-lookarounds
9,923,353
2
true
0
0
If you do bar(?=ber) on "barber", "bar" is matched, but "ber" is not captured.
1
5
0
Is there an ability to make a lookahead assertion non-capturing? Things like bar(?:!foo) and bar(?!:foo) do not work (Python).
regular expression matching a string that is followed with another string without capturing the latter
1.2
0
0
3,196
9,864,843
2012-03-25T23:01:00.000
2
0
0
0
python,qt,model,pyqt,pyqt4
9,864,880
1
true
0
1
Set the QTableModel as the model for each QListView, and use QListView.setModelColumn to choose which column they each display.
1
2
0
Salut, community! Briefly. I wrote usual model over QAbstractTableModel and using it in usual way for QTableView. But I think I need to use some columns of this model for the few QListViews in QWizard to fill main table in the right way (for user). For example: use the column2 as the QListView's model on the page1 of t...
QAbstractTableModel as a model for one QTableView and few QListViews
1.2
0
0
371
9,866,104
2012-03-26T03:02:00.000
4
1
0
0
python,ruby,regex,email
9,866,851
2
false
1
0
I would look to a more non-technical solution. You could split out the 3500 names and post them to Amazon Mechanical Turk as a HIT, paying 1 cent for each. Then instead writing code to scrape Google, you write code to create the hits and let real people do the "scraping" of the company websites. Don't know if that will...
1
0
0
My boss has given me a list of around 3500 companies and wants the generic contact email for each of them by tomorrow. I know this sounds retarded, and it is, but our client is demanding it. The approach I'd like to take is this: Carry out a google search for company name Identify company website and redirect to it St...
Extract company contact details from google
0.379949
0
0
1,967
9,866,319
2012-03-26T03:37:00.000
1
0
0
0
python,mysql
9,868,793
3
true
0
0
If autocommit is turned off in the reader as well, then it will be doing the reads inside a transaction and thus not seeing the writes the other script is doing.
2
2
0
I have a small issue(for lack of a better word) with MySQL db. I am using Python. So I have this table in which rows are inserted regularly. As regularly as 1 row /sec. I run two Python scripts together. One that simulates the insertion at 1 row/sec. I have also turned autocommit off and explicitly commit after some nu...
Python MySQL- Queries are being unexpectedly cached
1.2
1
0
392
9,866,319
2012-03-26T03:37:00.000
0
0
0
0
python,mysql
9,867,231
3
false
0
0
My guess is that either the reader or writer (most likely the writer) is operating inside a transaction which hasn't been committed. Try ensuring that the writer is committing after each write, and try a ROLLBACK from the reader to make sure that it isn't inside a transaction either.
2
2
0
I have a small issue(for lack of a better word) with MySQL db. I am using Python. So I have this table in which rows are inserted regularly. As regularly as 1 row /sec. I run two Python scripts together. One that simulates the insertion at 1 row/sec. I have also turned autocommit off and explicitly commit after some nu...
Python MySQL- Queries are being unexpectedly cached
0
1
0
392
9,868,711
2012-03-26T08:16:00.000
2
1
1
0
python,eclipse,pydev
13,807,754
4
false
0
0
On a Mac, I can get to the PyDev settings via: Eclipse β†’ Preferences β†’ PyDev (in tree) β†’ Editor (subtree) In my case, I wanted to change hash tag comments from nearly invisible grey to a better color. It worked like a charm.
2
12
0
In Eclipse, how can I change default font for Python code in the editor (PyDev plugin)? I navigate to menu Window β†’ Preference β†’ General β†’ Appearance β†’ Colors & Fonts, but I don't find which item would affect the Python code font.
How do I change the default font for Python code in Eclipse?
0.099668
0
0
16,217
9,868,711
2012-03-26T08:16:00.000
2
1
1
0
python,eclipse,pydev
9,883,196
4
false
0
0
Following the guidance of gecco, I found out the item in General β†’ Appearance β†’ Colors & Fonts which affects Python code fonts. It's Text Font in the Basic folder.
2
12
0
In Eclipse, how can I change default font for Python code in the editor (PyDev plugin)? I navigate to menu Window β†’ Preference β†’ General β†’ Appearance β†’ Colors & Fonts, but I don't find which item would affect the Python code font.
How do I change the default font for Python code in Eclipse?
0.099668
0
0
16,217
9,869,262
2012-03-26T09:01:00.000
2
0
0
0
python,plone,zope,zodb
9,869,343
4
false
0
0
Both werkzeug and paste provide ordereddicts. You could no doubt pickle them for your purposes.
1
3
0
I am doing some PloneFormGen work. Currently PloneFormGen stores entered form entries internally as tuples without associated column information. If new columns (form fields) are added then the existing data becomes invalid. This could be easily avoided storing data in ordered dictionaries, which retain both entered co...
ZODB equivalent of ordered dict (odict?)
0.099668
0
0
676
9,871,108
2012-03-26T11:16:00.000
0
0
0
0
python,ajax,pyramid
12,723,197
2
true
1
0
I use long polling now and it seems like the best thing to use for me
1
0
0
I am trying to write a simple website. Here is the requirement. The site needs to be made with Pyramid web framework There needs to be a thread that contains 3 variables and the values of the variables will keep on changing. The site needs to pick these values up and display them without reloading the page. I know...
Variable value display without page reload
1.2
0
0
98
9,872,029
2012-03-26T12:22:00.000
1
0
0
1
python,google-app-engine,types
9,885,834
1
true
1
0
When browser renders html it thinks that <type 'str'> is a (unknown) tag, so it renders it as <type 'str'></type>, hence it becomes part of your page markup... You can see this with Firebug or any similar tool.
1
0
0
For debug use I want to show the type of a variable in Google App Engine. In traditional environment, I will use "print type( x )" to do it. But in GAE I just don't know why I can't use self.response.out.write( str( type( x ) ) ) to echo it in the browser. I got confused because I did transform the <type 'type'> to <...
how to show an object's type in google app engine
1.2
0
0
89
9,872,984
2012-03-26T13:25:00.000
2
0
0
0
combobox,wxpython
9,874,476
1
true
0
1
If you need to update a list in a combobox, use it's SetItems(myNewList) method. I would keep a dictionary of the various lists you need and use that to populate the second combobox based on the selection in the first.
1
0
0
Can someone give me some direction as to the proper control to use to update the items in a combobox if a certain item is selected in another combobox? Thanks.
What is the proper control for updating a combobox
1.2
0
0
119
9,873,626
2012-03-26T14:05:00.000
3
0
1
0
python,algorithm
9,873,885
5
false
0
0
Use a loop (int i=0; i < m; i++) Then to get the indexes you want, Ceil(i*m/n).
1
12
1
I have a vector/array of n elements. I want to choose m elements. The choices must be fair / deterministic -- equally many from each subsection. With m=10, n=20 it is easy: just take every second element. But how to do it in the general case? Do I have to calculate the LCD?
Choose m evenly spaced elements from a sequence of length n
0.119427
0
0
11,243
9,874,959
2012-03-26T15:26:00.000
2
0
0
1
python,django,google-app-engine
9,875,058
4
false
1
0
Google only allows you to send emails from a domain name that they control in the google app engine. So you will either have to send it from the test domain they give you, a gmail account, or you need to use their name servers for your domain name.
1
3
0
I have created one Django Application,also hosted it on the google app engine. I can send emails from django application, but after hosting it to app engine I cant do that.I really stuck with this problem, so please tell me if there is any solution for using django email functions in Google app engine. I have tried ...
How to send emails from django App in Google App Engine
0.099668
0
0
1,520
9,876,967
2012-03-26T17:40:00.000
3
0
0
1
python,qsub,sungridengine
15,344,911
8
false
0
0
This is SGE buffering the output of your process, it happens whether its a python process or any other. In general you can decrease or disable the buffering in SGE by changing it and recompiling. But its not a great thing to do, all that data is going to be slowly written to disk affecting your overall performance.
1
5
0
I have an SGE script to execute some python code, submitted to the queue using qsub. In the python script, I have a few print statements (updating me on the progress of the program). When I run the python script from the command line, the print statements are sent to stdout. For the sge script, I use the -o option to r...
SGE script: print to file during execution (not just at the end)?
0.07486
0
0
4,083
9,881,995
2012-03-27T01:00:00.000
1
0
1
0
python,osx-lion,python-imaging-library,macports
9,882,005
1
true
0
0
It is saying that Image is not a module. Either it doesn't exist or it isn't in Python's path or the directory in which your script is.
1
1
0
I just updated my OS from Snow Leopard to LION 10.7.3, and I usually run this python script using IDLE. However, when I try running it, I get this error.. Traceback (most recent call last): File "/Users/Brian/Desktop/BitmapBuilder.py", line 1, in import os, shutil, Image, brianutils, sys ImportError: No module n...
Error in running my Python Script
1.2
0
0
157
9,884,022
2012-03-27T05:51:00.000
0
0
0
0
python,windows
9,896,301
1
true
0
0
Try running CellProfiler.py --help directly from the command line. This will work, if you've installed Python via the installer, which registers the .py file extension as executable, and therefore Windows searches in PATH if you try to execute one.
1
0
0
This seems to be a common problem, but I cant seem to fin a solution that works. My PATH is set with C:\Python26\Scripts;C:\Python26\Lib and PYTHONPATH is similarly set. Any suggestions would be very much appreciated. python CellProfiler.py --help python: cant open file 'CellProfiler.py': [Errno 2] No such file or dir...
Command Prompt cant open file in Python26\Scripts
1.2
0
0
296
9,884,132
2012-03-27T06:03:00.000
5
0
1
0
python,iterator,iteration,terminology,iterable
52,202,768
17
false
0
0
Iterables have a __iter__ method that instantiates a new iterator every time. Iterators implement a __next__ method that returns individual items, and a __iter__ method that returns self . Therefore, iterators are also iterable, but iterables are not iterators. Luciano Ramalho, Fluent Python.
1
528
0
What is the most basic definition of "iterable", "iterator" and "iteration" in Python? I have read multiple definitions but I am unable to identify the exact meaning as it still won't sink in. Can someone please help me with the 3 definitions in layman terms?
What exactly are iterator, iterable, and iteration?
0.058756
0
0
377,113
9,884,764
2012-03-27T07:02:00.000
3
0
1
0
python,console,ipython,metaclass
9,888,047
3
true
0
0
It's not done the way you're imagining. ipython reads your command prompt input as a line of text, so it has a chance to check if it ends with a question mark before it passes it on to eval (or whatever). If it does, it runs help(name) instead of what you typed. AST looks a little heavy-duty, but you can get a feel for...
2
3
0
So i was thinking that in order to implement such a feature in a console application , where appending a question mark at the end of a function name will pour out it's doc string , i would have probably used a feature like metaclasses , where upon definition/import , i'd duplicate all the module member names and produc...
how does IPython's ? (question mark) operator actually work?
1.2
0
0
2,132
9,884,764
2012-03-27T07:02:00.000
1
0
1
0
python,console,ipython,metaclass
13,134,147
3
false
0
0
Have a look at the IPython.core.inputsplitter module for the code that parses the raw input line for things like ?, !, /, %, etc.
2
3
0
So i was thinking that in order to implement such a feature in a console application , where appending a question mark at the end of a function name will pour out it's doc string , i would have probably used a feature like metaclasses , where upon definition/import , i'd duplicate all the module member names and produc...
how does IPython's ? (question mark) operator actually work?
0.066568
0
0
2,132
9,886,494
2012-03-27T09:13:00.000
0
1
0
0
python,django,shipping,satchmo
14,647,712
1
true
0
0
it seems like the tieredweight shipping module is what I need here.
1
0
0
I'm taking over a Satchmo site and need it to charge a different shipping rate for international versus local postage. Any idea what I need to do to enable this?
Different national and international shipping rate in Satchmo?
1.2
0
0
84
9,887,174
2012-03-27T09:53:00.000
1
0
1
0
python,python-2.7
9,887,500
1
true
0
0
To "convert" it into a file: Write the bytearray to disk without changing anything (be sure to open the file for writing with "wb"). To access its content without saving to disk, embed it into a stringio object (which mimics an open file) and access it with zipfile.
1
0
0
I have a bytearray object in Python 2.7 that I got from a query to an SQL server and I know that it is a zip file. What I need to do now is access the data in the zip file. How can I convert the bytearray into the file and safe it to the hard disc? How can I access the data in the zip file directly in Python?
How to convert bytearray into a zip file
1.2
0
0
823
9,887,223
2012-03-27T09:56:00.000
2
0
0
0
python,unicode,urllib2,urlopen
9,889,366
2
true
0
0
What you need is u"http://www.besondere-raumdΓΌfte.de/".encode('idna'). Please note how the source string is a Unicode constant (the u prefix). The result is an URL usable with urlopen(). If you have a domain name with non-ASCII characters and the rest of the URL contains non-ASCII characters, you need to .encode('idna'...
1
2
0
I cannot request url "http://www.besondere-raumdΓΌfte.de" with urllib2.urlopen(). I tried to encode string using urllib.urlencode with utf-8, idna, ascii But still doesn't work. Raises URLError: <urlopen error unknown url type.
How to request a url with non-unicode carachters on main domainname (not params) in Python?
1.2
0
1
2,142
9,887,663
2012-03-27T10:22:00.000
0
0
1
0
python,colors,pixel,python-2.6
9,887,823
2
false
0
0
No, The std libraries can't tell you anything about your screen
1
1
0
I am in a situation where importing non-standard python libraries is not suitable. Is it possible to grab the pixel colour at a given location on the screen (x,y) using only the standard python (2.6) libraries in Windows?
Find the colour of a pixel at a given location without importing non-standard libraries
0
0
0
329
9,890,730
2012-03-27T13:42:00.000
2
0
1
0
python
9,891,022
2
true
0
0
Here is a reference from the official python manual: A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. A primary use for weak references i...
1
0
0
What is WeakValueDictionary from weakref ? I know it allows to store items in dictionary without garbage collector caring about them but when should they be used? I don't know the example of the situation where we would want to bypass garbage collector in python.
WeakValueDictionary in python
1.2
0
0
706
9,892,351
2012-03-27T15:12:00.000
3
0
0
0
android,python,sl4a
9,892,477
3
false
1
1
Try the official Android emulator. If the APKs include native libraries, chances are those are compiled for ARM only. Google's emulator emulates the ARM instruction set. To make sure, rename the APK to ZIP and look inside. The structure of the lib folder, if any, will give you an idea.
1
0
0
I am currently developing a Android Application. I couldn't install the Android Python APKs like the sl4a.apk and the PythonInterpreter.apk on my Android x86 emulator. I read that it is possible to recompile the APKs with NDK but I have not found a closer decription, yet. Has anybody experience with this and could prov...
SL4A Android x86 installation
0.197375
0
0
1,441
9,893,317
2012-03-27T16:04:00.000
0
0
1
0
python,pypy
68,372,961
3
false
0
0
install Chocolatey choco install python.pypy -y
2
15
0
I was wondering how to use PyPy 1.8 on Windows XP 32-bit. I downloaded the zip file off the website and installed it into a My Documents file. Initially, I thought it was similar to psyco in that I had to "import psyco," but I found that PyPy.exe acted like the Python command line instead. I tried dragging my scripts i...
How to use PyPy on Windows?
0
0
0
24,210
9,893,317
2012-03-27T16:04:00.000
9
0
1
0
python,pypy
9,895,099
3
true
0
0
Maybe I'm not following what you're trying to do, but isn't it just a question of opening a command prompt and running pypy myscriptname ? Assuming you've got all the paths for PyPy and your script straight, anyway (e.g. your script's in PyPy's folder).
2
15
0
I was wondering how to use PyPy 1.8 on Windows XP 32-bit. I downloaded the zip file off the website and installed it into a My Documents file. Initially, I thought it was similar to psyco in that I had to "import psyco," but I found that PyPy.exe acted like the Python command line instead. I tried dragging my scripts i...
How to use PyPy on Windows?
1.2
0
0
24,210
9,894,979
2012-03-27T17:59:00.000
0
0
0
0
python,user-interface,text-based
9,895,140
3
false
0
1
For basic toolkit, I think tkinter which comes with python is okay. If you want to have graphical toolkit with more functionality, I would suggest you to take a look at wxpython which is cross-platform compatible.
1
1
0
Quick to learn is pretty important, but I need just some basic GUI tools, for Ubuntu OS but would be nice to have multi-OS compatibility. Any suggestions? The basic dynamics of the intended game just include a text input and some set reaction frames. Thanks in advance.
Python GUI Toolkit for Text-Based Game?
0
0
0
1,725
9,896,687
2012-03-27T19:53:00.000
1
1
0
1
python,64-bit,pygame,wxwidgets,enthought
11,151,178
1
true
0
0
I had the same problem. The only way around it that has worked for me is to uninstall your EPD version ($ sudo remove-EPD-7.2-1, or whichever version you have) and reinstall the 32 bit version. Wx comes as part of the EPD package, so once you have downloaded the 32 bit version there is no need to download and install w...
1
1
0
For some reason my 64 bit EPD can't import wx. I also tried to install the wxPython2.8-osx-unicode-py2.7 version from the wx site. It installed successfully, but is no where to be found on my harddrive. I checked the sitepackes for 2.7 and the EPD 7.2.2. where all the modules usually should be installed. I am confused...
enthought python distribution wx
1.2
0
0
682
9,897,345
2012-03-27T20:38:00.000
14
0
1
0
python,serialization
12,095,050
8
false
0
0
Pickle is actually quite fast so long as you aren't using the (default) ASCII protocol. Just make sure to dump using protocol=pickle.HIGHEST_PROTOCOL.
1
33
1
I am trying to serialize a large (~10**6 rows, each with ~20 values) list, to be used later by myself (so pickle's lack of safety isn't a concern). Each row of the list is a tuple of values, derived from some SQL database. So far, I have seen datetime.datetime, strings, integers, and NoneType, but I might eventually ha...
Pickle alternatives
1
0
0
35,941
9,897,647
2012-03-27T21:01:00.000
0
0
0
0
python,signals,urllib2,sigterm
9,897,777
1
false
0
0
urlopen returns a file-like object. Data is only sent over the network when you make a .read() request on this object. (Your OS does some buffering of network data, so this isn't strictly true, but it's close enough for all practical purposes.) So simply use the .read() method's capability to read data in chunks using ...
1
0
0
I'm using urllib2.urlopen() to open sometimes potentially large files. I have a signal handler to catch SIGTERM, but is it possible to actually interrupt urlopen() when it's downloading a big file to close my program immediately, without waiting for the call to finish?
Python: interrupting urllib2.urlopen() with SIGTERM
0
0
1
396
9,899,180
2012-03-27T23:32:00.000
1
0
1
0
python,python-3.x,cloud
9,899,346
3
false
1
0
I haven't tried myself. You may want to check out ipython notebook.
1
0
0
Is there any way in a browser, to type python code into an input field, it will then be sent to a local server and executed and the result pushed back to the browser. Basically a browser hosted python notebook, where the code gets evaluated on a different machine. Is there any python package to do this. something like...
cloud scripting through browser and evaluate python on server
0.066568
0
1
92
9,899,313
2012-03-27T23:48:00.000
2
1
1
0
python,beautifulsoup,mechanize
9,899,341
1
false
0
0
Use a dict or set. Consider computing a checksum of each item. This brings you toward what's known as Content Addressable Storage, which is where the checksum actually is stored as if it were the item's "name", and a separate index is stored which maps things like filenames or song names to the checksums or data bloc...
1
1
0
This isn't as much of a specific problem as something I am looking for more of a "Pythonic" philosophical answer to. Namely, what's the best way to keep track of unique items and ensure duplicates don't arise? For example, I am writing a script to scrape a website for links to songs on SoundCloud so I can automaticall...
What is the most efficient way to keep track of unique downloaded files in a Python program?
0.379949
0
0
214
9,905,587
2012-03-28T10:26:00.000
0
0
0
0
python,qt4.7
9,910,376
1
false
0
1
Thank you, I solved, when clicked the QtoolButton send two different triggered signal, then my slot ran twice, it was enough to add decorator before the definition of the slot @pyqtSignature("")
1
0
0
Hi in my application I have several gui developped with QT4.7, in some of them I use QToolButton for interaction, everything work nicely, except that when I click over each of the QToolButton, the slot linked to his triggered signal is called twice, I have no more Ideas about a olution to that, can you help me please...
trigger signal of QToolButton autorepeat the action
0
0
0
305
9,905,743
2012-03-28T10:36:00.000
0
0
1
1
python,subprocess,packaging,pip,distutils
9,918,260
2
false
0
0
If you don’t have a real reason to avoid subprocesses (i.e. lack of platform support, not just aesthetics (β€œI see no point”)), then I suggest you should just not care and run in a subprocess. There are a few ways to achieve what you request, but they have their downsides (like having to catch exceptions and reporting ...
1
6
0
I am writing a script to automate the packaging of a 'home-made' python module and distributing it on a remote machine. i am using Pip and have created a setup.py file but i then have to call the subprocess module to call the "python setup.py sdist" command. i have looked at the "run_setup" method in distutils.core but...
How do i run the python 'sdist' command from within a python automated script without using subprocess?
0
0
0
1,605
9,906,938
2012-03-28T11:52:00.000
1
0
1
0
python,jupyter
34,956,900
7
false
0
0
you can right click on the ipython windows and select "Default". you can set your default configuration from there.
1
29
0
It is possible to make persistent changes to settings for default settings on Windows 7? I would like to change font-size and shell size.
Change Jupyter QtConsole settings
0.028564
0
0
16,567
9,909,987
2012-03-28T14:46:00.000
0
0
1
0
python,data-structures,genetic-algorithm
9,910,954
3
false
0
0
I think sticking with the strings is a good idea. You can easily chop strings into pieces. if you need to act on them as a list, you can convert it with "list(str)". Once you have a list, you can alter it and turn it back into a string using "''.join(lst)". Personally, I wouldn't use a long or another integer type t...
1
3
0
I am implementing a GA in Python and need to store a sequence of ones and zeros, so I am representing my data as binaries. What is the best data structure for that? A simple string?
Which data types for genetic algorithms in Python?
0
0
0
1,028
9,910,788
2012-03-28T15:27:00.000
0
0
0
1
python,windows-services,waitress
13,188,519
1
false
0
0
Hmm, March, a bit late. You can't debug without more info. I'd turn the logging all the way to debug, if not already done. I'd also check the NT event log. The only things coming to mind are the firewall, and extra restrictions on apps in server. If possible, try adding an exception for your app.
1
1
0
So I've written a windows service in python which starts a subprocess that runs a Waitress server, monitors a directory for changes, and restarts the server when a change is detected. On Windows 7, everything works fine. On Windows Server 2003, where I have to deploy this server, the server fails to bind to its port. I...
Trouble running waitress as a service on Windows Server 2003
0
0
0
659
9,910,989
2012-03-28T15:38:00.000
1
0
1
0
python,python-collections
9,911,027
1
false
0
0
Sure. Write __eq__ and __ne__ methods that perform this comparison.
1
1
0
I have written a custom mapping class that inherits from collections.Mapping. Is there an easy way to test if an instance's data is equal to another mapping object, e.g. dict?
Test if collections.Mapping is equal to other mapping, or dict
0.197375
0
0
323
9,912,121
2012-03-28T16:47:00.000
0
1
0
1
python,windows,process,kill
9,912,713
1
false
0
0
Why are you assured that your CGI script are still working when you try to kill it? Web server starts one instance of CGI script for one request and when script finishes it... just finishes.
1
0
0
I'm obtaining a PID, using python, of a CGI script, however, the PID is not valid i.e. can't Taskkill it from CL. I get: "Process: no process found with pid xxxx" where xxxx is the pid I thought maybe I have to kill a parent python shell instance, but os.ppid doesn't work in windows. So then I installed psutil python ...
Determing PID of CGI Script on Windows
0
0
0
222
9,913,193
2012-03-28T18:02:00.000
0
0
1
0
python,import,module,compiled
9,913,300
6
false
0
0
In import use the pyc file name,python will automatically load it.
2
21
0
I can't seem to figure out how to import a compiled .pyc module into my code so I can use it within my main script. Is this even possible?
Is it possible to import a compiled python file?
0
0
0
35,577
9,913,193
2012-03-28T18:02:00.000
1
0
1
0
python,import,module,compiled
28,891,674
6
false
0
0
Yes, but caveat that with make sure to start python with the "-O" option! In my personal experience, if all you have is that .pyc or .pyo file, running "python.exe" without the flag and trying to import will fail, however running python.exe -O and then trying to import as normal should work.
2
21
0
I can't seem to figure out how to import a compiled .pyc module into my code so I can use it within my main script. Is this even possible?
Is it possible to import a compiled python file?
0.033321
0
0
35,577
9,914,165
2012-03-28T19:13:00.000
1
0
0
0
python,logging
12,219,717
1
true
1
0
Just for future reference for people... I tried loggly out and was generally very pleased with them. While I never did any formal benchmarking tests (with our without them). Any performance issues were not noticeable to me.
1
1
0
I'm getting ready to deploy an app to Heroku and I'm considering adding Loggly as a plugin. I love the idea of being able to aggregate and search my logs more easily, but I'm a bit concerned about what kind of performance hit I might take because of it. Any experiences (good or bad) out there with Loggly? Just as a n...
Loggly performance
1.2
0
0
398
9,914,985
2012-03-28T20:14:00.000
0
0
1
1
python,environment-variables
9,915,173
1
false
0
0
You can always export PYSTARTUP="whatever" on the shell before starting your script. You can also put PYSTARTUP="whatever" in front of the command you want to run, e.g. PYSTARTUP="whatever" python something.py
1
0
0
We have an in-house developed network-based application that is based on python, it provides a command-line environment in the same way like python does. I also have a local python installation on my machine. Sometimes for simple python tasks, i prefer using my local python install... Is possible to to have a different...
different PYSTARTUP variables for different python installations
0
0
0
184
9,915,062
2012-03-28T20:20:00.000
0
0
0
0
python,database,shelve
9,915,108
1
false
0
0
Shelves are mappings, and mappings have an update() method.
1
0
0
I have several Shelve i.e. .db files that I wish to merge together into one single database. The only method I could think of was to iterate through each database rewriting each iteration to the new database, but this takes too long. Is there a better way to do this?
How can I merge Shelve files/databases?
0
1
0
320
9,915,870
2012-03-28T21:24:00.000
5
0
1
0
python,utf-8
9,915,912
1
true
0
0
You're getting the correct result, the Unicode codepoint for Γ± is U+00f1. It's just that Python won't display the Unicode character directly. Try it in a print statement and see what you get.
1
1
0
I'm trying to do this in Python: 'Fi\xc3\xb1a'.decode('utf-8') I expect the result to be FiΓ±a. But the result is actually: u'Fi\xf1a' No idea what is going on, some help on this would be much appreciated. Thanks!
UTF-8 decoding error in Python
1.2
0
0
218
9,916,571
2012-03-28T22:28:00.000
1
0
0
0
python,django,multithreading,mod-wsgi
9,916,735
2
false
1
0
You shouldn't be worrying about this kind of stuff. These slots are stored in a database right? The database should handle all the locking mechanisms for you, just make sure you run everything under a transaction and you will be fine.
1
1
0
I have a django app which is used for managing registrations to a survey. There are fixed number of slots and I want to "reserve" slots for users when they sign up. In one of my views, I get the next available slot and reserve it (or redirect the user if there are no slots available.) I want to protect against the cas...
Questions about django thread safety
0.099668
0
0
194
9,916,873
2012-03-28T22:58:00.000
0
0
1
0
python,exception,gevent
17,853,380
2
false
0
0
You can use spawn_link_exception instead of spawn.
1
2
0
i'm working with an application written in python using gevent. i want it to exit immediately as a result of any exception that i haven't explicitly trapped. it looks like i'd have to patch the core gevent code. is there any way can i do this in my app, without patching gevent or greenlet?
how can i make gevent application exit immediately after any exception?
0
0
0
1,560
9,917,327
2012-03-28T23:54:00.000
2
0
0
0
python,image-processing,python-imaging-library
9,917,381
1
true
0
1
Make a mask which is the same size as the image2, mode 'L'. Fill it with gray values from 0 to 255, representing the alpha transparency you want. Use paste to put image2 into image1, using the gray image as the mask parameter.
1
0
0
I have two images (JPGs). Both are the same width but image2 is shorter than image1. I want to paste image2 on top of image1 (top aligned) and for each row in image2 I want to blend into image1 with a different alpha transparency value (to make it smoothly blend from bottom to top ). I'm using Python PIL and because I'...
Blending two images with PIL: Different sizes and different alpha transparency per row
1.2
0
0
2,127
9,917,464
2012-03-29T00:10:00.000
0
0
0
0
python,text,pygame
9,917,557
2
true
0
1
You're on the right track! Use a variable.
2
0
0
I am creating a copy of the game Pig. I have got a text based version of the game working. I am just updating it to pygame, adding graphics and sounds. I will eventually add in mouse toggles, but for now I am trying to update a score. I have display a 'player1 score', 'player2 score' out. I am trying to see how will it...
Pygame: How would I go about setting a text object, BUT the text is meant to keep changing?
1.2
0
0
1,013
9,917,464
2012-03-29T00:10:00.000
2
0
0
0
python,text,pygame
10,002,172
2
false
0
1
Pygame Font objects are not meant to be updated and changed constantly. You will need to call render(text) each time your text changes. Render() will return a new surface, so you will need to blit that to your screen to make the change.
2
0
0
I am creating a copy of the game Pig. I have got a text based version of the game working. I am just updating it to pygame, adding graphics and sounds. I will eventually add in mouse toggles, but for now I am trying to update a score. I have display a 'player1 score', 'player2 score' out. I am trying to see how will it...
Pygame: How would I go about setting a text object, BUT the text is meant to keep changing?
0.197375
0
0
1,013
9,917,971
2012-03-29T01:25:00.000
4
0
0
0
python,database,django,django-models
9,917,983
2
false
1
0
models enforces constraint via the database. choices enforces constraint via the code. Which you choose depends on who you want to select the choices.
2
2
0
Lets say I'd like to give an user options to pick from and ensure that the submitted values are available options. I've been reading the documentation and it seems to me that: if your values won't change then use choices -- if your data is dynamic then use models. I'm a bit unsure though, shouldn't models be chosen ove...
Django - Choices vs Models (FKs)
0.379949
0
0
742
9,917,971
2012-03-29T01:25:00.000
7
0
0
0
python,database,django,django-models
9,920,914
2
false
1
0
Use models when you definitely need one of these: ability easily edit (add, delete) choice with no need to reload the code; ability to store additional info for any choice; easy many-to-many relation (and filtering by it) ability to work with dynamic subset of choices in different cases. Use choices otherwise.
2
2
0
Lets say I'd like to give an user options to pick from and ensure that the submitted values are available options. I've been reading the documentation and it seems to me that: if your values won't change then use choices -- if your data is dynamic then use models. I'm a bit unsure though, shouldn't models be chosen ove...
Django - Choices vs Models (FKs)
1
0
0
742
9,918,646
2012-03-29T03:20:00.000
0
0
0
0
python,uno
67,111,357
17
false
0
0
This is a solution for MacOS with old xls files (e.g. Excel 97 2004). The best way I found to deal with this format, if excel is not an option, is to open the file in openoffice and save it to another format as csv files.
1
43
0
I have some *.xls (excel 2003) files, and I want to convert those files into xlsx (excel 2007). I use the uno python package, when I save the documents, I can set the Filter name: MS Excel 97 But there is no Filter name like 'MS Excel 2007', How can set the the filter name to convert xls to xlsx ?
how to convert xls to xlsx
0
1
0
99,140
9,918,903
2012-03-29T04:00:00.000
0
0
0
0
python,google-app-engine,file-conversion
11,282,356
1
false
1
0
You could export the canvas to an image (toDataURL) after the user creates or modifies the chart, and swap the two when calling the Conversion API.
1
1
0
I am trying to figure out the best way of allowing my users to create a family tree chart, view it on screen and then to be able to create a PDF of it. I am considering using ReportLab for the PDF generation, however then I have to have separate display and PDF code. So I was wondering if the Conversion API would be ab...
Does the App Engine Conversion API for HTML to PDF support canvas or SVG?
0
0
0
254
9,919,509
2012-03-29T05:22:00.000
1
1
0
0
python,ms-word,pdf-generation,report,reportlab
9,930,989
3
false
0
0
I should point out you can do all the stuff you want in ReportLab by using the supporting PLATYPUS module. It lets you easily build documents out of objects in code. Alternatively, there is RML, a ReportLab way of building documents from an HTML-like markup language.
2
2
0
I want some help to generate a report in PDF/Doc(MS Word) format . I’m not able to find any module to generated report in doc, except β€œdocx” which I’m not able to comprehend. Actually I’m actual task is to generate the report in Doc only, but as I’m not able to find a module to work on it, I opt for PDF. I’m using β€œRep...
Need help to generate report in PDF or Doc using python
0.066568
0
0
1,604
9,919,509
2012-03-29T05:22:00.000
1
1
0
0
python,ms-word,pdf-generation,report,reportlab
9,931,947
3
false
0
0
You could also try and generate LaTeX Code, which you then compile to PDF.
2
2
0
I want some help to generate a report in PDF/Doc(MS Word) format . I’m not able to find any module to generated report in doc, except β€œdocx” which I’m not able to comprehend. Actually I’m actual task is to generate the report in Doc only, but as I’m not able to find a module to work on it, I opt for PDF. I’m using β€œRep...
Need help to generate report in PDF or Doc using python
0.066568
0
0
1,604
9,920,935
2012-03-29T07:32:00.000
0
0
0
0
python,excel,format,xlwt
10,001,613
2
false
0
0
You said: formatting with xlwt takes a lot of time and it is quite awkward to use Perhaps you are not using easyxf? If so, check out the tutorial that you can access via www.python-excel.org, and have a look at examples/xlwt_easyxf_simple_demo.py in your xlwt installation.
1
3
0
I have to create Excel spreadsheet with nice format from Python. I thought of doing it by: I start in Excel as it is very easy to format: I write in Excel the model I want, with the good format I read this from Python I create from Python an Excel spreadsheet with the same format In the end, the purpose is to create...
Easily write formatted Excel from Python: Start with Excel formatted, use it in Python, and regenerate Excel from Python
0
1
0
4,524
9,921,057
2012-03-29T07:41:00.000
0
0
1
0
java,python,math
9,921,123
2
false
0
0
You can use the built-in function round: round(3.5) gives 4.0 round(3.4) gives 3.0 round(3.6) gives 4.0
1
1
0
Does an analogue to Java's Math.rint exist in Python? If not, how can I achieve the same result?
Rounding numbers: Java's 'Math.rint' in Python
0
0
0
1,638
9,922,710
2012-03-29T09:35:00.000
2
0
0
0
python,plone
9,922,771
1
false
1
0
You can store hash ( eg md5 ) of your image content into a database, at upload time. When a new image is uploaded, you just have to match the current image's hash against those present in the database. The hash will be collision free mostly, however to be more sure, you can also store other attributes like filesize, im...
1
2
0
How can I check a duplicate file or image being uploaded into a Plone site. I am using Plone 4.1? Is there some feature or configuration changes that need to be done to achieve the same.I want this feature to check the entire site before uploading any file /image into the site. I am working on Linux OS. I am using the...
How can I check a duplicate file or image being uploaded into a Plone site
0.379949
0
0
176
9,923,175
2012-03-29T10:03:00.000
0
1
0
1
python,gevent
9,923,444
2
false
0
0
first test cmd easy_install gevent if failed, just go google python setuptools and then installed it and easy_install gevent just let the setuptools to help you choose the suitable module
1
0
0
I'm new for python. How can I get gevent-py2.7-win64.egg, my system is win32, and I need a 64bit module of gevent
How can I get gevent-py2.7-win64.egg
0
0
0
377
9,924,169
2012-03-29T11:09:00.000
9
0
0
0
python,django,saas
9,925,190
4
false
1
0
A very basic, elementary example of how you would go about it. Suppose you have a simple app designed to solve a particular business case. For example, you created an app to handle room reservations at your office. To "convert" this app into a service you have to configure it such that most of the user-specific parts o...
2
31
0
Can you advice me with some articles/applications that allows you create SaaS(Software as a Service) application with Python and Django. For the moment the general topics I do not understand are: Do you have one working application for all clients or one app per client How do you manage database access, permissions or...
How to create SaaS application with Python and Django
1
0
0
23,996
9,924,169
2012-03-29T11:09:00.000
8
0
0
0
python,django,saas
9,924,280
4
false
1
0
Software as a Service is just a marketing word, it's technically no different from a server that is accessible over the internet. So question 3 makes no sense. That leaves us with question 1 and 2: What do you mean with 'app' in this context? Your web application (built with Python and Django) can have multiple Django...
2
31
0
Can you advice me with some articles/applications that allows you create SaaS(Software as a Service) application with Python and Django. For the moment the general topics I do not understand are: Do you have one working application for all clients or one app per client How do you manage database access, permissions or...
How to create SaaS application with Python and Django
1
0
0
23,996
9,926,088
2012-03-29T13:14:00.000
2
1
0
1
python,eclipse,pydev
9,926,632
1
true
0
0
Right click on the python file you care about and see what the default editor is. You can manually switch any file type here. If it's plain text, just switch it back to PyDev. To ensure that the setting is global, go to Window > Preferences > General > Editors > File associations and look for .py, .pyw, and .pyx. They ...
1
1
0
I'm having a problem with eclipse+pydev. It suddenly refuses to parse a .py file as a python script, which means no syntax highlighting, code completion etc. It worked up until now, but I couldn't find a way to convince it to re parse it. re-opening the file, re-starting the IDE does not help. I suspect deleting some k...
eclipse pydev refuses to parse a .py file
1.2
0
0
439
9,926,825
2012-03-29T13:54:00.000
0
0
0
0
python,amazon-web-services
9,928,772
4
false
1
0
Don't put it in applications you plan to distribute. It'll be visible and they can launch instances that are directly billable to you or worst..they can take down instances if you use it in production. I would look at your programs design and seriously question why I need to include that information in the app. If yo...
1
11
0
I'm making an application in Python and using Amazon Web Services in some modules. I'm now hard coding my AWS access id and secret key in *.py file. Or might move them out to an configuration file in future. But there's a problem, how can I protect AWS information form other people? As I know python is a language that ...
How can I protect my AWS access id and secret key in my python application
0
0
1
6,307
9,927,372
2012-03-29T14:25:00.000
1
0
0
0
python,programming-languages,database-programming
9,927,520
4
true
0
0
The deveopment of a scalable database is language independent, i cannot say much about PHP, but i can tell you good things about Python, it's easy to read, easy to learn, etc. In my opinion it makes the code much cleaner than other languges.
3
0
0
I want to ask you what programming language I should use to develop a horizontally scalable database. I don't care too much about performance. Currently, I only know PHP and Python, but I wonder if Python is good for scalability. Or is this even possible in Python? The reasons I don't use an existing system is, I need ...
Programming a scalable database
1.2
1
0
284
9,927,372
2012-03-29T14:25:00.000
0
0
0
0
python,programming-languages,database-programming
9,927,811
4
false
0
0
Since this is clearly a request for "opinion", I thought I'd offer my $.02 We looked at MongoDB 12-months ago, and started to really like it...but for one issue. MongoDB limits the largest database to amount of physical RAM installed on the MongoDB server. For our tests, this meant we were limited to 4 GB databases. Th...
3
0
0
I want to ask you what programming language I should use to develop a horizontally scalable database. I don't care too much about performance. Currently, I only know PHP and Python, but I wonder if Python is good for scalability. Or is this even possible in Python? The reasons I don't use an existing system is, I need ...
Programming a scalable database
0
1
0
284
9,927,372
2012-03-29T14:25:00.000
0
0
0
0
python,programming-languages,database-programming
9,927,445
4
false
0
0
Betweent PHP & Python, definitely Python. Where I work, the entire system is written in Python and it scales quite well. p.s.: Do take a look at Mongo Db though.
3
0
0
I want to ask you what programming language I should use to develop a horizontally scalable database. I don't care too much about performance. Currently, I only know PHP and Python, but I wonder if Python is good for scalability. Or is this even possible in Python? The reasons I don't use an existing system is, I need ...
Programming a scalable database
0
1
0
284
9,927,711
2012-03-29T14:42:00.000
3
0
0
0
python,numpy,pandas
9,927,957
3
false
0
0
You can pass a custom list of values to be treated as missing using pandas.read_csv . Alternately you can pass functions to the converters argument.
1
1
1
I am using pandas to read a csv file. The data are numbers but stored in the csv file as text. Some of the values are non-numeric when they are bad or missing. How do I filter out these values and convert the remaining data to integers. I assume there is a better/faster way than looping over all the values and using i...
Reading csv in python pandas and handling bad values
0.197375
0
0
3,639
9,927,821
2012-03-29T14:48:00.000
0
1
0
0
python,user-interface,wxpython,pyqt,tkinter
9,928,114
4
false
0
0
Basically you just need to figure out what widgets will hold the data you want the best. I suspect you could use a couple combo boxes to hold different sets of extensions. Or you could just use the path name strings to figure that out. Hit a button and run the conversion process, probably in another thread so the GUI r...
3
3
0
I have a command-line Python script that works well to convert one sort of file into another given a few parameters and would now like to deploy this to some of my colleagues who may not know what a command line is. I could work for hours trying to determine which Python GUI toolkit is "best", then learning how to do w...
Cookbook GUI interface for a command-line script
0
0
0
4,233
9,927,821
2012-03-29T14:48:00.000
1
1
0
0
python,user-interface,wxpython,pyqt,tkinter
9,934,956
4
false
0
0
There are a few answers advocating wxpython. However, any toolkit will work for this project. Tkinter has the added benefit tha you and your collegues already have it installed and it is very easy to use. That being said, the other toolkits are more-or-less equally easy to use but you might have to jump through a hoop...
3
3
0
I have a command-line Python script that works well to convert one sort of file into another given a few parameters and would now like to deploy this to some of my colleagues who may not know what a command line is. I could work for hours trying to determine which Python GUI toolkit is "best", then learning how to do w...
Cookbook GUI interface for a command-line script
0.049958
0
0
4,233
9,927,821
2012-03-29T14:48:00.000
0
1
0
0
python,user-interface,wxpython,pyqt,tkinter
9,928,262
4
false
0
0
This depends mostly on your need. If your need is simple, you can just go with tkinter that is bundled with python itself. If you use this, you will not be relying on third party library to implement your GUI. Since you are wanting to make this available for your collegues, this might be easier to compile with py2exe o...
3
3
0
I have a command-line Python script that works well to convert one sort of file into another given a few parameters and would now like to deploy this to some of my colleagues who may not know what a command line is. I could work for hours trying to determine which Python GUI toolkit is "best", then learning how to do w...
Cookbook GUI interface for a command-line script
0
0
0
4,233
9,928,711
2012-03-29T15:36:00.000
1
0
0
0
python,wxpython
9,931,233
2
false
0
1
Let's say your command line executable is: % compute -flag1 -flag2 datafile outputfile In WxPython you could use check boxes to choose whether flag1 and/or flag2 are used, a file chooser widget for datafile, a text input field for outputfile and 'execute' button. When execute is clicked create a command line in a strin...
1
2
0
This might seem as silly question but I am thinking there might be the simple solution for this problem. I have a python script which does some mathematical calculation which is command-line-based. I don't want to make any major modification to the code which I have right now. What should be my approach now to create a...
Converting existing command-line script to GUI in python
0.099668
0
0
2,037
9,929,170
2012-03-29T16:05:00.000
0
0
0
0
linux,unicode,numpy,python-2.7,ucs
9,993,744
1
true
0
0
I suggest that a quick solution to these sort of complications is that you use the Enthought Python Distribpotion (EPD) on Linux which includes a wide range of extensions. Cheers.
1
0
1
I have installed Numpy using ActivePython and when I try to import numpy module, it is throwing the following error: ImportError: /opt/ActivePython-2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_FromUnicode I am fairly new to python, and I am not sure what to do. I appre...
Numpy needs the ucs2
1.2
0
0
1,398
9,935,224
2012-03-29T23:47:00.000
3
0
0
0
python,user-interface,wxpython
9,935,305
2
true
0
1
Pyqt/pyside/Qt has the newer declarative QML which seems to have a application geared to a kiosk type interface. You can basically design something in Photoshop and use it as your custom UI
1
3
0
I've been toying with wxPython, but it seems mostly geared at 'standard' applications -- things with native looking file menu systems and toolbars and whatnot. My needs are pretty simple. I just need to be able play some mp3s, show some images, and be able to package it down to an .exe and .dmg. Also, being able to pl...
Is there a preferred framework for non-standard, non-native kiosk style GUI applications?
1.2
0
0
835
9,938,238
2012-03-30T06:50:00.000
0
1
0
0
python,signals
9,939,503
1
false
0
0
The Python callback code is not actually called right away in Python. The C code in Python just sets a flag when it gets a signal. It only runs the handler when it returns to the interpreter. If your code path is currently working in an extension module in compiled code the handler won't get run until it finishes. The ...
1
2
0
I am registering a signal for remote debugging: signal.signal(signal.SIGUSR1, lambda x,y: remote_debug(x, y, emp_id)) While normally very fast, log statements show this command (register) sometimes takes 5 to 10 seconds to execute. What is causing this? How can I fix it?
What can make signal.signal block for a long time?
0
0
0
69
9,939,238
2012-03-30T08:13:00.000
2
0
0
0
python,zeromq
28,609,198
3
false
0
0
From the ØMQ guide: From ZeroMQ v3.x, filtering happens at the publisher side when using a connected protocol (tcp:// or ipc://). Using the epgm:// protocol, filtering happens at the subscriber side. In ZeroMQ v2.x, all filtering happened at the subscriber side.
1
2
1
I am trying to implement a broker using zeromq PUB/SUB(python eventlets). zeromq 2.1 does not seem to implement filtering at publisher and all messages are broadcasted to all subscribers which inturn apply filter. Is there some kind of workaround to achieve filtering at publisher. If not how bad is the performance if t...
ZeroMQ PUB/SUB filtering and performance
0.132549
0
0
4,347
9,942,206
2012-03-30T11:39:00.000
0
0
0
0
java,python,django,postgresql,user-activity
9,942,327
5
false
1
0
In your log table you can have various columns, including: user_id (the user that did the action) activity_type (the type of activity, such as view or commented_on) object_id (the actual object that it concerns, such as the Article or Media) object_type (the type of object; this can be used later, in combination with ...
2
0
0
I have a web application build in Django + Python that interact with web services (written in JAVA). Now all the database management part is done by web-services i.e. all CRUD operations to actual database is done by web-services. Now i have to track all User Activities done on my website in some log table. Like If Us...
How to store all user activites in a website..?
0
1
0
2,693
9,942,206
2012-03-30T11:39:00.000
1
0
0
0
java,python,django,postgresql,user-activity
9,942,819
5
true
1
0
So, you have UI <-> Web Services <-> DB Since the web services talk to the DB, and the web services contain the business logic (i.e. I guess you validate stuff there, create your queries and execute them), then the best place to 'log' activities is in the services themselves. IMO, logging PostgreSQL transactions is a d...
2
0
0
I have a web application build in Django + Python that interact with web services (written in JAVA). Now all the database management part is done by web-services i.e. all CRUD operations to actual database is done by web-services. Now i have to track all User Activities done on my website in some log table. Like If Us...
How to store all user activites in a website..?
1.2
1
0
2,693
9,942,423
2012-03-30T11:54:00.000
0
1
0
0
php,python,mysql,request,ip
9,942,581
3
false
0
0
This will not work, as you will always must have your client responding. I suggest using the client (eg. in html using javascript) to make a connection (ping) every minute from your script on the client to your server, and in your cronjobs letting a script run every x minutes to update the clients that didn't within x.
2
0
0
I'm making a server which is controlled by php scripts, i have clients (androidphones) who calls these script to control the server. I'm saving the ip's the php receives to the DB. now i'm looking for a way to check if these ip's are still reachable.. this is what i tried so far: Cron job -> i'm developing with usbwe...
PHP make a request check if client is available via ip
0
0
1
692
9,942,423
2012-03-30T11:54:00.000
0
1
0
0
php,python,mysql,request,ip
9,942,749
3
false
0
0
There is absolutely no point in such checking. You will always have these IPs UP. Just because an android client seldom have a real IP but using Net via some router/proxy. Web is one-way road. To implement a heart-beat feature you have to make your android clients to ping server.
2
0
0
I'm making a server which is controlled by php scripts, i have clients (androidphones) who calls these script to control the server. I'm saving the ip's the php receives to the DB. now i'm looking for a way to check if these ip's are still reachable.. this is what i tried so far: Cron job -> i'm developing with usbwe...
PHP make a request check if client is available via ip
0
0
1
692
9,945,206
2012-03-30T14:45:00.000
1
1
0
0
python,automation,notifications
9,945,337
7
false
1
0
If I understand well, the idea of your program is to do an automated browsing session. So yes, it's possible. It's not important in what the website is programmed (cgi, php etc). All you need is to send data through post/get (like a real browser) and process the return (regexp and so on). Good luck
2
4
0
I am a newborn programmer still programming from the book on my Alt+Tab. One of the first programs I want to create is to help my mom in her work. I need to know if I can use Python to create it. It needs to: Go on-line and log-in with account / pass. Do a search with specific criteria (use the site's search engine) V...
Can web automation be done in Python?
0.028564
0
1
10,966
9,945,206
2012-03-30T14:45:00.000
1
1
0
0
python,automation,notifications
9,945,530
7
false
1
0
I would point out that depending upon what site you are on, there may be a more efficient way (perhaps an exposed web service) than scraping data from the page and working with mechanize/selenium to do what you want. If you are on the web, browser driver tools are the hammers, and they will get the screws in the wood,...
2
4
0
I am a newborn programmer still programming from the book on my Alt+Tab. One of the first programs I want to create is to help my mom in her work. I need to know if I can use Python to create it. It needs to: Go on-line and log-in with account / pass. Do a search with specific criteria (use the site's search engine) V...
Can web automation be done in Python?
0.028564
0
1
10,966
9,946,744
2012-03-30T16:18:00.000
1
1
0
0
python,ssh,paramiko
9,947,158
1
true
0
0
If you don't know where the public key file is located, Paramiko can't help you either - it also needs you to specify where it is. You can of course try the usual places (starting by parsing ~/.ssh/config if available), but you don't need Paramiko for that.
1
0
0
I'm writing a python program to get rsa public key. Is there a way to get it via paramiko or I just read it like plain text and with the assumption from id_rsa.pub?
Can we get public key using Paramiko? Or just read it like plain text?
1.2
0
1
215
9,947,703
2012-03-30T17:28:00.000
1
0
0
0
python,django,web-applications,frameworks,pyramid
9,947,834
2
false
1
0
I believe that at this point you might want to think more about the overall architecture of your application rather than frameworks. For Example Single Tier - Just a simple webapp, using simple file or object storage Two Tier - Webapp + Relational Database. The webapp contains the presentation logic + business logic u...
2
1
0
I'm slightly confused on what is meant by a "web application". I.e. Django positions itself as "a web framework" for the development of "web apps", quite similar to the description of Pyramid. What I'm looking for is a framework for an application that has a browser interface but is very database driven. In short: It'...
Python frameworks: Website/CMS vs application?
0.099668
0
0
443
9,947,703
2012-03-30T17:28:00.000
3
0
0
0
python,django,web-applications,frameworks,pyramid
9,947,817
2
true
1
0
I don't know Pyramid at the time of writing so I'll answer the Django part, though I can imagine the answer to apply to Pyramid as well as the distinction between websites and web application is quite vague. Django is suitable for both websites and web applications: you can create an informative website for your local ...
2
1
0
I'm slightly confused on what is meant by a "web application". I.e. Django positions itself as "a web framework" for the development of "web apps", quite similar to the description of Pyramid. What I'm looking for is a framework for an application that has a browser interface but is very database driven. In short: It'...
Python frameworks: Website/CMS vs application?
1.2
0
0
443
9,949,533
2012-03-30T19:47:00.000
2
0
1
0
python
26,517,982
4
false
0
0
Not an answer exactly, but it should be noted that eval and literal_eval are not the same thing. The ast.literal_eval won't run arbitrary code. That said, I agree with using JSON; I just wanted to point out that eval != literal_eval
3
16
0
I am converting 2 MB of data as a string into a dict. The input is serialized in JSON. Anyways I am currently using ast.literal_eval and I get the dictionary I want, but then when I tried just running eval it seems to run faster, and also returns the same result. Is there any reason to use the ast module or the json mo...
python eval vs ast.literal_eval vs JSON decode
0.099668
0
0
17,888
9,949,533
2012-03-30T19:47:00.000
25
0
1
0
python
9,949,553
4
false
0
0
Yes, there's definitely a reason: eval() is evil. Your code might read untrusted data one day, an this would allow an attacker to run arbitrary code on your machine. You shouldn't use ast.literal_eval() to decode JSON either. It cannot decode every valid JSON string and is not meant to be used for this purpose. Sim...
3
16
0
I am converting 2 MB of data as a string into a dict. The input is serialized in JSON. Anyways I am currently using ast.literal_eval and I get the dictionary I want, but then when I tried just running eval it seems to run faster, and also returns the same result. Is there any reason to use the ast module or the json mo...
python eval vs ast.literal_eval vs JSON decode
1
0
0
17,888
9,949,533
2012-03-30T19:47:00.000
16
0
1
0
python
9,949,575
4
false
0
0
No. Unless you hit one of two scenarios: That's not JSON! Someone puts __import__('os').system('rm -rf /') in the file instead. You are boned. It's JSON, but not the Python-like part! Someone puts true, false, null, or a Unicode escape somewhere in it. Happy birthday.
3
16
0
I am converting 2 MB of data as a string into a dict. The input is serialized in JSON. Anyways I am currently using ast.literal_eval and I get the dictionary I want, but then when I tried just running eval it seems to run faster, and also returns the same result. Is there any reason to use the ast module or the json mo...
python eval vs ast.literal_eval vs JSON decode
1
0
0
17,888
9,950,362
2012-03-30T21:01:00.000
26
0
1
1
python,setuptools,distutils
9,960,426
2
true
0
0
setuptools monkey-patches some parts of distutils when it is imported. When you use easy_install to get a distutils-based project from PyPI, it will create an egg (pip may do that too). To do the same thing locally (i.e. in a directory that’s a code checkout or an unpacked tarball), use this trick: python -c "import ...
1
17
0
I vaguely remember some sort of setuptools wrapper that would generate .egg files from distutils source. Can someone jog my memory?
How do I create Python eggs from distutils source packages?
1.2
0
0
15,618
9,951,216
2012-03-30T22:35:00.000
2
0
0
0
python,django,post
9,951,986
1
true
1
0
urllib2 is the appropriate way to post data if you're looking for python standard library. Django doesn't provide a specific method to do this (as well as it shouldn't). Django goes out of it's way to not simply reinvent tools that already exist in the the standard library (except email...), so you should never reall...
1
1
0
I would appreciate some help here. Google checkout has many ways to send it checkout data. I am using the XML server-to-server. I have everything ready and now I want to throw some xml at google. I have been doing some reading and I know of a couple of ways to do this, one with urllib, another with pyCurl, but I am usi...
Posting data to another Site with Django
1.2
0
1
471
9,952,327
2012-03-31T01:49:00.000
1
1
0
1
eclipse,python-3.x,pydev,generated-code
9,998,578
2
true
1
0
It should be possible to do what you want using an external builder inside Eclipse... Right click project > properties > builders > new > program, then configure the program as python having as a parameter the module to run and receiving as arguments also the ${build_files} variable (if it's a python script, you have ...
1
0
0
I'm developing a system, and I have build a code generator that emits a bunch of classes based on a configuration file. I would like to configure PyDev to invoke the generator for me whenever the configuration file (or the generator source) changes. I know that this is possible "in theory" because e.g., the ANTLR plug...
How do I generate code under Eclipse+PyDev?
1.2
0
0
339
9,952,873
2012-03-31T03:50:00.000
0
1
0
1
python,google-app-engine,google-apps,google-signin,gaeunit
9,953,084
2
false
1
0
Two situations: Local Dev server: login is mocked via a simple web form. You can do a http POST to log in. Production server: login goes through the Google auth infrastructure. No way to mock this. To make this work you'd need to code around it.
1
0
0
I am currently using gaeunit to perform automated test on my google app engine application. I am wondering whether it's possible to simulate the user login action using his/her google account using gaeunit? Thank you very much.
How to simulate Google login using gaeunit
0
0
0
401
9,954,745
2012-03-31T09:33:00.000
1
0
0
0
python,heroku,web2py
14,190,998
3
false
1
0
It may be a problem with the DB setup. By default web2py only supports sqlite or Google App Engine (GAE). It's probably trying to initialize sqlite databases on Heroku's read-only filesystem. Either disable the DB code temporarily to see if this is indeed the case, or configure a connection to a supported database (MyS...
1
4
0
I'm having a lot of trouble with getting web2py to work on Heroku. I can't even get a basic app to work. Whenever I go to my herokuapp page, it says Application Error An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your...
How do I use web2py on Heroku?
0.066568
0
0
1,549
9,955,517
2012-03-31T11:34:00.000
1
0
1
0
java,python,compiler-construction,antlr,semantics
9,955,649
3
false
0
0
ANTLR allows you to specify semantics in terms of actions associated with grammar rules. For simple tasks this may be convenient, but for larger grammars all you usually do is to generate an AST (Abstract Syntax Tree), i.e. a representation of what you parsed that's more convenient to handle from within a program than ...
3
0
0
I am currently using a Python 2.5 sample from the ANTLR website. I'm actually wondering if the grammar already produces semantics as well.If there is none, what can I do or what can I use(tools) for generating semantics for python after parsing it with ANTLR?
Does ANTLR provide semantics
0.066568
0
0
121
9,955,517
2012-03-31T11:34:00.000
2
0
1
0
java,python,compiler-construction,antlr,semantics
9,955,577
3
true
0
0
There's no tool to generate a language's semantics, that's something you have to implement yourself. Now that you have parsed Python code, you can do some necessary processing first, output it as Python code again and use an existing implementation of the Python language for execution.
3
0
0
I am currently using a Python 2.5 sample from the ANTLR website. I'm actually wondering if the grammar already produces semantics as well.If there is none, what can I do or what can I use(tools) for generating semantics for python after parsing it with ANTLR?
Does ANTLR provide semantics
1.2
0
0
121
9,955,517
2012-03-31T11:34:00.000
1
0
1
0
java,python,compiler-construction,antlr,semantics
9,955,542
3
false
0
0
ANTLR handles the parsing, but not the semantics; it's a parser generation tool, after all. If you added semantics, you'd have a full python implementation (modulo fleshing out the libraries).
3
0
0
I am currently using a Python 2.5 sample from the ANTLR website. I'm actually wondering if the grammar already produces semantics as well.If there is none, what can I do or what can I use(tools) for generating semantics for python after parsing it with ANTLR?
Does ANTLR provide semantics
0.066568
0
0
121
9,956,847
2012-03-31T14:39:00.000
1
0
0
0
python,go,swig
9,957,173
1
false
0
0
One of the Go compilers produces C (cgo). I have never looked at it, but there may be a path to calling those functions from Python using SWIG. Also their is Cython, which converts a form-of-Python to C, so that may provide another more direct path by combining the two with C as the glue, and without SWIG. I was told...
1
2
0
Can SWIG be used to call Go functions from Python? The Go examples I have seen in SWIG all seem to call C/C++ functions from Go.
SWIG: Calling Go from Python
0.197375
0
0
754
9,957,985
2012-03-31T17:14:00.000
1
0
1
0
python,multithreading,communication,pipe
9,960,643
2
false
0
0
I think you should take a look at the "candygram" message passing extension.
2
1
0
Thanks for your attention I am writing a simulation engine in python using "threading" module in python. One of the things that my simulator has to do is to be able to do all-to-all communication. Suppose there are 'n' threads (All n-threads are not instances of the same class). So for example I have 3 classes of threa...
All-to-All thread communication in Python
0.099668
0
0
350
9,957,985
2012-03-31T17:14:00.000
1
0
1
0
python,multithreading,communication,pipe
9,960,695
2
true
0
0
I think your solution of a broadcast Queue, and EventBus thread is the most common pattern. Queue is part of standard library, and a thread that consumes singleton queue and broadcasts to registered consumers is trivial to implement. Alternatively you could link those threads to form a cycle and pass message to the suc...
2
1
0
Thanks for your attention I am writing a simulation engine in python using "threading" module in python. One of the things that my simulator has to do is to be able to do all-to-all communication. Suppose there are 'n' threads (All n-threads are not instances of the same class). So for example I have 3 classes of threa...
All-to-All thread communication in Python
1.2
0
0
350