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
4,961,951
2011-02-10T19:56:00.000
2
0
0
0
python,django
4,961,987
3
false
1
0
yes, it can be via python manage.py shell, it's also useful to look into the django-extensions plugin for extra functionality such as shell_plus which provides all of the database interactions for the shell environment as welll.
2
4
0
In django, can you load a django app into the python interpreter like in rails? i.e. does django have: irb ?
In django, can you load a django app into the python interpreter like in rails?
0.132549
0
0
3,150
4,962,022
2011-02-10T20:02:00.000
0
0
1
0
python,multithreading
4,962,704
2
false
1
0
You can do this using any of: the thread module (if your task is a function) the threading module (if you want to write your task as a subclass of threading.Thread) the multiprocessing module (which uses a similar interface to threading) All of these are available in the Python standard library (2.6 and later), and y...
1
2
0
Say I have a simple function, it connects to a database (or a queue), gets a url that hasn't been visited, and then fetches the HTML at the given URL. Now this process is serial, i.e. it will only fetch the html from a given url one at a time, how can I make this faster by doing this in a group of threads?
In python, is it easy to call a function multiple times using threads?
0
0
0
1,238
4,962,202
2011-02-10T20:21:00.000
1
0
1
0
python,dijkstra
4,962,223
5
false
0
0
Encapsulate that information in a Python object and you should be fine.
2
0
1
I need to implement Dijkstra's Algorithm in Python. However, I have to use a 2D array to hold three pieces of information - predecessor, length and unvisited/visited. I know in C a Struct can be used, though I am stuck on how I can do a similar thing in Python, I am told it's possible but I have no idea to be honest
Python - Dijkstra's Algorithm
0.039979
0
0
5,571
4,962,202
2011-02-10T20:21:00.000
0
0
1
0
python,dijkstra
4,962,291
5
false
0
0
Python is object oriented language. So think of it like moving from Structs in C to Classes of C++. You can use the same class structure in Python as well.
2
0
1
I need to implement Dijkstra's Algorithm in Python. However, I have to use a 2D array to hold three pieces of information - predecessor, length and unvisited/visited. I know in C a Struct can be used, though I am stuck on how I can do a similar thing in Python, I am told it's possible but I have no idea to be honest
Python - Dijkstra's Algorithm
0
0
0
5,571
4,965,262
2011-02-11T03:11:00.000
1
0
1
0
python,tcp,ctypes,pcap
4,965,475
3
false
0
0
Im a big fan of dictionaries for things like this because You can do things like thisPacket['srcPort'] You can then just shove your packets into something like MongoDB and query them later in cool ways (i.e. give me every packet that came in on port 80 and was from some subnet with a particular flag set)
3
3
0
I am disassembling TCP/IP packet into string format. What is the best way to structure and store it? Should I store it as a ctypes struct, python class, dictionary, or some other way? What are the pros and cons of each method?
Python. Class, Struct, Dictionary?
0.066568
0
0
621
4,965,262
2011-02-11T03:11:00.000
8
0
1
0
python,tcp,ctypes,pcap
4,965,280
3
true
0
0
You should use a class. It gives you the most flexibility to grow in the future. Dictionaries have more verbose syntax to access their contents, and don't allow you to add methods if you need them. ctypes is really for accessing structures packed for use in other APIs. If your data is going to stay in Python, the onl...
3
3
0
I am disassembling TCP/IP packet into string format. What is the best way to structure and store it? Should I store it as a ctypes struct, python class, dictionary, or some other way? What are the pros and cons of each method?
Python. Class, Struct, Dictionary?
1.2
0
0
621
4,965,262
2011-02-11T03:11:00.000
1
0
1
0
python,tcp,ctypes,pcap
4,968,410
3
false
0
0
I'm a big fan of detailed requirements. Lacking those, I'd go with a named tuple. You can do things like thisPacket.srcPort. You can then just shove your packets into something like MongoDB and query them later in cool ways
3
3
0
I am disassembling TCP/IP packet into string format. What is the best way to structure and store it? Should I store it as a ctypes struct, python class, dictionary, or some other way? What are the pros and cons of each method?
Python. Class, Struct, Dictionary?
0.066568
0
0
621
4,966,258
2011-02-11T06:34:00.000
2
0
1
0
python
4,966,720
1
true
0
0
It won't be /usr/bin/pip. pip is installed within your virtualenv. It'll be in the bin directory within the virtualenv folder, which is added to the front of your path when you activate the environment.
1
1
0
The documentation says that if I already have virtualenv installed, then pip is available by default on my system. However, there exists /usr/bin/virtualenv but no /usr/bin/pip. What am I doing wrong ?
Why is pip unavailable when I install virtualenv?
1.2
0
0
106
4,966,509
2011-02-11T07:16:00.000
0
1
1
0
python,attributes,introspection,metaclass
4,967,128
4
false
0
0
To create attributes during runtime, just add them in self.__dict__['foo'] = 'I'm foo' in the class code.
1
0
0
I apologize for not giving this question a better title; the reason that I am posting it is that I don't even have the correct terminology to know what I am looking for. I have defined a class with an attribute 'spam': def SpamClass(object): def __init__(self, arg): self.spam = arg def __str__(self): ...
creating Python classes with arbitrarily substituted attribute name
0
0
0
722
4,966,856
2011-02-11T08:12:00.000
2
1
0
1
python,encoding,ftp,twisted
5,210,013
2
false
0
0
FTP ignores encodings; as long as a filename does not contain a '\0' (null character) and '/' (slash) separates directories, it happily accepts anything. Do your own decoding and encoding of the filenames. It is quite probable that the encoding used in your example is "cp1252", which is the “Windows Western” or somethi...
1
1
0
Hi I use twisted library to connect to FTP server but I have problem with filename encoding. I receive 'Illusion-N\xf3z.txt' so its not unicode. Is there any FTP command to force specific encoding? Thanks in advance! MK
FTP filename encoding
0.197375
0
0
3,170
4,967,103
2011-02-11T08:49:00.000
44
0
0
0
python,beautifulsoup,lxml
4,967,121
4
true
1
0
The simple answer, imo, is that if you trust your source to be well-formed, go with the lxml solution. Otherwise, BeautifulSoup all the way. Edit: This answer is three years old now; it's worth noting, as Jonathan Vanasco does in the comments, that BeautifulSoup4 now supports using lxml as the internal parser, so you...
2
40
0
I am working on a project that will involve parsing HTML. After searching around, I found two probable options: BeautifulSoup and lxml.html Is there any reason to prefer one over the other? I have used lxml for XML some time back and I feel I will be more comfortable with it, however BeautifulSoup seems to be much com...
BeautifulSoup and lxml.html - what to prefer?
1.2
0
1
44,819
4,967,103
2011-02-11T08:49:00.000
0
0
0
0
python,beautifulsoup,lxml
4,968,489
4
false
1
0
lxml's great. But parsing your input as html is useful only if the dom structure actually helps you find what you're looking for. Can you use ordinary string functions or regexes? For a lot of html parsing tasks, treating your input as a string rather than an html document is, counterintuitively, way easier.
2
40
0
I am working on a project that will involve parsing HTML. After searching around, I found two probable options: BeautifulSoup and lxml.html Is there any reason to prefer one over the other? I have used lxml for XML some time back and I feel I will be more comfortable with it, however BeautifulSoup seems to be much com...
BeautifulSoup and lxml.html - what to prefer?
0
0
1
44,819
4,967,179
2011-02-11T09:01:00.000
0
0
1
0
python,pyqt
4,968,555
2
false
0
1
If the field's an ordinary attribute called text and your Design instance is called design, you can access (read/write) it from anywhere as design.text.
2
0
0
I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!! Edit: I have 2 Classes: FeatureImport...
Python Referencing
0
0
0
179
4,967,179
2011-02-11T09:01:00.000
0
0
1
0
python,pyqt
17,676,533
2
false
0
1
1. if object of FeatureImportCommonWidget class is created inside of MetaDataBrowser class, you can access your text field anywhere inside MetaDataBrowser class like this: FeatureImportCommonWidgetObjectName.placesGroupBox.text() 2 if object of FeatureImportCommonWidget class is created before MetaDataBrowser class,...
2
0
0
I want to read data from a text field. The name of the text field is not defined of found in the other class with methods of reading the text field. The textfield is defined in the Design class. now how do I access this field from another class, so I can read data from it. Thanks!! Edit: I have 2 Classes: FeatureImport...
Python Referencing
0
0
0
179
4,967,307
2011-02-11T09:15:00.000
0
0
0
0
python,user-interface,wxpython,wxtextctrl,wx.textctrl
5,696,978
1
false
0
1
You can bind to a button if you like, you could use a bitmapbutton instead, or bind mouse events to your static bitmap. The wxPython demo has examples for all of these methods. With regards to the "StaticLine kinda thing", are you trying to resize the richtextctrl on demand? You might want to look at the ExpandoTextCtr...
1
1
0
Just wondering whether there is any provision/method to bind clicks on images/(or include a button) to result into some events. Also is there any kind of way to draw a StaticLine kind of thing in a RichTextCtrl in wxPython.
wxpython RichtextCtrl event bindings on buttons/images
0
0
0
239
4,968,235
2011-02-11T11:00:00.000
5
1
1
0
python,c,compilation
4,968,256
4
true
0
0
Python (at least the "standard" CPython implementation) never actually compiles to native machine code; it compiles to bytecode which is then interpreted. So a C function which is in fact compiled to machine code will run faster; the question is whether it will make a relevant difference. So what's the actual problem y...
3
1
0
Is there a difference (in terms of execution time) between implementing a function in Python and implementing it in C and then calling it from Python? If so, why?
Implementing a function in Python vs C
1.2
0
0
330
4,968,235
2011-02-11T11:00:00.000
0
1
1
0
python,c,compilation
4,968,264
4
false
0
0
Typically, a function written in C will be substantially faster that the Python equivalent. It is also much more difficult to integrate, since it involves: compiling C code that #includes the Python headers and exposes appropriate wrapper code so that it is callable from Python; linking against the correct Python libr...
3
1
0
Is there a difference (in terms of execution time) between implementing a function in Python and implementing it in C and then calling it from Python? If so, why?
Implementing a function in Python vs C
0
0
0
330
4,968,235
2011-02-11T11:00:00.000
1
1
1
0
python,c,compilation
4,968,320
4
false
0
0
If I understand and restate your question properly, you are asking, if wrapping python over a c executable be anyway faster than a pure python module itself? The answer to it is, it depends upon the executable and the kind of task you are performing. There are a set of modules in Python that are written using Python ...
3
1
0
Is there a difference (in terms of execution time) between implementing a function in Python and implementing it in C and then calling it from Python? If so, why?
Implementing a function in Python vs C
0.049958
0
0
330
4,968,837
2011-02-11T12:11:00.000
2
0
0
0
python,database-design,postgresql,psycopg2
4,969,077
7
false
0
0
Considering the process was fairly efficient before and only now when the dataset grew up it slowed down my guess is it's the indexes. You may try dropping indexes on the table before the import and recreating them after it's done. That should speed things up.
2
4
0
I am in the middle of a project involving trying to grab numerous pieces of information out of 70GB worth of xml documents and loading it into a relational database (in this case postgres) I am currently using python scripts and psycopg2 to do this inserts and whatnot. I have found that as the number of rows in the som...
Postgres Performance Tips Loading in billions of rows
0.057081
1
0
4,138
4,968,837
2011-02-11T12:11:00.000
0
0
0
0
python,database-design,postgresql,psycopg2
4,968,869
7
false
0
0
I'd look at the rollback logs. They've got to be getting pretty big if you're doing this in one transaction. If that's the case, perhaps you can try committing a smaller transaction batch size. Chunk it into smaller blocks of records (1K, 10K, 100K, etc.) and see if that helps.
2
4
0
I am in the middle of a project involving trying to grab numerous pieces of information out of 70GB worth of xml documents and loading it into a relational database (in this case postgres) I am currently using python scripts and psycopg2 to do this inserts and whatnot. I have found that as the number of rows in the som...
Postgres Performance Tips Loading in billions of rows
0
1
0
4,138
4,970,489
2011-02-11T15:01:00.000
1
0
0
0
python,django,apache,debugging,importerror
11,999,402
4
false
1
0
This can also happen if you do not have both a 500.html and 404.html template present. Just the 500 isn't good enough, even for URIs that won't produce a 404!
2
16
0
Using the development server, it works with debug=True or False. In production, everything works if debug=True, but if debug=False, I get a 500 error and the apache logs end with an import error: "ImportError: cannot import name Project". Nothing in the import does anything conditional on debug - the only code that doe...
What could cause a Django error when debug=False that isn't there when debug=True
0.049958
0
0
9,930
4,970,489
2011-02-11T15:01:00.000
7
0
0
0
python,django,apache,debugging,importerror
4,975,210
4
true
1
0
This happens if you have a circular import in one of your files. Check and see if you are importing something from Project and then importing something in Project from the original file that originally imported Project. I ran into this same problem recently, and rearranging some of my imports helped fix the problem.
2
16
0
Using the development server, it works with debug=True or False. In production, everything works if debug=True, but if debug=False, I get a 500 error and the apache logs end with an import error: "ImportError: cannot import name Project". Nothing in the import does anything conditional on debug - the only code that doe...
What could cause a Django error when debug=False that isn't there when debug=True
1.2
0
0
9,930
4,970,580
2011-02-11T15:08:00.000
3
0
1
0
c++,python,cuda,pycuda
4,971,872
4
false
0
0
If the rest of your pipeline is in Python, and you're using Numpy already to speed things up, pyCUDA is a good complement to accelerate expensive operations. However, depending on the size of your images and your program flow, you might not get too much of a speedup using pyCUDA. There is latency involved in passing ...
3
4
0
I am in a project to process an image using CUDA. The project is simply an addition or subtraction of the image. May I ask your professional opinion, which is best and what would be the advantages and disadvantages of those two? I appreciate everyone's opinions and/or suggestions since this project is very important to...
processing an image using CUDA implementation, python (pycuda) or C++?
0.148885
0
0
2,620
4,970,580
2011-02-11T15:08:00.000
0
0
1
0
c++,python,cuda,pycuda
4,995,664
4
false
0
0
Alex's answer is right. The amount of time consumed in the wrapper is minimal. Note that PyCUDA has some nice metaprogramming constructs for generating kernels which might be useful. If all you're doing is adding or subtracting elements of an image, you probably shouldn't use CUDA for this at all. The amount of time it...
3
4
0
I am in a project to process an image using CUDA. The project is simply an addition or subtraction of the image. May I ask your professional opinion, which is best and what would be the advantages and disadvantages of those two? I appreciate everyone's opinions and/or suggestions since this project is very important to...
processing an image using CUDA implementation, python (pycuda) or C++?
0
0
0
2,620
4,970,580
2011-02-11T15:08:00.000
6
0
1
0
c++,python,cuda,pycuda
4,970,926
4
true
0
0
General answer: It doesn't matter. Use the language you're more comfortable with. Keep in mind, however, that pycuda is only a wrapper around the CUDA C interface, so it may not always be up-to-date, also it adds another potential source of bugs, … Python is great at rapid prototyping, so I'd personally go for Python...
3
4
0
I am in a project to process an image using CUDA. The project is simply an addition or subtraction of the image. May I ask your professional opinion, which is best and what would be the advantages and disadvantages of those two? I appreciate everyone's opinions and/or suggestions since this project is very important to...
processing an image using CUDA implementation, python (pycuda) or C++?
1.2
0
0
2,620
4,971,066
2011-02-11T15:49:00.000
3
1
1
0
python,import,compiler-optimization,pyc
4,971,101
2
true
0
0
One way to "convert" them is simply renaming them. Of course they won't be optimised, but at least you can use them.
1
2
0
I have to use some legacy .pyc modules (with no source) but I'm also forced to use python in optimized mode (python -O): so, when trying to import those modules, I get an import error (as python looks for .py or .pyo files). Is there a way to make it use pyc modules as well? Or to convert .pyc into .pyo?
Make Python import .pyc when run in optimized mode
1.2
0
0
666
4,972,079
2011-02-11T17:23:00.000
2
0
1
0
python,hdf5,pytables
38,577,661
5
false
0
0
Do the following steps: brew tap homebrew/science brew install hdf5 see where hdf5 is installed, it shows at the end of second step export HDF5_DIR=/usr/local/Cellar/hdf5/1.8.16_1/ (Depending on the location that is installed on your computer) This one worked for me on MAC :-)
4
7
1
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
Unable to reinstall PyTables for Python 2.7
0.07983
0
0
6,903
4,972,079
2011-02-11T17:23:00.000
2
0
1
0
python,hdf5,pytables
29,871,380
5
false
0
0
I had to install libhdf5-8 and libhdf5-serial-dev first. Then, for me, the command on Ubuntu was: export HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/
4
7
1
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
Unable to reinstall PyTables for Python 2.7
0.07983
0
0
6,903
4,972,079
2011-02-11T17:23:00.000
4
0
1
0
python,hdf5,pytables
13,868,984
5
false
0
0
My HDF5 was installed with homebrew, so setting the environment variable as follows worked for me: HDF5_DIR=/usr/local/Cellar/hdf5/1.8.9
4
7
1
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
Unable to reinstall PyTables for Python 2.7
0.158649
0
0
6,903
4,972,079
2011-02-11T17:23:00.000
4
0
1
0
python,hdf5,pytables
4,992,253
5
true
0
0
The hdf5 command line option was not stated correctly ( --hdf5='/usr/local/hdf5' ). Sprinkling print statements in the setup.py made it easier to pin down the problem.
4
7
1
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
Unable to reinstall PyTables for Python 2.7
1.2
0
0
6,903
4,972,429
2011-02-11T18:01:00.000
4
0
0
0
python,pyqt
4,974,374
2
true
0
1
QWidget.saveGeometry saves the geometry of an widget. QMainWindow.saveState saves the window's toolbars and dockwidgets. To save other things you can use pickle.
1
3
0
Is there a fast python way to save all data in all widgets to file before app is close? And of course read it and restore after app is re-run?
PyQt 4 - save all data in window to file on app close
1.2
0
0
2,185
4,972,688
2011-02-11T18:31:00.000
1
0
1
0
python,function,arguments
4,972,706
4
false
0
0
just provide the arguments you want and the others will get their default values: fun(arg4=10)
1
1
0
I have this function: def fun(arg1=1, arg2=2, arg3=3, arg4=4) Now if I want to call fun with arg1=8 then I will do this: fun(8) and if I want to call it with arg1 = 8 and arg2 = 9 then I think this will do (correct me if I am wrong): fun(8,9) # LINE2 How to call fun if I want to call it with the fourth argument = 10, ...
Passing Argument to Python's Function
0.049958
0
0
343
4,973,316
2011-02-11T19:46:00.000
1
0
0
0
python,postgresql,triggers,materialized-views
4,973,738
1
false
1
0
The "best" solution according to the criteria you've laid out so far would just be to insert into the production table. ...unless there's actually something extremely relevant you're not telling us
1
0
0
I am trying to find the best solution (perfomance/easy code) for the following situation: Considering a database system with two tables, A (production table) and A'(cache table): Future rows are added first into A' table in order to not disturb the production one. When a timer says go (at midnight, for example) rows f...
Materialize data from cache table to production table [PostgreSQL]
0.197375
1
0
611
4,974,140
2011-02-11T21:16:00.000
-4
1
0
0
python,signals
4,974,239
4
false
0
0
I believe it is not possible - the OS just does not pass this information to the target process.
1
8
0
Is it possible to find out the process id of the process which has caused some signal. In my scenario, I have multiple children of a process running, and I want to know which one of them sent the signal.
Get pid of the process which has triggered some signal
-1
0
0
4,214
4,974,544
2011-02-11T22:02:00.000
5
0
0
0
python,django,django-templates,stylesheet
4,974,601
4
false
1
0
Look at the django.contrib.admin application. Parallel the way the admin site works. Create a media directory. Create media/img, media/jss, media/css, media/whatever directories In each of these, you'll have your app's specific stuff. media/img/app1, media/jss/app1 so that each of your Django apps can have specific ...
1
1
0
I am looking for a simple way to organize stylesheets and scripts in Django. I am relatively new to the framework and language of python. I'm coming from a PHP background. In the world of PHP / Zend there are functions that are implemented with the view/layout object. By including a single line inside your head tag ...
Python / Django - Organizing Stylesheets and Scripts
0.244919
0
0
1,218
4,975,028
2011-02-11T23:18:00.000
0
0
0
0
python,twisted,wsgi
5,240,896
1
false
1
0
It is extremely unlikely that trying to do this is going to be worth the effort. paster serve has it's own event loop, threadpool, etc. and Twisted apps expect something quite different. You could try writing your own paster subcommand, but you're probably better off writing a .tac file that serves both apps for use w...
1
1
0
I'm working on a project that has two parts: A WSGI-enabled web app written with pylons and served with python-paste A python-twisted application that has nothing to do with HTTP or WSGI. I'd like to keep the configuration for both apps in the same configuration file. I'd also like to use paste serve to launch both t...
Use paste.deploy to serve a twisted application
0
0
0
306
4,978,142
2011-02-12T12:48:00.000
4
0
1
0
python,windows
4,978,471
5
false
0
0
Commercial solutions often have (usb) devices with a microchip that can do public-key cryptography. This rules out faking the device. Example: program generates a challenge-code, encrypts it with public key -> device decrypts it with it's secret key (stored in microchip) and gives the challenge-code back for verificat...
2
6
0
Let me explain what it's like. I want a program that's installed in a PC but you can't run it unless you insert a USB drive where some part of the program is stored. So the point is, the program is useless if you don't have both PC and USB drive. Since I want it to run in Windows, what kind of language shall I use apar...
How can I make a program that runs only when I insert the USB drive?
0.158649
0
0
4,485
4,978,142
2011-02-12T12:48:00.000
4
0
1
0
python,windows
4,978,406
5
false
0
0
If you're trying to do this for copy protection or license management, there are commercial solutions for this that are very difficult (but still not impossible) to beat. For you to develop something that's robust will end up costing you more than it would cost to license a solution from Pace or Aladdin or any of their...
2
6
0
Let me explain what it's like. I want a program that's installed in a PC but you can't run it unless you insert a USB drive where some part of the program is stored. So the point is, the program is useless if you don't have both PC and USB drive. Since I want it to run in Windows, what kind of language shall I use apar...
How can I make a program that runs only when I insert the USB drive?
0.158649
0
0
4,485
4,979,005
2011-02-12T16:01:00.000
0
0
0
0
python,html
4,979,028
2
false
1
0
Images are not shown "on your website", they are shown "in your users' browsers". The browser needs to request the animation information from your website, which needs to request it from (wherever it comes from). Ideally, the website will cache the data so that 20 browser requests result in just one website request. H...
1
0
0
good day stackoverflow! im not sure if any of you has tried this but basically i want to accomplish something like this: - a python program continuously sends data to my website - using that data computations will be made and images on the website are animate so my questions are: 1. what method should i use to communic...
receive data from a python program to animate an object on a webpage
0
0
1
614
4,979,392
2011-02-12T17:14:00.000
1
0
0
0
python,web2py
5,443,158
2
false
1
0
you can call db.commit() and db.rollback() pretty much everywhere. If you do not and the action does not raise an exception, it commits before returning a response to the client. If it raises an exception and it is not explicitly caught, it rollsback.
1
2
0
When exactly the database transaction is being commited? Is it for example at the end of every response generation? To explain the question: I need to develop a bit more sophisticated application where I have to control DB transactions less or more manually. Especialy I have to be able to design a set of forms with som...
web2py and DB transactions
0.099668
1
0
1,224
4,979,423
2011-02-12T17:20:00.000
0
0
1
0
c#,python,ruby,expression,parser-generator
4,979,580
5
false
0
0
Well ... you need a language. You have C#, VB.Net, IronPython, IronRuby, and others. Simple replace the open variables using regex (maybe you even know them ahead and just need a string.Replace) and then compile the script using CodeDOM (for C# or VB.Net) or use the DLR (IronPython, IronRuby). You can simply add the va...
1
1
0
We have semi-complicated expressions in the format: "25 + [Variable1] > [Variable2]" We need an expression evaluator to parse the expression and use a callback to ask for the variable values and work out the overall result of the expression. It has to be a callback as there are thousands of variables. We need the usual...
Expression evaluator for C#/Python/Ruby
0
0
0
1,969
4,980,657
2011-02-12T21:10:00.000
1
0
0
0
java,javascript,python
4,981,088
2
false
1
0
If you go for JavaScript I'm assuming it would run in a browser and therefore to communicate with anything else it would make HTTP requests (e.g. POST or GET URLs), so the client/server arrangement is unavoidable. Therefore you would need to turn your Python code into a web application, using something like CherryPy to...
1
0
0
I have a python script which does various number-crunching jobs and now need to put a graphical front-end on it (a molecular editor in which a user draws a compound to pass to the script) to allow others in the lab to use it more easily. The available editors are Java applets, standalone Java or written in JavaScript....
How to pass data from Java applet to client side python script?
0.099668
0
0
969
4,980,756
2011-02-12T21:30:00.000
2
1
0
0
python,web,web-frameworks,web-scripting
4,980,831
4
true
1
0
The Python web frameworks have nothing to do with GUIs, and can all be used via the terminal. The benefits of a framework, as you say, are all to do with making your life easier by supplying the components you need to build a website: the main ones are database interaction through an ORM, a templating system, and URL ...
2
1
0
I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know). I've noticed that there are a lot of these things called "frameworks", suc...
I'm learning python and am interested in using it for web-scripting. What frameworkes are out there and do I need one?
1.2
0
0
553
4,980,756
2011-02-12T21:30:00.000
0
1
0
0
python,web,web-frameworks,web-scripting
4,981,185
4
false
1
0
Personnally, I don't use any framework, I write either from scratch on BaseHTTPServer, or using WSGI (with mod_wsgi). It is a bit long to write the skeleton, but I think it is faster (I mean at runtime), there is less constraints, and there is lesser to learn.
2
1
0
I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know). I've noticed that there are a lot of these things called "frameworks", suc...
I'm learning python and am interested in using it for web-scripting. What frameworkes are out there and do I need one?
0
0
0
553
4,981,444
2011-02-12T23:51:00.000
0
1
0
0
python,redirect
4,981,494
6
false
0
0
I recommend you using the logging module and logging.handlers... stream, output files, etc..
3
0
0
I want my program by default to stdout, but give the option of writing it to a file. Should I create my own print function and call that testing that there is an output file or is there a better way? That seems inefficient to me, but every way I can think of calls an additional if test for every print call. I know this...
What's the best way to handle output redirection?
0
0
0
222
4,981,444
2011-02-12T23:51:00.000
2
1
0
0
python,redirect
4,981,549
6
true
0
0
Write to a file object, and when the program starts either have that object point to sys.stdout or to a file specified by the user. Mark Byers' answer is more unix-like, where most command line tools just use stdin and stdout and let the user do redirection as they see fit.
3
0
0
I want my program by default to stdout, but give the option of writing it to a file. Should I create my own print function and call that testing that there is an output file or is there a better way? That seems inefficient to me, but every way I can think of calls an additional if test for every print call. I know this...
What's the best way to handle output redirection?
1.2
0
0
222
4,981,444
2011-02-12T23:51:00.000
-1
1
0
0
python,redirect
4,981,465
6
false
0
0
My reaction would be to output to a temp file, then either dump that to stdio, or move it to where they requested.
3
0
0
I want my program by default to stdout, but give the option of writing it to a file. Should I create my own print function and call that testing that there is an output file or is there a better way? That seems inefficient to me, but every way I can think of calls an additional if test for every print call. I know this...
What's the best way to handle output redirection?
-0.033321
0
0
222
4,981,963
2011-02-13T01:59:00.000
2
0
1
0
python,cpython
4,981,983
3
false
0
0
The __builtin__ module is built-in, there is no Python source for it. It's coded in C and included as part of the Python interpreter executable.
1
5
0
I want to get the path and source code of the __builtin__ module, where can I get it?
Where is the __builtin__ module in CPython
0.132549
0
0
462
4,981,977
2011-02-13T02:05:00.000
-3
0
0
0
python,regex,encoding,urllib
4,981,998
7
false
0
0
after you make a request req = urllib.request.urlopen(...) you have to read the request by calling html_string = req.read() that will give you the string response that you can then parse the way you want.
1
65
0
I'm trying to open a webpage using urllib.request.urlopen() then search it with regular expressions, but that gives the following error: TypeError: can't use a string pattern on a bytes-like object I understand why, urllib.request.urlopen() returns a bytestream, so re doesn't know the encoding to use. What am I suppo...
How to handle response encoding from urllib.request.urlopen() , to avoid TypeError: can't use a string pattern on a bytes-like object
-0.085505
0
1
110,274
4,982,455
2011-02-13T04:39:00.000
1
0
0
1
python,ruby,parsing,lexical-analysis,guile
4,992,038
3
false
0
0
NL text tends have to lots of ambiguity. If you want to parse natural langauge, I don't think any of the classic compiler-type parser generators (LALR, LL [including ANTLR]) will help you much, and compiler type parser generators typically don't handle this at all. A GLR parser, which does handle ambiguity, may be of...
1
5
0
I'm looking for lexical analysis and parser-generating utilities that are not Flex or Bison. Requirements: Parser is specified using a context-free LL(*) or GLR grammar. I would also consider PEGs. Integrates tightly with a programming language that could be used for both scripting and application development. Languag...
Lexing and Parsing Utilities
0.066568
0
0
1,406
4,982,459
2011-02-13T04:41:00.000
2
0
0
0
python,django
4,982,462
1
true
1
0
That depends on your motivation. If this is an exercise in sharpening yourself then I suggest reinventing it. Mainly because you learn so much in the process. If the main goal is just to have the functionality then use the django-admin and bolt on whatever you need that it lacks.
1
1
0
This may seem quite a weird question but I'm quite confused right now and don't know what to do. I'm working on an intranet web app using django. Soon I found that almost all features I need are done in django-admin, like adding and editing entries, view and filter items in a list view and so on. The missing parts can ...
I found that I'm trying to write an web app behaves exactly like the django admin. What should I do?
1.2
0
0
86
4,983,203
2011-02-13T08:29:00.000
4
0
0
0
python,parsing,python-3.x,xml.etree
4,983,230
3
false
1
0
The mismatched tag errors are likely caused by mismatched tags. Browsers are famous for accepting sloppy html, and have made it easy for web page coders to write badly formed html, so there's a lot of it. THere's no reason to believe that creagslist should be immune to bad web page designers. You need to use a gramm...
1
4
0
I keep getting mismatched tag errors all over the place. I'm not sure why exactly, it's the text on craigslist homepage which looks fine to me, but I haven't skimmed it thoroughly enough. Is there perhaps something more forgiving I could use or is this my best bet for html parsing with the standard library?
Need help parsing html in python3, not well formed enough for xml.etree.ElementTree
0.26052
0
1
1,545
4,983,715
2011-02-13T10:52:00.000
12
1
0
0
python,intellij-idea
4,984,030
1
true
0
0
See Settings | File Types, verify that .py extension is associated with Python file type.
1
5
0
I have some problems whith IntelliJ IDEA Python plugin. I've got a Java project with a few modules. And I want to add one module for Python tools-scripts which I use to generate some files. I downloaded and installed Python plugin (version 2.6.6.) for my IDEA (10.0.2 Ultimate). Then I added Python SDK to the project a...
IntelliJ IDEA: Python plugin does not highlight Python code
1.2
0
0
6,090
4,984,124
2011-02-13T12:27:00.000
0
1
1
1
python,path,interpreter
4,984,297
2
false
0
0
If you are having problems with PATH in windows, set the one you want to use at the start of the path variable. Plus, you might want to use User variables instead of system ones. But I don't know if that answers your question because you didn't really ask anything.
1
0
0
Many applications include a python interpreter, so now when I try to run a program, Subversion's 2.5 interpreter is used to execute it. I've already changed environment path order, putting subversion's last. Now when I run python from command line, the 2.7 is run, but when I pass the script's filename, version 2.5 seem...
Python interpreter path search order on windows
0
0
0
453
4,984,549
2011-02-13T14:02:00.000
1
0
1
1
python,subprocess,stdout,stderr
4,984,598
2
false
0
0
You can merge them passing subprocess.STDOUT as the stderr argument for subprocess.Popen, but I don't know if they will be formatted with time and source.
1
5
0
say I'm running an exe from a python script using: subprocess.call(cmdArgs,stdout=outf, stderr=errf) when outf and errf are file descriptors of text files. is there any way I can generate on top of it a merged and synced text file of both stdout and stderr? it should be formatted with time and source(our/err). thanks
Merge and sync stdout and stderr?
0.099668
0
0
3,540
4,984,849
2011-02-13T15:04:00.000
7
0
1
0
python
4,984,934
3
false
0
0
It's a standard issue with garbage collection. It's not about memory leaks, but about the circular references themselves, and about other kinds of resources managed by those objects that may need cleanup. The references create a dependency - you can't delete the referrer until all objects it references are deleted, bec...
1
5
0
Will it cause memory leak if they cannot be cleaned by GC?
Why circular referenced objects with __del__ defined are uncollectable in Python?
1
0
0
364
4,986,467
2011-02-13T19:50:00.000
1
0
1
1
python,transactions,pickle,undo
4,986,678
2
true
0
0
Well, as you mentioned the data design is loosely coupled, so you I don't think you need to pickle it if it's in memory. Just take a copy of all the relevant variables, and the transaction.abort() would just copy them back, and transaction.commit() would then just remove the copy of the data. There are issues, but none...
2
1
0
A user can perform an action, which may trigger dependent actions (which themselves may have dependent actions) and I want to be able to cancel the whole thing if the user cancels a dependent action. The typical way I've seen this done is some variant of an undo stack and each action will need to know how to undo itsel...
Using pickle for in-memory "transaction"?
1.2
0
0
310
4,986,467
2011-02-13T19:50:00.000
1
0
1
1
python,transactions,pickle,undo
4,986,707
2
false
0
0
You can use pickle to store your state if all elements of state are serializable (usually they are). The only reasons for not doing so: if you have to store pointers to any objects that are not saved in state, you will have problems with these pointers after performing undo operation. this method could be expens...
2
1
0
A user can perform an action, which may trigger dependent actions (which themselves may have dependent actions) and I want to be able to cancel the whole thing if the user cancels a dependent action. The typical way I've seen this done is some variant of an undo stack and each action will need to know how to undo itsel...
Using pickle for in-memory "transaction"?
0.099668
0
0
310
4,986,896
2011-02-13T21:11:00.000
2
0
1
1
python
4,987,311
2
false
0
0
What problems? Install PIP: easy-install pip Install virtualenv: pip install virtualenv Create a virtualenv environment: virtualenv myenv Enter to environment: source myenv/bin/activate or use myenv/bin/python ??? PROFIT!
1
4
0
Are there any good step by step tutorials on setting up a Mac to use python, pip and virtualenv setup?
Step by step setting up python with pip and virtualenv?
0.197375
0
0
3,496
4,986,938
2011-02-13T21:19:00.000
8
0
1
0
python
4,986,950
1
true
0
0
Is ipython just a better shell environment that uses the same libs/packages that the regular python interpreter will use? Yes. It is an advanced interactive shell and an environment for parallel computing (but most people only use it as an interactive shell).
1
4
0
Is ipython just a better shell environment that uses the same libs/packages that the regular python interpreter will use?
Is ipython a replacement or it works side by side with regular python?
1.2
0
0
93
4,986,986
2011-02-13T21:26:00.000
2
0
1
0
python,django,multithreading,initialization,mod-wsgi
4,988,044
3
true
1
0
I have my initialization code in a middleware that is called when the first request is served. After the initialization is done, you can raise a MiddlewareNotinuse exception, which causes Django not to execute that middleware again. Remember that because of the way apache and http work, no code will be executed before ...
2
2
0
I'm building a Django app that is designed to be multithreaded but reside in a single process running under mod_wsgi. At start of day I need to do various, possibly-lengthy, initialization tasks such as loading a cache of data from the database into a quick lookup dict. I need the intialization to run exactly once be...
What's a safe way to do one-off initialization in Django/mod_wsgi?
1.2
0
0
1,280
4,986,986
2011-02-13T21:26:00.000
0
0
1
0
python,django,multithreading,initialization,mod-wsgi
4,987,126
3
false
1
0
Maybe an good old lockfile is a solution for this problem. Not a really elegant solution, but it saves you a lot of headaches in a multithreaded environment.
2
2
0
I'm building a Django app that is designed to be multithreaded but reside in a single process running under mod_wsgi. At start of day I need to do various, possibly-lengthy, initialization tasks such as loading a cache of data from the database into a quick lookup dict. I need the intialization to run exactly once be...
What's a safe way to do one-off initialization in Django/mod_wsgi?
0
0
0
1,280
4,987,182
2011-02-13T21:58:00.000
0
0
0
0
python,rss,cdata
5,024,582
2
true
1
0
I looked into my problem some more and the problem is that PyRSS2Gen uses python's sax library, which has no concept of CDATA, at least when writing out XML. My solution was just to drop PyRSS2Gen and directly use minidom, which does understand CDATA sections. That did mean some extra lines of code. Once the html text...
1
0
0
I want to format the content of the description using html tags. When I try to enclose the content in <![CDATA[content<p>here]]> it doesn't work properly, as it escapes some of the brackets, displaying O.K. in some RSS viewers, but displaying the ]]> in others. If I try to avoid the CDATA and use escaped characters th...
PyRSS2Gen and embedding html in description tag
1.2
0
0
578
4,987,327
2011-02-13T22:27:00.000
0
1
1
0
python,unicode,encoding,utf-8
50,565,892
12
false
0
0
For py2/py3 compatibility simply use import six if isinstance(obj, six.text_type)
1
300
0
What do I have to do in Python to figure out which encoding a string has?
How do I check if a string is unicode or ascii?
0
0
0
424,066
4,987,579
2011-02-13T23:16:00.000
1
0
1
0
python,c,multithreading,python-c-api
5,002,035
3
true
0
1
It turns out that not having a PyThreadState in the main thread is a fatal error. It was caused for me by two different python versions both being linked at the same time, so this question is somewhat moot.
1
2
0
I'd like to create a PyThreadState since there doesn't appear to be one for the current thread. How do I get the current PyInterpreterState to pass to PyThreadState_New(...), or is that something that I should only do if I'm embedding an interpreter (and thus have created it), rather than calling into a library from py...
How do I get the current PyInterpreterState?
1.2
0
0
1,482
4,987,773
2011-02-14T00:04:00.000
0
1
0
0
python,selenium
5,481,430
2
false
0
0
You can specify the firefox profile while running the server itself. The command would look like java -jar selenium-server.jar -firefoxProfileTemplate "C:\Selenium\Profiles" where "C:\Selenium\Profiles" would be your path where firefox template files are stored.
1
6
0
Trying to achieve: same firefox profile throughout tests Problem: Tests are spread over 30 different files, instantiating a selenium object, and thus creating a firefox profile, in the first test won't persist to the following test because the objects die once script ends IIRC Can't specify profile because I'm writi...
Keeping Firefox profile persistent in multiple Selenium tests without specifying a profile
0
0
1
1,706
4,988,830
2011-02-14T04:31:00.000
1
1
0
0
java,python,c,multiplication
4,989,194
1
true
0
0
If I understand you correctly, "lattice multiplication" is different way of doing base-10 multiplication by hand that is supposed to be easier for kids to understand than the classic way. I assume "common multiplication" is the classic way. So really, I think that the best answer is: Neither "lattice multiplication" ...
1
0
1
which one is faster: Using Lattice Multiplication with threads(big numbers) OR Using common Multiplication with threads(big numbers) Do you know any source code, to test them? -----------------EDIT------------------ The theads should be implemented in C, or Java for testing
Lattice Multiplication with threads, is it more efficient?
1.2
0
0
519
4,991,366
2011-02-14T11:02:00.000
3
0
1
1
python
4,991,407
2
false
0
0
Don't attempt to share them; this has some chance of success with pure Python modules, but C modules will fail to work. Instead, install them using the appropriate interpreter executable, e.g. python2.4 setup.py install.
1
4
0
I have Python2.6.5 and Python2.4.4 on my linux machine. At the moment, all the modules I have (wx, ply, pyserial, twisted, to name a few) are installed for the 2.6 version of python. If I try to import wx on Python2.4, I get the expected no module error. The problem here, is that I have a lot of devices (Let's say ove...
Modules between multiple versions of Python Linux
0.291313
0
0
2,117
4,992,400
2011-02-14T12:59:00.000
2
0
1
1
python
4,992,558
7
false
0
0
If your running system commands you can just create the process instances with the subprocess module, call them as you want. There shouldn't be any need to thread (its unpythonic) and multiprocess seems a tad overkill for this task.
1
33
0
I write a simple script that executes a system command on a sequence of files. To speed things up, I'd like to run them in parallel, but not all at once - i need to control maximum number of simultaneously running commands. What whould be the easiest way to approach this ?
running several system commands in parallel in Python
0.057081
0
0
45,031
4,993,101
2011-02-14T14:08:00.000
3
0
1
0
c++,python,sdl,pygame
4,993,955
2
false
0
1
SDL is used professionally and some great games were made with it. Many times it is used as a cross-platform window creation system to initialize openGL (as I assume it is used for Doom3, UT, etc...). It is also used for as "raw" 2d graphics API (for example in Battle For Wesnoth).
1
4
0
As a hobbyists who has a little experience making 2D games using PyGame, and has ventured into using C++ with the SDL library (in Visual Studio), I'm curious. Is the library used professionally?
Is C++ SDL and (Python PyGame) used by people other than hobbyists?
0.291313
0
0
769
4,994,058
2011-02-14T15:39:00.000
0
0
1
0
python,macos,wxpython,pyobjc
5,071,853
2
false
0
1
What do you need Xcode for? If you need it for the windows/gui (*.nib, *.xib files), then you should perhaps search for 'creating *.nib, *xib without Xcode'. That's only a search hint and no satisfying answer.
1
6
0
I'm writing a small cross-platform wxPython app, however on every platform I need to use some platform-specific API. On Mac OS it can be done using PyObjC. I'm searching for tutorial on how to use PyObjC. However, all I found so far were tutorials with Xcode. I want my app to be able to run on mac/win/lin, without cha...
PyObjC tutorial without Xcode
0
0
0
3,791
4,994,493
2011-02-14T16:20:00.000
1
0
1
1
python,cherrypy
4,994,618
2
false
0
0
Not sure in CherryPY, but why not configure your front end webserver to serve static files? You really don't want that traffic hitting your framework.
2
0
0
Using Cherrypy version 3.0.2 Given a file-structure like this: static-dir 2011 2010 2009 ... I use the configuration: '/static': {'tools.staticdir.on': True, 'tools.staticdir.dir': 'static-dir'} This works fine fore getting /static/anyfile But if I try /static/2009/anyfile I get an error. I can add an entry in...
Is there no way to serve a static directory and its children i Cherrypy?
0.099668
0
0
357
4,994,493
2011-02-14T16:20:00.000
1
0
1
1
python,cherrypy
4,997,347
2
true
0
0
You shouldn't have to enter multiple entries; it should descend as far down as you need to. What error are you getting? 404? If you're using Cherrypy 3.2, try setting 'tools.staticdir.debug' to True.
2
0
0
Using Cherrypy version 3.0.2 Given a file-structure like this: static-dir 2011 2010 2009 ... I use the configuration: '/static': {'tools.staticdir.on': True, 'tools.staticdir.dir': 'static-dir'} This works fine fore getting /static/anyfile But if I try /static/2009/anyfile I get an error. I can add an entry in...
Is there no way to serve a static directory and its children i Cherrypy?
1.2
0
0
357
4,994,838
2011-02-14T16:55:00.000
1
0
0
0
python,web-applications,turbogears2
5,003,413
2
false
0
0
Hey, I got it right somehow. The problem seems to be version mismatch between SA 0.6 & sqlautocode 0.6 Seems that they don't work in tandom. So I removed those & installed SA 0.5 Now it's working. Thanks, Vineet Deodhar.
1
2
0
I am using TG2.1 on WinXP. Python ver is 2.6. Trying to use sqlautocode (0.5.2) for working with my existing MySQL schema. SQLAlchemy ver is 0.6.6 import sqlautocode # works OK While trying to reflect the schema ---- sqlautocode mysql:\\username:pswd@hostname:3306\schema_name -o tables.py SyntaxError: invalid ...
sqlautocode for mysql giving syntax error
0.099668
1
0
659
4,995,336
2011-02-14T17:40:00.000
0
1
1
0
python,embed,python-c-api
4,995,435
1
true
0
1
You need the encodings/__init__.py file, otherwise encodings is a folder and not a python package. Chances are that you'll need a lot of stuff from within the python standard library. To make everything just work you'll need to include the entire standard library along with your program. You can make this a bit better ...
1
2
0
I'm trying to make a small game that supports Python scripting. I've no problems with using the Python C-API, but I don't know how to ensure that the game will run on a computer with no Python installed. I know I need pythonXY.dll -- what else is there? When I try to run the program it tells me it cannot find encodings...
C++ Python embedding: Run on machine with no Python?
1.2
0
0
258
4,995,733
2011-02-14T18:17:00.000
3
0
1
1
python,command-line-interface,progress
4,995,772
23
false
0
0
Sure, it's possible. It's just a question of printing the backspace character (\b) in between the four characters that would make the "cursor" look like it's spinning ( -, \, |, /).
1
85
0
Is there a way to print a spinning cursor in a terminal using Python?
How to create a spinning command line cursor?
0.026081
0
0
76,617
4,995,842
2011-02-14T18:28:00.000
1
1
1
0
javascript,python,eclipse,refactoring,automated-refactoring
5,358,618
2
true
1
0
so it turns out that tracing of static information like methods and class hierarchies is perfectly possible in python. PyDev eclipse plugin does it. PyLint plugin attempts to do static analysis even on stuff like dynamic variables by assuming that nothing funky happens at runtime and does a pretty good job.
1
4
0
Eclipse is able to utilize compiled bytecode to enable "magic refactor" functionality--renaming methods, tracing up and down class hierarchies and tracing through method calls. What technical barriers exist that make this harder to do for languages like Python and Javascript?
why doesn't eclipse-python have magic refactor?
1.2
0
0
1,299
4,996,852
2011-02-14T20:22:00.000
3
0
0
1
python,subprocess
4,996,861
4
false
0
0
just call it as you are and tack >/dev/null on the end of the comamnd. That will redirect any textual output.
2
40
0
In Python, what is the shortest and the standard way of calling a command through subprocess but not bothering with its output. I tried subprocess.call however it seems to return the output. I am not bothered with that, I just need to run the program silently without the output cluttering up the screen. If it helps, I ...
How to just call a command and not get its output
0.148885
0
0
60,925
4,996,852
2011-02-14T20:22:00.000
3
0
0
1
python,subprocess
20,773,568
4
false
0
0
Use the /dev/null if you are using Unix. If you run any command in Shell and don't want to show its output on terminal. For example :- ls > /dev/null will not produce any output on terminal. So just use os,subprocess to execute some thing on shell and just put its o/p into /dev/null.
2
40
0
In Python, what is the shortest and the standard way of calling a command through subprocess but not bothering with its output. I tried subprocess.call however it seems to return the output. I am not bothered with that, I just need to run the program silently without the output cluttering up the screen. If it helps, I ...
How to just call a command and not get its output
0.148885
0
0
60,925
4,997,366
2011-02-14T21:16:00.000
0
0
0
0
python,django,apache,deployment,mod-wsgi
4,997,873
3
false
1
0
There is no problem running mod_wsgi on OSX 10.5, a precompiled binary isn't supplied that is all. You would need to compile it from source code, meaning you would need to have XCode installed. Otherwise you wait a week until I get home and I will build a mod_wsgi.so for OSX 10.5 and I will put it up for download. Post...
2
1
0
I'm a newbie learning Django, and couldn't get the development server accessible externally. So I'm looking into other deployment options. It seems that mod_wsgi is the way to go (with Apache), but it only supports OSX 10.6+. Are there any alternatives if you own 10.5.8?
mod_wsgi for Django on Mac OSX 10.5.8
0
0
0
407
4,997,366
2011-02-14T21:16:00.000
0
0
0
0
python,django,apache,deployment,mod-wsgi
5,012,507
3
false
1
0
Gunicorn is the fastest way to having a production ready web server serving your site that I've found in the Django realm. It is a Python WSGI HTTP Server for UNIX. Steps involved to deploy your site using gunicorn: pip install gunicorn Add 'gunicorn' your installed apps listed in settings.py ./manage.py run_gunicor...
2
1
0
I'm a newbie learning Django, and couldn't get the development server accessible externally. So I'm looking into other deployment options. It seems that mod_wsgi is the way to go (with Apache), but it only supports OSX 10.6+. Are there any alternatives if you own 10.5.8?
mod_wsgi for Django on Mac OSX 10.5.8
0
0
0
407
4,999,006
2011-02-15T01:02:00.000
6
0
1
0
python,math,quadratic,factorization
4,999,129
3
true
0
0
Improving Keiths's answer: Start with a polynomial P(x) = a*x^2 + b*x + c. Use the quadratic formula (or another another method of your choice) to find the roots r1 and r2 to P(x) = 0. You can now factor P(x) as a*(x-r1)(x-r2). If your factor (3x - 4)(x - 9) the solution will be 3*(x - 4/3)(x - 9). You might want to f...
1
2
0
Since factoring a quadratic equation in my head just happens, and has done that since I learned it - how would I go about starting to write a quadratic factorer in Python?
Factor a quadratic polynomial in Python
1.2
0
0
7,576
4,999,078
2011-02-15T01:20:00.000
2
0
1
0
python,json,pyjamas
5,659,587
1
true
0
0
I've played with pyjamas a little and am currently implementing json-rpc with django. Have you considered using ssl to secure the site. Short of implementing your own (basic) encryption routine, its probably the best way forward.
1
2
0
What's the simplest way to set up a JSON-RPC server in python and make it secure? I'm very interested Pyjamas for python/javascript - but the documentation doesn't explain how to implement security with the JSON-RPC.
Easy secure JSON-RPC in python
1.2
0
0
934
4,999,340
2011-02-15T02:18:00.000
1
0
1
0
python,file,file-io,large-files,random-access
4,999,910
7
false
0
0
Has fixed-length records? If so, yes, you can implement a binary search algorithm using seeking. Otherwise, load your file into an SQLlite database. Query that.
4
20
0
Is there a Python file type for accessing random lines without traversing the whole file? I need to search within a large file, reading the whole thing into memory wouldn't be possible. Any types or methods would be appreciated.
Python Random Access File
0.028564
0
0
21,470
4,999,340
2011-02-15T02:18:00.000
1
0
1
0
python,file,file-io,large-files,random-access
4,999,455
7
false
0
0
The File object supports seek but make sure that you open them as binary, i.e. "rb". You may also wish to use the mmap module for random access, particularly if the data is in an internal format already.
4
20
0
Is there a Python file type for accessing random lines without traversing the whole file? I need to search within a large file, reading the whole thing into memory wouldn't be possible. Any types or methods would be appreciated.
Python Random Access File
0.028564
0
0
21,470
4,999,340
2011-02-15T02:18:00.000
2
0
1
0
python,file,file-io,large-files,random-access
4,999,344
7
false
0
0
file objects have a seek method which can take a value to particular byte within that file. For traversing through the large files, iterate over it and check for the value in each line. Iterating the file object does not load the whole file content into memory.
4
20
0
Is there a Python file type for accessing random lines without traversing the whole file? I need to search within a large file, reading the whole thing into memory wouldn't be possible. Any types or methods would be appreciated.
Python Random Access File
0.057081
0
0
21,470
4,999,340
2011-02-15T02:18:00.000
6
0
1
0
python,file,file-io,large-files,random-access
4,999,351
7
false
0
0
Since lines can be of arbitrary length, you really can't get at a random line (whether you mean "a line whose number is actually random" or "a line with an arbitrary number, selected by me") without traversing the whole file. If kinda-sorta-random is enough, you can seek to a random place in the file and then read forw...
4
20
0
Is there a Python file type for accessing random lines without traversing the whole file? I need to search within a large file, reading the whole thing into memory wouldn't be possible. Any types or methods would be appreciated.
Python Random Access File
1
0
0
21,470
4,999,485
2011-02-15T02:52:00.000
3
0
0
0
python,screen-scraping
4,999,545
2
true
1
0
If the data "refreshes before your eyes" it is probably AJAX (javascript in the page pulling new page-data from the server). There are two ways of approaching this; using Selenium you can wrap an actual browser which will load the page, run the javascript, then you can grab page-bits from the active page. you can look...
1
0
0
I am not really a programmer but am asking this out of general curiosity. I visited a website recently where I logged in, went to a page, and without leaving, data on that page refreshes before my eyes. Is it possible to mimic a browser (I was using Chrome) and log into the site, navigate to a page, and "scrape" that ...
Log Into Website and Scrape Streaming Data
1.2
0
1
1,502
4,999,660
2011-02-15T03:36:00.000
1
0
1
0
python,pdf-generation,reportlab
7,099,416
4
false
0
1
PyCairo could be a good alternative. You'll have full control and less dependencies, but reportlab is a lot simplier.
1
6
0
I want to write a python script to convert PNG's into 2-page pdfs (i.e. 2 PNGs per PDF). The software needs to run on both a Mac and Windows 7. My current solution is using ReportLab, but that doesn't install easily on a Mac. According to its website, it only has a compiled version for Windows. It has a cross-platform ...
Using python to convert PNG's into PDF's
0.049958
0
0
8,947
5,000,360
2011-02-15T05:55:00.000
25
1
1
0
python,jvm,jython
5,000,542
1
true
1
0
Keep in mind that IronPython was started by one of the original Jython devs (Jim Huginin) in an attempt to prove that the .NET CLR was a poor platform for dynamic languages. He ended up proving himself wrong and the core of IronPython eventually became the .NET Dynamic Language Runtime (making other dynamic language im...
1
42
0
No flame wars please. I am admittedly no fan of Java, but I consider the JVM to be a fairly decent and well-optimized virtual machine. It's JIT-enabled and very close to the common denominator of the prevalent CPU architectures. I'd assume that the CPython runtime would be farther from the metal than a corresponding JV...
Why is Jython much slower than CPython, despite the JVM's advances?
1.2
0
0
17,795
5,000,946
2011-02-15T07:35:00.000
0
1
1
0
python,m2crypto
5,002,066
3
false
0
0
If you are encrypting to send to another party then you want to do something like Diffie Hellman or ECDH key exchange to establish a shared secret. If you just want to encrypt for storage, then you need a secure random number generator. I do not believe M2Crypto provides this? It looks like M2Crypto does support Diffie...
1
9
0
I am using M2Crypto's AES for encrypting message, but confused about how to generate a strong random session key and of what length. Does M2Crypto provide any function for generation random key.
How to generate strong one time session key for AES in python
0
0
0
21,236
5,002,150
2011-02-15T10:00:00.000
0
0
0
1
python,django,google-app-engine,pyc
5,002,563
3
false
1
0
Why would you want to do that in the first place? Because your .py files are uploaded to Google infrastructure and can be seen only if you explicitly give permissions. But yes, there is no reason as why uploading only .pyc files should not work. If you try it, in your dev environment, you will find it working just as B...
2
2
0
I'm working on a project utilizing Django on Google App Engine. I've been asked if some of the code can be deployed as compiled only. So I guess the question is can I upload a .pyc file only that contains the piece of code in question? I've done a basic test with a views.pyc file in an application and things don't wo...
Can I deploy Python .pyc files only to Google App Engine?
0
0
0
2,724
5,002,150
2011-02-15T10:00:00.000
7
0
0
1
python,django,google-app-engine,pyc
5,002,914
3
false
1
0
No, you can't - you can only upload sourcecode. There's no good reason to do this, though: your code will be bytecode-compiled on the servers when needed, and nobody is able to access your code in any case.
2
2
0
I'm working on a project utilizing Django on Google App Engine. I've been asked if some of the code can be deployed as compiled only. So I guess the question is can I upload a .pyc file only that contains the piece of code in question? I've done a basic test with a views.pyc file in an application and things don't wo...
Can I deploy Python .pyc files only to Google App Engine?
1
0
0
2,724
5,002,359
2011-02-15T10:17:00.000
1
1
0
0
python,comparison
5,002,512
1
false
0
0
If in doubt, go for the simplest solution. In this case, compare them in memory. If you want to be ultra-reliable (i.e. survive after crashes of your application / power outage) or cache values for long times (i.e. it's a requirement to continue working even when the database is down), you may consider files. Be warned...
1
0
0
I need to compare values that i have by executing wmi commands(using python) and values from inside a db.. is it best to compare them without storing in separate files or is storing and then comparing is the only possible way? can someone pls direct me in the right way.. also, where should i look for, for getting more ...
i need some directions in comparing values from different sources using python
0.197375
0
0
43
5,002,986
2011-02-15T11:22:00.000
0
1
0
0
python,automated-tests,web-scraping,urllib2,mechanize-python
5,462,848
3
true
1
0
I actually went without using mechanize and used the Threading module. This allowed for fairly quick transactions, and I also made sure not to have too much inside of each thread. Login information, and getting the webapp in the state necessary before I threaded helped the threads to run shorter and therefore more quic...
2
2
0
I have a web app that needs both functionality and performance tested, and part of the test suite that we plan on using is already written in Python. When I first wrote this, I used mechanize as my means of web-scraping, but it seems to be too bulky for what I'm trying to do (either that or I'm missing something). The ...
Python web-scraping threaded performance
1.2
0
0
929
5,002,986
2011-02-15T11:22:00.000
0
1
0
0
python,automated-tests,web-scraping,urllib2,mechanize-python
5,236,735
3
false
1
0
Have you considered Twisted, the asynchronous library, for at least doing interaction with users?
2
2
0
I have a web app that needs both functionality and performance tested, and part of the test suite that we plan on using is already written in Python. When I first wrote this, I used mechanize as my means of web-scraping, but it seems to be too bulky for what I'm trying to do (either that or I'm missing something). The ...
Python web-scraping threaded performance
0
0
0
929
5,003,276
2011-02-15T11:50:00.000
0
1
1
0
python,embed,portability
5,003,499
4
false
0
0
Try the DLLs folder under your base python install directory if you are on windows. It contains .pyd modules Ignacio mentions. I had a similar problem with a portable install. Including the DLLs folder contents to my install fixed it. I am using python 2.5.
2
3
0
I'm trying to determine which files in the Python library are strictly necessary for my script to run. Right now I'm trying to determine where _io.py is located. In io.py (no underscore), the _io.py module (with underscore) is imported on line 60.
Python: import _io
0
0
1
2,239
5,003,276
2011-02-15T11:50:00.000
1
1
1
0
python,embed,portability
5,003,294
4
false
0
0
Not all Python modules are written in Python. Try looking for _io.so or _io.pyd.
2
3
0
I'm trying to determine which files in the Python library are strictly necessary for my script to run. Right now I'm trying to determine where _io.py is located. In io.py (no underscore), the _io.py module (with underscore) is imported on line 60.
Python: import _io
0.049958
0
1
2,239
5,003,475
2011-02-15T12:11:00.000
0
0
0
0
python,web-applications,turbogears,turbogears2
5,292,555
3
false
1
0
We've succeeded in faking sqa if the there's combination of columns on the underlying table that uniquely identify it. If this is your own table and you're not live, add a primary key integer column or something. We've even been able to map an existing legacy table in a database with a) no pk and b) no proxy for a prim...
3
0
0
This relates to primary key constraint in SQLAlchemy & sqlautocode. I have SA 0.5.1 & sqlautocode 0.6b1 I have a MySQL table without primary key. sqlautocode spits traceback that "could not assemble any primary key columns". Can I rectify this with a patch sothat it will reflect tables w/o primary key? Thanks, Vineet D...
sqlautocode : primary key required in tables?
0
1
0
321
5,003,475
2011-02-15T12:11:00.000
0
0
0
0
python,web-applications,turbogears,turbogears2
5,292,729
3
false
1
0
If the problem is that sqlautocode will not generate your class code because it cannot determine the PKs of the table, then you would probably be able to change that code to fit your needs (even if it means generating SQLA code that doesn't have PKs). Eventually, if you're using the ORM side of SQLA, you're going to ne...
3
0
0
This relates to primary key constraint in SQLAlchemy & sqlautocode. I have SA 0.5.1 & sqlautocode 0.6b1 I have a MySQL table without primary key. sqlautocode spits traceback that "could not assemble any primary key columns". Can I rectify this with a patch sothat it will reflect tables w/o primary key? Thanks, Vineet D...
sqlautocode : primary key required in tables?
0
1
0
321