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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,304,363 | 2012-04-24T19:01:00.000 | 1 | 0 | 0 | 0 | python,django,web-deployment,source-code-protection | 10,305,580 | 4 | false | 1 | 0 | While your source code's probably fine where it is, I'd recommend not storing your configuration passwords in plaintext, whether the code file is compiled or not. Rather, have a hash of the appropriate password on the server, have the server generate a hash of the password submitted during login and compare those inste... | 4 | 3 | 0 | I have picked up python/django just barely a year. Deployment of django site is still a subject that I have many questions about, though I have successfully manual deployed my site. One of my biggest questions around deployment is what measures can I take to safeguard the source code of my apps, including passwords in ... | What measures can I take to safeguard the source code of my django site from others? | 0.049958 | 0 | 0 | 2,223 |
10,305,327 | 2012-04-24T20:12:00.000 | 8 | 0 | 1 | 0 | python,python-c-extension | 10,305,714 | 1 | true | 0 | 1 | PyList_SET_ITEM is an unsafe macro that basically sticks an object into the list's internal pointer array without any bound checks. If anything non-NULL is in the ith position of the list, a reference leak will occur. PyList_SET_ITEM steals the reference to the object you put in the list. PyList_SetItem also steals the... | 1 | 8 | 0 | From what I can tell, the difference between PyList_SetItem and PyList_SETITEM is that PyList_SetItem will lower the reference count of the list item it overwrites and PyList_SETITEM does not.
Is there any reason why I shouldn't just use PyList_SetItem all the time? Or would I get into trouble if I used PyList_SetItem... | PyList_SetItem vs. PyList_SETITEM | 1.2 | 0 | 0 | 2,163 |
10,305,964 | 2012-04-24T21:04:00.000 | 3 | 0 | 0 | 0 | python,numpy,statistics,scipy | 27,016,762 | 4 | false | 0 | 0 | I'm just trying to do this myself and it sound like you want the command "scipy.stats.binned_statistic_2d" from you can find the mean, median, standard devation or any defined function for the third parameter given the bins.
I realise this question has already been answered but I believe this is a good built in solutio... | 1 | 7 | 1 | do you know a quick/elegant Python/Scipy/Numpy solution for the following problem:
You have a set of x, y coordinates with associated values w (all 1D arrays). Now bin x and y onto a 2D grid (size BINSxBINS) and calculate quantiles (like the median) of the w values for each bin, which should at the end result in a BINS... | Quantile/Median/2D binning in Python | 0.148885 | 0 | 0 | 5,849 |
10,307,173 | 2012-04-24T22:58:00.000 | 0 | 0 | 0 | 0 | python,c++,mysql,django,large-data | 10,327,841 | 2 | false | 0 | 0 | Python is just fine. I am a Python person. I do not know C++ personally. However, during my research of python the creator of mathematica stated himself that python is equally as powerful as mathematica. Python is used in many highly accurate calculations. (i. e. engineering software, architecture work, etc. . .) | 1 | 1 | 1 | I have implemented Tensor Factorization Algorithm in Matlab. But, actually, I need to use it in Web Application.
So I implemented web site on Django framework, now I need to merge it with my Tensor Factorization algorithm.
For those who are not familiar with tensor factorization, you can think there are bunch of mult... | Most efficient language to implement tensor factorization for Web Application | 0 | 0 | 0 | 291 |
10,307,953 | 2012-04-25T00:45:00.000 | 0 | 0 | 0 | 0 | python,download | 10,308,010 | 1 | false | 0 | 0 | It depends on what type of connection do you expect to use. I think, 64 Kb could be just enough. | 1 | 0 | 0 | I need to download a file that could be potentially quite large (300MB) that will later be saved locally. I don't want to read the remote file in one go to prevent excessive memory usage and intend to read the remote file in small chunks.
Is there an optimum size for these chunks? | Downloading a file in chunks -- is there an optimal sized chunk? | 0 | 0 | 1 | 404 |
10,309,579 | 2012-04-25T05:00:00.000 | 0 | 1 | 1 | 0 | python,perl,rpc,zeromq,msgpack | 10,339,941 | 2 | false | 0 | 0 | After studying this for a couple days I'm going with ZeroMQ + messagepack. The ZeroMQ docs show how to use messagepack, and I can implement an RPC server or client in only a few lines. The ZeroMQ modules for perl and python both have JSON serialization built in, so it's possible to implement RPC with ZeroMQ alone, bu... | 1 | 1 | 0 | I'm currently using json and http to call perl functions from python, but it's slow. Based on some research, messagepack is best for serialization and zeromq is the best transport. Both have cross platform bindings, but before I dig in, I would like to know what others are using for fast cross-language RPC (preferabl... | RPC between python and perl | 0 | 0 | 0 | 523 |
10,309,956 | 2012-04-25T05:44:00.000 | 0 | 0 | 1 | 0 | python,scheduling,pyramid | 10,327,650 | 1 | true | 1 | 0 | I would avoid running your Controller in the same process as the web application - it is a common practice to run web-applications with lowered permissions, for example; in some multi-threaded/multi-process environment which may spawn multiple workers and then possibly kill/recycle them whenever it feels like doing so.... | 1 | 0 | 0 | I have a multi-stage process that needs to be run at some intervals.
I also have a Controller program which starts the process at the right times, chains together the stages of the process, and checks that each stage has executed correctly.
The Controller accesses a database which stores information about past runs of ... | Creating web interface to a controller process in python | 1.2 | 0 | 0 | 182 |
10,310,068 | 2012-04-25T05:53:00.000 | 0 | 0 | 0 | 0 | python,pygame | 10,647,216 | 2 | true | 0 | 1 | Pygame is as good as they get for 2D CPU graphics. All the graphics is implemented in C, (PyGame wraps SDL) so the code is nearly as fast as an equivalent C software renderer.
That said, it's still (basically) a software renderer, and there's this interesting device in every modern computer called a GPU which is desig... | 2 | 0 | 0 | I'm starting to work on a 2D scrolling shoot-em-up game, and I was wondering if pygame is suitable. I would like to hit close to 60 fps while animating a scrolling background with hundreds of sprites (mostly bullets, of course); is this feasible with pygame? From what I've read, I'm leaning toward no, but I'd like an... | Using Pygame to make scrolling shoot-em-up | 1.2 | 0 | 0 | 1,238 |
10,310,068 | 2012-04-25T05:53:00.000 | 0 | 0 | 0 | 0 | python,pygame | 10,315,791 | 2 | false | 0 | 1 | Pygame is the best solution for 2D games in python according to me. You can save Surfaces uses its optimized Sprites animation, so I think it's the fastest solution : as for development process than for code execution. | 2 | 0 | 0 | I'm starting to work on a 2D scrolling shoot-em-up game, and I was wondering if pygame is suitable. I would like to hit close to 60 fps while animating a scrolling background with hundreds of sprites (mostly bullets, of course); is this feasible with pygame? From what I've read, I'm leaning toward no, but I'd like an... | Using Pygame to make scrolling shoot-em-up | 0 | 0 | 0 | 1,238 |
10,315,069 | 2012-04-25T11:55:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,deployment | 12,338,986 | 6 | false | 1 | 0 | Add the --oauth2 flag to appcfg.py update for an easier fix | 4 | 11 | 0 | When I try to deploy my app I get the following error:
Starting update of app: flyingbat123, version: 0-1
Getting current resource limits.
Password for avigmati: Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 125, in
run_file(__file__, globals())
File ... | GAE - Deployment Error: "AttributeError: can't set attribute" | 0.033321 | 0 | 0 | 4,377 |
10,315,069 | 2012-04-25T11:55:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,deployment | 12,912,373 | 6 | false | 1 | 0 | This also happens if your default_error value overlaps with your static_dirs in app.yaml. | 4 | 11 | 0 | When I try to deploy my app I get the following error:
Starting update of app: flyingbat123, version: 0-1
Getting current resource limits.
Password for avigmati: Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 125, in
run_file(__file__, globals())
File ... | GAE - Deployment Error: "AttributeError: can't set attribute" | 0 | 0 | 0 | 4,377 |
10,315,069 | 2012-04-25T11:55:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,deployment | 10,871,690 | 6 | false | 1 | 0 | I had the same problem and after inserting logger.warn(body), I get this:
WARNING appengine_rpc.py:231 Error=BadAuthentication
Info=InvalidSecondFactor
The standard error message could have been more helpful, but this makes me wonder if I should not use an application specific password? | 4 | 11 | 0 | When I try to deploy my app I get the following error:
Starting update of app: flyingbat123, version: 0-1
Getting current resource limits.
Password for avigmati: Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 125, in
run_file(__file__, globals())
File ... | GAE - Deployment Error: "AttributeError: can't set attribute" | 0.033321 | 0 | 0 | 4,377 |
10,315,069 | 2012-04-25T11:55:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,deployment | 12,750,238 | 6 | false | 1 | 0 | I know this doesn't answer the OP question, but it may help others who experience problems using --oauth2 mentioned by others in this question.
I have 2-step verification enabled, and I had been using the application-specific password, but found it tedious to look up and paste the long string every day or so. I found t... | 4 | 11 | 0 | When I try to deploy my app I get the following error:
Starting update of app: flyingbat123, version: 0-1
Getting current resource limits.
Password for avigmati: Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 125, in
run_file(__file__, globals())
File ... | GAE - Deployment Error: "AttributeError: can't set attribute" | 0.066568 | 0 | 0 | 4,377 |
10,315,232 | 2012-04-25T12:05:00.000 | 0 | 1 | 0 | 1 | python,linux,eclipse,pydev | 10,343,117 | 1 | true | 1 | 0 | I don't really think there's anything that can be done on the PyDev side... it seems @sys is resolved based on the kind of process you're running (not your system), so, if you use a 64 bit vm (I think) it should work...
Other than that, you may have to provide the actual path instead of using @sys... | 1 | 2 | 0 | I'm working in a multiuser environment with the following setup:
Linux 64bits environment (users can login in to different servers).
Eclipse (IBM Eclipse RSA-RTE) 32bits. So Java VM, Eclipse and PyDev is 32bits.
Python 3 interpreter is only available for 64bits at this moment.
In the preferences for PyDev, I want to ... | Eclipse / PyDev overrides @sys, cannot find Python 64bits interpreter | 1.2 | 0 | 0 | 321 |
10,315,257 | 2012-04-25T12:07:00.000 | 0 | 0 | 0 | 0 | python,openerp | 10,324,086 | 2 | false | 1 | 0 | If your purpose is to debug, the simplest solution is to add print statements in your code and then run the server in a console. | 1 | 1 | 0 | In openerp, im working on a dummy function that (for example) returns the sum of a certain field on selected records.
for instance, u select 3 invoices and it returns the sum of the quantity in the invoice lines. i think the function to perform the sum is correct, and even if it wasnt, i just need help in displaying th... | openerp echo the return result of a function | 0 | 0 | 0 | 517 |
10,315,662 | 2012-04-25T12:31:00.000 | 4 | 1 | 0 | 1 | python,gdb,debug-symbols,activepython,mingw-w64 | 10,323,635 | 3 | false | 0 | 0 | The best way to create a debug version of Python under Windows is to use the Debug build in the Visual Studio projects that come with the Python source, using the compiler version needed for the specific Python release, i.e. VS 2008.
There may be other ways, but this is certainly the best way.
If you really need a 64-b... | 1 | 12 | 0 | Firstly, I should state that my current development environment is MSYS + mingw-w64 + ActivePython under Windows 7 and that on a normal day I am primarily a Linux developer. I am having no joy obtaining, or compiling, a version of the Python library with debug symbols.
I need both 32bit and 64bit debug versions of the... | How to obtain pre-built *debug* version of Python library (e.g. Python27_d.dll) for Windows | 0.26052 | 0 | 0 | 12,543 |
10,317,114 | 2012-04-25T13:50:00.000 | 5 | 0 | 0 | 0 | python,database,django,postgresql | 19,072,541 | 8 | false | 0 | 0 | Had the same problem.
There were not any locks on the table.
Reboot helped. | 4 | 42 | 0 | I'm trying to drop a few tables with the "DROP TABLE" command but for a unknown reason, the program just "sits" and doesn't delete the table that I want it to in the database.
I have 3 tables in the database:
Product, Bill and Bill_Products which is used for referencing products in bills.
I managed to delete/drop Produ... | Postgresql DROP TABLE doesn't work | 0.124353 | 1 | 0 | 55,426 |
10,317,114 | 2012-04-25T13:50:00.000 | 2 | 0 | 0 | 0 | python,database,django,postgresql | 40,749,694 | 8 | false | 0 | 0 | Old question but ran into a similar issue. Could not reboot the database so tested a few things until this sequence worked :
truncate table foo;
drop index concurrently foo_something; times 4-5x
alter table foo drop column whatever_foreign_key; times 3x
alter table foo drop column id;
drop table foo; | 4 | 42 | 0 | I'm trying to drop a few tables with the "DROP TABLE" command but for a unknown reason, the program just "sits" and doesn't delete the table that I want it to in the database.
I have 3 tables in the database:
Product, Bill and Bill_Products which is used for referencing products in bills.
I managed to delete/drop Produ... | Postgresql DROP TABLE doesn't work | 0.049958 | 1 | 0 | 55,426 |
10,317,114 | 2012-04-25T13:50:00.000 | 0 | 0 | 0 | 0 | python,database,django,postgresql | 69,412,889 | 8 | false | 0 | 0 | The same thing happened for me--except that it was because I forgot the semicolon. face palm | 4 | 42 | 0 | I'm trying to drop a few tables with the "DROP TABLE" command but for a unknown reason, the program just "sits" and doesn't delete the table that I want it to in the database.
I have 3 tables in the database:
Product, Bill and Bill_Products which is used for referencing products in bills.
I managed to delete/drop Produ... | Postgresql DROP TABLE doesn't work | 0 | 1 | 0 | 55,426 |
10,317,114 | 2012-04-25T13:50:00.000 | 4 | 0 | 0 | 0 | python,database,django,postgresql | 60,367,779 | 8 | false | 0 | 0 | I ran into this today, I was issuing a:
DROP TABLE TableNameHere
and getting ERROR: table "tablenamehere" does not exist. I realized that for case-sensitive tables (as was mine), you need to quote the table name:
DROP TABLE "TableNameHere" | 4 | 42 | 0 | I'm trying to drop a few tables with the "DROP TABLE" command but for a unknown reason, the program just "sits" and doesn't delete the table that I want it to in the database.
I have 3 tables in the database:
Product, Bill and Bill_Products which is used for referencing products in bills.
I managed to delete/drop Produ... | Postgresql DROP TABLE doesn't work | 0.099668 | 1 | 0 | 55,426 |
10,317,570 | 2012-04-25T14:15:00.000 | 3 | 0 | 1 | 1 | python,multithreading,terminal,cpu,cpu-usage | 10,323,602 | 1 | true | 0 | 0 | One reason for this might be the use of hyper-threading. HT logical CPUs appear to the operating system as separate CPUs, but really are not. So if two threads run on the same core in separate logical (HT) CPUs, performance would be smaller than if they ran on separate cores.
The easiest solution might be to disable hy... | 1 | 2 | 0 | I just bought a new, machine to run python scripts for large scale modeling. It has two CPUs with 4 cores each (Xeon, 2.8GhZ). Each core has hyper-threading enabled for 4 logical cpu cores.
Now for the problem: When I run identical python processes in 8 separate terminals, top command shows that each process is taking ... | Large Variations in Identical Python Process Run Times | 1.2 | 0 | 0 | 152 |
10,317,632 | 2012-04-25T14:18:00.000 | 1 | 1 | 0 | 0 | c++,python,architecture,thrift | 10,328,853 | 2 | true | 1 | 0 | you could consider:
already mentioned CORBA solution: built in marshaling, compact binary protocol
REST http and based json server: simple, a bit chatty on the network, you need to serialize your data to json
AMQP messaging + json or some other serializer: you need to serialize your data to json or something else like... | 2 | 0 | 0 | I am building an application, which has an application based front-end in C++/Qt and a web based front-end in Python (using Django) framework. I'm trying to migrate the architecture to services-based, as both these front-ends have business logic embedded in them, which makes it hard to maintain.
I'm thinking of choosi... | migrating business logic to services: alternatives to Thrift | 1.2 | 0 | 0 | 254 |
10,317,632 | 2012-04-25T14:18:00.000 | 1 | 1 | 0 | 0 | c++,python,architecture,thrift | 10,317,981 | 2 | false | 1 | 0 | I've implemented something similar using omniORB. It has bindings for python and for C++. It's really easy in python and performs very well. | 2 | 0 | 0 | I am building an application, which has an application based front-end in C++/Qt and a web based front-end in Python (using Django) framework. I'm trying to migrate the architecture to services-based, as both these front-ends have business logic embedded in them, which makes it hard to maintain.
I'm thinking of choosi... | migrating business logic to services: alternatives to Thrift | 0.099668 | 0 | 0 | 254 |
10,319,478 | 2012-04-25T16:08:00.000 | 0 | 0 | 1 | 0 | python,arcmap | 12,737,728 | 3 | false | 0 | 0 | Try
len(!Name!.split(" "))
If that doesn't work...let us know which feature it fails on and maybe more sample data? | 2 | 1 | 0 | I am python newbie and I am trying to count the number of words in a column (Name) in ArcMap by using
!NAME!.count(' ') +
1
but I run into problems with strings like :
First N' Infant Care Center "Baby World"
type.exceptions.Syntaxerror,
even if I use " ",same problem I encounter when I am using other methods li... | Python- ArcMap - Calculate Fields | 0 | 0 | 0 | 448 |
10,319,478 | 2012-04-25T16:08:00.000 | 0 | 0 | 1 | 0 | python,arcmap | 71,880,005 | 3 | false | 0 | 0 | Python can not easily handle mixed double and single quotes, so it's best if you first remove them.
One way to do this is to add another field (say newName, calculate it to have the same values as "Name" field, by doing just !NAME!. I am assuming you don't want to alter the Name field.
Then within editing mode, use fin... | 2 | 1 | 0 | I am python newbie and I am trying to count the number of words in a column (Name) in ArcMap by using
!NAME!.count(' ') +
1
but I run into problems with strings like :
First N' Infant Care Center "Baby World"
type.exceptions.Syntaxerror,
even if I use " ",same problem I encounter when I am using other methods li... | Python- ArcMap - Calculate Fields | 0 | 0 | 0 | 448 |
10,319,696 | 2012-04-25T16:19:00.000 | 6 | 0 | 1 | 0 | java,.net,python,regex,perl | 10,319,727 | 8 | false | 0 | 0 | I suspect you want to be using negative lookahead: (.)\1{N-1}(?!\1).
But that said...I suspect the simplest cross-language solution is just write it yourself without using regexes.
UPDATE:
^(.)\\1{3}(?!\\1)|(.)(?<!(?=\\2)..)\\2{3}(?!\\2) works for me more generally, including matches starting at the beginning of the s... | 1 | 8 | 0 | How do I write an expression that matches exactly N repetitions of the same character (or, ideally, the same group)? Basically, what (.)\1{N-1} does, but with one important limitation: the expression should fail if the subject is repeated more than N times. For example, given N=4 and the string xxaaaayyybbbbbzzccccxx, ... | Match exactly N repetitions of the same character | 1 | 0 | 0 | 832 |
10,319,920 | 2012-04-25T16:32:00.000 | 0 | 0 | 0 | 0 | python,r,open-source | 10,335,341 | 2 | false | 0 | 0 | I think that you mean ipython with pylab. This is a real alternative, but not exactly for R, but for Matlab. | 1 | 2 | 0 | I remember reading about an alternative to GNU R (statistical research system) using Python. I've googled around a bit to find it, but can't seem to. Can you point me in the right direction? | Python alternative for GNU R | 0 | 0 | 0 | 754 |
10,321,568 | 2012-04-25T18:25:00.000 | -1 | 0 | 0 | 0 | python,django | 20,124,244 | 4 | false | 1 | 0 | sudo apt-get install python-psycopg2 should work fine since it worked solution for me as well. | 2 | 6 | 0 | Ive been reading the Django Book and its great so far, unless something doesn't work properly. I have been trying for two days to install the psycogp2 plugin with no luck.
i navigate to the unzipped directory and run setup.py install and it returns "You must have postgresql dev for building a serverside extension or li... | Django with psycopg2 plugin | -0.049958 | 1 | 0 | 4,157 |
10,321,568 | 2012-04-25T18:25:00.000 | 3 | 0 | 0 | 0 | python,django | 22,528,687 | 4 | false | 1 | 0 | I'm working on Xubuntu (12.04) and I have encountered the same error when I wanted to install django-toolbelt. I solved this error with the following operations :
sudo apt-get install python-dev
sudo apt-get install libpq-dev
sudo apt-get install python-psycopg2
I hope this informations may be helpful for someone els... | 2 | 6 | 0 | Ive been reading the Django Book and its great so far, unless something doesn't work properly. I have been trying for two days to install the psycogp2 plugin with no luck.
i navigate to the unzipped directory and run setup.py install and it returns "You must have postgresql dev for building a serverside extension or li... | Django with psycopg2 plugin | 0.148885 | 1 | 0 | 4,157 |
10,322,422 | 2012-04-25T19:27:00.000 | 5 | 0 | 0 | 1 | python,database,multiprocessing,signals | 10,322,481 | 1 | true | 0 | 0 | Store all the open files/connections/etc. in a global structure, and close them all and exit in your SIGTERM handler. | 1 | 3 | 0 | I have a daemon process witch spawns child processes using multiprocessing to do some work, each child process opens its own connection handle do DB (postgres in my case). Jobs to processes are passed via Queue and if queue is empty processes invoke sleep for some time, and recheck queue
How can I implement "graceful s... | Gracefull shutdown, close db connections, opened files, stop work on SIGTERM, in multiprocessing | 1.2 | 1 | 0 | 403 |
10,322,424 | 2012-04-25T19:27:00.000 | 2 | 0 | 1 | 0 | python,configuration,pycharm | 51,472,500 | 6 | false | 0 | 0 | Quick Answer:
File --> Setting
In left side in project section --> Project interpreter
Select desired Project interpreter
Apply + OK
[NOTE]:
Tested on Pycharm 2018 and 2017. | 2 | 124 | 0 | I have PyCharm 1.5.4 and have used the "Open Directory" option to open the contents of a folder in the IDE.
I have Python version 3.2 selected (it shows up under the "External Libraries" node).
How can I select another version of Python (that I already have installed on my machine) so that PyCharm uses that version ins... | How to select Python version in PyCharm? | 0.066568 | 0 | 0 | 203,082 |
10,322,424 | 2012-04-25T19:27:00.000 | 4 | 0 | 1 | 0 | python,configuration,pycharm | 26,644,056 | 6 | false | 0 | 0 | This can also happen in Intellij Ultimate, which has PyCharm integrated. The issue is as diagnosed above, you have the wrong interpreter selected.
The exact method to fix this for any given project is to go to Project Settings...Project and adjust the Project SDK. You can add a New Project SDK if you don't have Python ... | 2 | 124 | 0 | I have PyCharm 1.5.4 and have used the "Open Directory" option to open the contents of a folder in the IDE.
I have Python version 3.2 selected (it shows up under the "External Libraries" node).
How can I select another version of Python (that I already have installed on my machine) so that PyCharm uses that version ins... | How to select Python version in PyCharm? | 0.132549 | 0 | 0 | 203,082 |
10,322,632 | 2012-04-25T19:43:00.000 | 0 | 0 | 1 | 0 | django,virtualenv,documentation-generation,python-sphinx | 10,322,795 | 1 | true | 1 | 0 | The api documentation for your code can only be generated with proper access to your code, so the anser will be "no, you'll need to have them both in the same virtualenv".
Some extra thoughts:
If your code virtualenv isn't isolated from the system's python packages, you could install sphinx globally, but you probably ... | 1 | 1 | 0 | I have multiple django projects running different django versions in their own virtualenv. I want to use sphinx-api-doc command to generate api docs for the django projects. However i dont want to install sphinx directly in the system and would like to install it in a separate virtualenv.
Since only one virtualenv can ... | Using sphinx-api-doc when both sphinx and django are in multiple virtualenv | 1.2 | 0 | 0 | 388 |
10,322,938 | 2012-04-25T20:05:00.000 | 3 | 0 | 1 | 0 | python | 10,322,992 | 4 | true | 0 | 0 | If it's exactly that format, you could just print out line[3:7] | 2 | 0 | 0 | I have long a text file where each line looks something like /MM0001 (Table(12,)) or /MM0015 (Table(11,)). I want to keep only the four-digit number next to /MM. If it weren't for the "table(12,)" part I could just strip all the non-numeric characters, but I don't know how to extract the four-digit numbers only. Any ad... | Removing selected characters from text file | 1.2 | 0 | 0 | 460 |
10,322,938 | 2012-04-25T20:05:00.000 | 2 | 0 | 1 | 0 | python | 10,322,983 | 4 | false | 0 | 0 | You could parse text line by line and then use 4th to 7th char of every line.
ln[3:7] | 2 | 0 | 0 | I have long a text file where each line looks something like /MM0001 (Table(12,)) or /MM0015 (Table(11,)). I want to keep only the four-digit number next to /MM. If it weren't for the "table(12,)" part I could just strip all the non-numeric characters, but I don't know how to extract the four-digit numbers only. Any ad... | Removing selected characters from text file | 0.099668 | 0 | 0 | 460 |
10,325,072 | 2012-04-25T23:09:00.000 | 1 | 1 | 0 | 0 | python,graph,hadoop,graph-theory | 11,112,245 | 2 | false | 0 | 0 | Streaming out to a scripting language is not yet supported but certainly would be a good addition. Patches welcome. | 1 | 6 | 0 | Is python supported on Giraph and if it is, is it as well-supported as python is on Hadoop or well it lead to considerably worse performance than using raw Java? | Can I use python with giraph? | 0.099668 | 0 | 0 | 2,017 |
10,325,418 | 2012-04-25T23:52:00.000 | 1 | 0 | 1 | 0 | python,collision-detection,pygame | 11,217,539 | 1 | false | 0 | 1 | you could make it so that when your character hits a block, they move up at the current speed until they are no longer colliding with the polygon. That way, when you hit the ground from above,you don't go downward through it, but when you hit the bottom, you do. I would recommend a while loop set to the collide functio... | 1 | 0 | 0 | I am trying to implement a Mario type plat-former in pyGame. I have Collision detection working with Polygons no problem. I am curious how I can get the player to be able to jump through the floor above him, which is a polygon floating in air.
What is the theory on how to handle that? | Jump Through Polygon/Floor Collision Detection | 0.197375 | 0 | 0 | 228 |
10,325,600 | 2012-04-26T00:15:00.000 | 0 | 0 | 1 | 0 | python,pywin32,robot | 10,326,072 | 1 | false | 0 | 1 | Does this problem occurred with every Python you run? Based on your problem description it is not certain if this problem is specific to the script you are trying to run or it is a general issue.
What I will do is that try running builtin demo script first to test & verify that you do have full set of libraries install... | 1 | 0 | 0 | So when I try to run a file in PyWin, it opens an edit window instead. The first could times that it did this, I assumed it was due to some syntax errors in the file, but after I fixed them, it continued to open an edit window each time. This particular file has a lot of defined functions in it if that helps at all. | Trouble Running a File in PyWin | 0 | 0 | 0 | 118 |
10,327,804 | 2012-04-26T05:40:00.000 | 1 | 1 | 0 | 1 | python,macos,unix,filesystems,osx-lion | 10,327,842 | 2 | false | 0 | 0 | os.link claims to work on all Unix platforms. Are there any OS X specific issues with it? | 1 | 0 | 0 | I'm assuming with a call to a UNIX shell, but I was wondering if there are other options from within Python. | How to create a hard link from within a Python script on a Mac? | 0.099668 | 0 | 0 | 2,229 |
10,328,943 | 2012-04-26T07:24:00.000 | 0 | 0 | 0 | 0 | python-3.x,pixels | 10,331,335 | 1 | false | 0 | 1 | You need to use some sort of cross-platform GUI toolkit, such as GTK or KDE, maybe Tk or wx will work as well, I don't know.
How you then do it depends on what toolkit you choose. | 1 | 1 | 0 | I am using Python3 on Windows 7. I want to grab all the attributes like color intensity, color etc. Of all the pixels of the screen area that I select with mouse. The selection can be of any shape but right now rectangular and square will do.
I want to do it in any area of the screen.
Can you guys please guide me how ... | Grabbing pixel attributes in Python | 0 | 0 | 0 | 185 |
10,329,486 | 2012-04-26T08:09:00.000 | 1 | 0 | 0 | 0 | python,sql,sql-injection | 10,329,694 | 4 | false | 0 | 0 | I don't know if this is in any way applicable but I am just putting it up there for completeness and experts can downvote me at will... not to mention i have concerns about its performance in some cases.
I was once tasked with protecting an aging web app written in classic asp against sql injection (they were getting h... | 4 | 0 | 0 | I have done my homework in reading about protection against sql injection attacks: I know that I need to use parameter binding but:
I already do this, thank you.
I know that some of the db drivers my users use implement parameter binding in the most stupid possible way. i.e., they are prone to sql injection attacks. I... | protecting against sql injection attacks beyond parameter binding | 0.049958 | 1 | 0 | 621 |
10,329,486 | 2012-04-26T08:09:00.000 | 2 | 0 | 0 | 0 | python,sql,sql-injection | 10,336,420 | 4 | true | 0 | 0 | I already do this, thank you.
Good; with just this, you can be totally sure (yes, totally sure) that user inputs are being interpreted only as values. You should direct your energies toward securing your site against other kinds of vulnerabilities (XSS and CSRF come to mind; make sure you're using SSL properly, et-... | 4 | 0 | 0 | I have done my homework in reading about protection against sql injection attacks: I know that I need to use parameter binding but:
I already do this, thank you.
I know that some of the db drivers my users use implement parameter binding in the most stupid possible way. i.e., they are prone to sql injection attacks. I... | protecting against sql injection attacks beyond parameter binding | 1.2 | 1 | 0 | 621 |
10,329,486 | 2012-04-26T08:09:00.000 | 0 | 0 | 0 | 0 | python,sql,sql-injection | 10,336,013 | 4 | false | 0 | 0 | So, I would like to add an extra layer of protection by adding extra sanitization of http-facing user input.
This strategy is doomed to fail. | 4 | 0 | 0 | I have done my homework in reading about protection against sql injection attacks: I know that I need to use parameter binding but:
I already do this, thank you.
I know that some of the db drivers my users use implement parameter binding in the most stupid possible way. i.e., they are prone to sql injection attacks. I... | protecting against sql injection attacks beyond parameter binding | 0 | 1 | 0 | 621 |
10,329,486 | 2012-04-26T08:09:00.000 | -1 | 0 | 0 | 0 | python,sql,sql-injection | 10,329,550 | 4 | false | 0 | 0 | Well in php, I use preg_replace to protect my website from being attacked by sql injection. preg_match can also be used. Try searching an equivalent function of this in python. | 4 | 0 | 0 | I have done my homework in reading about protection against sql injection attacks: I know that I need to use parameter binding but:
I already do this, thank you.
I know that some of the db drivers my users use implement parameter binding in the most stupid possible way. i.e., they are prone to sql injection attacks. I... | protecting against sql injection attacks beyond parameter binding | -0.049958 | 1 | 0 | 621 |
10,331,518 | 2012-04-26T10:21:00.000 | 0 | 0 | 0 | 1 | django,wxpython,sql-server-2008-r2,vmware,python-2.7 | 10,331,810 | 2 | true | 1 | 0 | Maybe this could help you a bit, although my set-up is slightly different. I am running an ASP.NET web app developed on Windows7 via VMware fusion on OS X. I access the web app from outside the VM (browser of Mac or other computers/phones within the network).
Here are the needed settings:
Network adapter set to (Bridg... | 1 | 0 | 0 | We have developed an application using DJango 1.3.1, Python 2.7.2 using Database as SQL server 2008. All these are hosted in Win 2008 R2 operating system on VM. The clients has windows 7 as o/s.
We developed application keeping in view with out VM, all of sudden client has come back saying they can only host the appl... | Steps to access Django application hosted in VM from Windows 7 client | 1.2 | 1 | 0 | 422 |
10,332,337 | 2012-04-26T11:18:00.000 | 4 | 0 | 0 | 0 | python,eclipse,pydev,webfaction | 10,332,409 | 1 | true | 1 | 0 | Don't do that. Your host is for hosting. Your personal machine is for developing.
Edit and run your code locally. When it's ready, upload it to Webfaction. Don't edit code on your server. | 1 | 2 | 0 | This is my first time purchasing a hosting and I opted for Webfaction.com to host my Django application. So far, i've been using Eclipse to write all my code and manage my Django application and I'm not ready to use VIM as a text editor yet. Now my question is, how can I use Eclipse to write my code and manage all my f... | Eclipse with Webfaction and Django | 1.2 | 0 | 0 | 146 |
10,335,259 | 2012-04-26T14:12:00.000 | 1 | 1 | 0 | 1 | python | 10,335,348 | 1 | false | 0 | 0 | The one in /usr/bin is in your PATH and can be executed by calling its filename in a shell.
The second one is in library directory referenced by PYTHONPATH or sys.path and can be used as a module in python scripts.
They are probably hard or symlinks if they have the same content. | 1 | 0 | 0 | After installing python on Linux, smtpd.py will be installed under /usr/bin directory. Why does this module exist here? How about the other one under directory /usr/lib/python2.x? What's the difference? | Why two smtpd.py are installed? | 0.197375 | 0 | 0 | 181 |
10,336,582 | 2012-04-26T15:28:00.000 | 0 | 0 | 0 | 0 | python,django | 10,336,728 | 1 | true | 1 | 0 | If i'm reading your question correctly the first part wants to make a stylesheet that is dynamic???
I am unable to figure out how to make my stylesheet dynamic for front
end
For that you could use something like
Django admin follows convention of adding {% block extra_head %} (or something similar, sorry don't reme... | 1 | 0 | 0 | I am new to Django framework and kindly consider if my question is novice.
I have created a polls application using the django framwork. I am unable to figure out how to make my stylesheet dynamic for front end. As i dont want to call it in my base_site.html or index.html files as I am also multiple views render differ... | Django Application Assign Stylesheet -- don't want to add it to app's index file? Can it be dynamic? | 1.2 | 0 | 0 | 76 |
10,337,029 | 2012-04-26T15:56:00.000 | 3 | 0 | 1 | 0 | python,pip,pymssql,yolk | 10,344,015 | 3 | true | 0 | 0 | yolk only search trough PyPI XMLRPC API as far as I know, while pip crawls the web looking for the "best" package that fits - the seed page is http://pypi.python.org/simple/<PACKAGE_NAME>. | 2 | 3 | 0 | I need some help understanding how pip and yolk work
I ran pip install pymssql, which installed pymssql version 2.0.0b1-dev-20111019, but then decided that I'd like to revert to an older version.
I ran yolk -V pymssql to check which versions I have available, but it only returns pymssql 1.0.2. Shouldn't the version th... | Packages as seen through yolk or pip | 1.2 | 0 | 0 | 949 |
10,337,029 | 2012-04-26T15:56:00.000 | 1 | 0 | 1 | 0 | python,pip,pymssql,yolk | 10,337,504 | 3 | false | 0 | 0 | Yeah, look at the pip.log file to see where it's searching for packages. I think yolk is just looking at what's registered on pypi, but pip is looking all over the place for the most up to date versions it can find. | 2 | 3 | 0 | I need some help understanding how pip and yolk work
I ran pip install pymssql, which installed pymssql version 2.0.0b1-dev-20111019, but then decided that I'd like to revert to an older version.
I ran yolk -V pymssql to check which versions I have available, but it only returns pymssql 1.0.2. Shouldn't the version th... | Packages as seen through yolk or pip | 0.066568 | 0 | 0 | 949 |
10,337,451 | 2012-04-26T16:24:00.000 | 2 | 0 | 1 | 1 | python,shell,loops,subprocess | 10,337,484 | 2 | true | 0 | 0 | You subprocess.call probably blocked on whatever your command was. I doubt its your python script, but rather whatever the shell command might be (taking too long).
You can tell if your command is completing or not by checking the return code:
print subprocess.call(["command","param"])
It should print 0 if it was succe... | 2 | 0 | 0 | The following little script is supposed to run a shell command with a parameter every 10 minutes. It's ran correctly once (30 minutes ago) however isn't playing ball now (should have done the process another 2 times since). Have I made an error?
while(True):
subprocess.call(["command","param"])
time.sleep(600) | Python invoking shell command with params loop | 1.2 | 0 | 0 | 488 |
10,337,451 | 2012-04-26T16:24:00.000 | 1 | 0 | 1 | 1 | python,shell,loops,subprocess | 10,337,506 | 2 | false | 0 | 0 | Try subprocess.Popen if you don't need to wait for the command to complete.
From the docs,
subprocess.call: Run the command described by args. Wait for command to complete, then return the returncode attribute. | 2 | 0 | 0 | The following little script is supposed to run a shell command with a parameter every 10 minutes. It's ran correctly once (30 minutes ago) however isn't playing ball now (should have done the process another 2 times since). Have I made an error?
while(True):
subprocess.call(["command","param"])
time.sleep(600) | Python invoking shell command with params loop | 0.099668 | 0 | 0 | 488 |
10,340,141 | 2012-04-26T19:33:00.000 | 5 | 0 | 1 | 1 | python,macos,emacs | 10,340,315 | 1 | true | 0 | 0 | In general I would do M-x describe-function RET python-mode--by default bound to C-h f-- and the first line in the info window is: python-mode is an interactive compiled Lisp function in ``python.el'.
And that python.el is clickable, for me, and takes me to the file that it was defined in, at which point M-x pwd works. | 1 | 1 | 0 | I'm looking to play with python mode for emacs on mac os x, but I can't seem to find the source files for the mode.
What are the standard locations, where a default installation of emacs might have put its modes when installed on Mac OS X?
(I'm using GNU Emacs 24.0.95.1 (i386-apple-darwin11.3.0, NS apple-appkit-1138.32... | Where can I find the source for "python mode" when editing emacs configuration for mac os x? | 1.2 | 0 | 0 | 108 |
10,341,707 | 2012-04-26T21:30:00.000 | 13 | 0 | 0 | 0 | python,django,virtualenv | 10,341,733 | 1 | true | 1 | 0 | In case you are using pip for package management, you can easily recreate the virtualenv on another system:
On system1, run pip freeze --local > requirements.txt and copy that file to system2. Over there, create and activate the virtualenv and use pip install -r requirements.txt to install all packages that were instal... | 1 | 5 | 0 | I would like to know how to setup a complex python website, that is currently running in production environment, into a local machine for development?
Currently the site uses python combined with Django apps (registration + cms modules) in a virtual environment. | How to migrate a python site to another machine? | 1.2 | 0 | 0 | 2,657 |
10,343,052 | 2012-04-27T00:01:00.000 | 0 | 0 | 0 | 0 | python,animation,pygame | 11,236,094 | 3 | false | 0 | 1 | You could just make something called xscroll that is added to everything that is supposed to scroll across the screen. Then, when you reach a certain distance from the center, instead of adding your players movespeed to his position, you add or subtract the movespeed from xscroll. This makes everything move very smooth... | 1 | 1 | 0 | My game is a platform game. I want the player to move when it is X pixels away from the center, moving left or right.
I understand pygame doesn't have anything that would make a camera move.
When the player has reached the point where it is X pixels away from the center, stop the player movement and have the terrain mo... | How would I go about making a camera like movement in pygame? | 0 | 0 | 0 | 2,011 |
10,345,327 | 2012-04-27T05:41:00.000 | 34 | 0 | 0 | 0 | python,sqlalchemy | 12,837,029 | 4 | false | 0 | 0 | If you need the proper return type, just return session.query(MyObject).filter(sqlalchemy.sql.false()).
When evaluated, this will still hit the DB, but it should be fast.
If you don't have an ORM class to "query", you can use false() for that as well:
session.query(sqlalchemy.false()).filter(sqlalchemy.false()) | 1 | 36 | 0 | What's the best way to create an intentionally empty query in SQLAlchemy?
For example, I've got a few functions which build up the query (adding WHERE clauses, for example), and at some points I know that the the result will be empty.
What's the best way to create a query that won't return any rows? Something like Djan... | SQLAlchemy: create an intentionally empty query? | 1 | 1 | 0 | 9,094 |
10,345,821 | 2012-04-27T06:31:00.000 | 4 | 0 | 0 | 0 | python,database,sqlite | 10,345,847 | 3 | true | 1 | 0 | Consider just doing a commit after every 1000 records or so | 3 | 1 | 0 | I must parse HTML files, which can be up to 500 000 links.
Of which 400 000 will be desired by me.
Should I put all the links that satisfy the condition for the new list and then for the elements of this list and put it into the database.
Or when I find links to satisfy the condition to add it to the database (sqlite) ... | Python big list and input to database | 1.2 | 0 | 0 | 122 |
10,345,821 | 2012-04-27T06:31:00.000 | 1 | 0 | 0 | 0 | python,database,sqlite | 10,345,975 | 3 | false | 1 | 0 | If these many links are spread across several files, what about a commit after processing each file? Then you as well could remember which files you have processed.
In the case of a single file, record the file offset after each commit for clean continuation. | 3 | 1 | 0 | I must parse HTML files, which can be up to 500 000 links.
Of which 400 000 will be desired by me.
Should I put all the links that satisfy the condition for the new list and then for the elements of this list and put it into the database.
Or when I find links to satisfy the condition to add it to the database (sqlite) ... | Python big list and input to database | 0.066568 | 0 | 0 | 122 |
10,345,821 | 2012-04-27T06:31:00.000 | 0 | 0 | 0 | 0 | python,database,sqlite | 10,346,693 | 3 | false | 1 | 0 | You can try to use noSQL database like mongo. With mongo I add 500.000 documents with 6 fields in each added about 15 seconds (on my old laptop), and about 0.023 sec on not difficult queries. | 3 | 1 | 0 | I must parse HTML files, which can be up to 500 000 links.
Of which 400 000 will be desired by me.
Should I put all the links that satisfy the condition for the new list and then for the elements of this list and put it into the database.
Or when I find links to satisfy the condition to add it to the database (sqlite) ... | Python big list and input to database | 0 | 0 | 0 | 122 |
10,346,394 | 2012-04-27T07:20:00.000 | 2 | 0 | 1 | 0 | python,parsing,exception-handling | 10,346,480 | 3 | true | 0 | 0 | Since you seem to have a need for quite some validation I would simply wrap all validation 'errors' on a given input in a ValidationSummary object / instance (which contains a list of everything which went wrong) and pass that around instead.
On a more general note: contrary to other languages, structuring program flow... | 2 | 0 | 0 | Let's say I have some isolated Python code that processes data produced by some other entity (E.g. a client).
The data I receive may be in incorrect form (e.g. due to client's sloppiness, data corruption, you name it), so that processing in my Python code will somehow fail, and that will lead to some exception being ra... | Python exceptions and parsing of complex data | 1.2 | 0 | 0 | 253 |
10,346,394 | 2012-04-27T07:20:00.000 | 0 | 0 | 1 | 0 | python,parsing,exception-handling | 10,346,983 | 3 | false | 0 | 0 | In my opinion, using exceptions is more reliable than just returning the error codes from functions. The reason is that testing the returned value makes the code around the calls more unreadable and one tends not to check it. So, go for exceptions.
If you are not sure, use only the generic exceptions -- i.e. do not c... | 2 | 0 | 0 | Let's say I have some isolated Python code that processes data produced by some other entity (E.g. a client).
The data I receive may be in incorrect form (e.g. due to client's sloppiness, data corruption, you name it), so that processing in my Python code will somehow fail, and that will lead to some exception being ra... | Python exceptions and parsing of complex data | 0 | 0 | 0 | 253 |
10,348,653 | 2012-04-27T10:02:00.000 | 1 | 0 | 1 | 0 | python | 10,349,053 | 4 | false | 0 | 0 | Recently our class at school used all of the above programs. about a handful of students had trouble installing like you described. Fortunally I didnt not have this problen but I can suggest you use Administration priviledges.
Make sure you download the correct version.
Go to your download folder and look at the file ... | 2 | 3 | 0 | I have a problem with the following command:
setup.py install.
I know it should work, I have tried it on a laptop but I don't have access to it at the moment. I need to complete a homework so I tried the same on my PC. And when I type the same command into cmd it just runs pyscripter as if I would use right click ... | Can't install python modules | 0.049958 | 0 | 0 | 12,880 |
10,348,653 | 2012-04-27T10:02:00.000 | 1 | 0 | 1 | 0 | python | 10,348,797 | 4 | false | 0 | 0 | Do python setup.py install instead.
Windows is probably not set up to recognize .py files as executable. | 2 | 3 | 0 | I have a problem with the following command:
setup.py install.
I know it should work, I have tried it on a laptop but I don't have access to it at the moment. I need to complete a homework so I tried the same on my PC. And when I type the same command into cmd it just runs pyscripter as if I would use right click ... | Can't install python modules | 0.049958 | 0 | 0 | 12,880 |
10,348,770 | 2012-04-27T10:10:00.000 | 0 | 0 | 1 | 1 | python,mechanize,lxml | 10,475,706 | 6 | false | 0 | 0 | I'm not happy with any of the solutions offered. Hopefully someone will come along with a better one but for now it seems safe to say that there is no simple solution for installing python + mechanize + lxml + arbitrary other libraries on windows. | 1 | 3 | 0 | What is the easiest way to install python 2 plus lxml plus mechanize on windows? I'm looking for a solution that is easy to follow and also makes it easy to install other libraries (eggs?) in the future.
Edit
I want to be able to install libraries which require a compiler. Ruby for windows has a dev kit which allows yo... | install python + mechanize + lxml on windows | 0 | 0 | 0 | 8,933 |
10,349,093 | 2012-04-27T10:35:00.000 | 1 | 0 | 0 | 0 | authentication,ldap,splunk,python-ldap | 10,397,477 | 3 | false | 0 | 0 | Typically you would search using the username value provided on uid or cn values within the LDAP Tree.
-jim | 2 | 1 | 0 | I have set up a Ldap Server somewhere. I can bind to it, can add, modify, delete entry in the database. Now when it come to authentication isnt it as simple as giving the username and password to the server, asking it to search for an entry matching the two? And furthermore, isnt it the 'userPassword' field that contai... | how to do Ldap Server Authentication? | 0.066568 | 0 | 0 | 1,711 |
10,349,093 | 2012-04-27T10:35:00.000 | 2 | 0 | 0 | 0 | authentication,ldap,splunk,python-ldap | 10,349,171 | 3 | true | 0 | 0 | LDAP servers are generally not going to allow you to search on the userPassword attribute, for obvious security reasons. (and the password attribute is likely stored in hashed form anyway, so a straight search would not work.)
Instead, the usual way to do LDAP authentication is:
prompt for username & password
Bind to... | 2 | 1 | 0 | I have set up a Ldap Server somewhere. I can bind to it, can add, modify, delete entry in the database. Now when it come to authentication isnt it as simple as giving the username and password to the server, asking it to search for an entry matching the two? And furthermore, isnt it the 'userPassword' field that contai... | how to do Ldap Server Authentication? | 1.2 | 0 | 0 | 1,711 |
10,351,450 | 2012-04-27T13:23:00.000 | 3 | 0 | 0 | 0 | python,c,numpy | 10,352,335 | 2 | true | 0 | 0 | I would say it depends on your skills/experience and your project.
If this is very ponctual and you are profficient in C/C++ and you have already written python wrapper, then write your own extension and interface it.
If you are going to work with Numpy on other project, then go for the Numpy C-API, it's extensive and ... | 1 | 0 | 1 | As there are multitude of ways to write binary modules for python, i was hopping those of you with experience could advice on the best approach if i wish to improve the performance of some segments of the code as much as possible.
As i understand, one can either write an extension using the python/numpy C-api, or wrap ... | best way to extend python / numpy performancewise | 1.2 | 0 | 0 | 1,000 |
10,355,953 | 2012-04-27T18:30:00.000 | 6 | 1 | 0 | 0 | python,plc,siemens,s7-1200 | 10,782,983 | 7 | true | 1 | 0 | After failing with libnodave and OPC, I created a TCON,TSEND and TRECV communication thing. It transmits a byte over TCP and it works. | 3 | 10 | 0 | I am running a process on a S7-1200 plc and I need it to send a start signal to my python script, after the script is done running it needs to send something back to the plc to initiate the next phase. Oh, and it has to be done in ladder.
Is there a quick and dirty way to send things over profibus or am I better off us... | How can I communicate between a Siemens S7-1200 and python? | 1.2 | 0 | 0 | 38,421 |
10,355,953 | 2012-04-27T18:30:00.000 | 2 | 1 | 0 | 0 | python,plc,siemens,s7-1200 | 24,056,273 | 7 | false | 1 | 0 | There is a commercial library called "S7connector" by Rothenbacher GmbH (obviously it's not the "s7connector" on sourceforge).
It is for the .NET framework, so could be used with IronPython.
It does work with S7-1200 PLCs. You just have to make sure a DB you want to read from / write to is not an optimized S7-1200 styl... | 3 | 10 | 0 | I am running a process on a S7-1200 plc and I need it to send a start signal to my python script, after the script is done running it needs to send something back to the plc to initiate the next phase. Oh, and it has to be done in ladder.
Is there a quick and dirty way to send things over profibus or am I better off us... | How can I communicate between a Siemens S7-1200 and python? | 0.057081 | 0 | 0 | 38,421 |
10,355,953 | 2012-04-27T18:30:00.000 | 1 | 1 | 0 | 0 | python,plc,siemens,s7-1200 | 10,773,413 | 7 | false | 1 | 0 | Ther best way to communicate with S7-1200 PLC cpu's is with OPC UA or Classic OPC (ommonly known as OPC DA. ) Libnodave is made for S7-300 and S7-400 not for S71200 (2.x firmware).
If you use a third party solution to communicate with S7-1200 (or S7-1500) you have to decrease the security level at the PLC by allowing ... | 3 | 10 | 0 | I am running a process on a S7-1200 plc and I need it to send a start signal to my python script, after the script is done running it needs to send something back to the plc to initiate the next phase. Oh, and it has to be done in ladder.
Is there a quick and dirty way to send things over profibus or am I better off us... | How can I communicate between a Siemens S7-1200 and python? | 0.028564 | 0 | 0 | 38,421 |
10,356,581 | 2012-04-27T19:17:00.000 | 1 | 0 | 0 | 0 | python,django,facebook,sqlite | 10,486,708 | 1 | true | 1 | 0 | You should use django-facebook instead, it does that and more and it is actively supported :) | 1 | 0 | 0 | I'm using django-1.4 , sqlite3 , django-facebookconnect
Following instructions in Wiki to setup .
"python manage.py syncdb" throws an error .
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_... | Getting db_type() error while using django-facebook connect for DjangoApp | 1.2 | 1 | 0 | 282 |
10,356,870 | 2012-04-27T19:42:00.000 | 3 | 0 | 1 | 0 | python,api,dropbox-api,api-key | 10,357,811 | 3 | false | 0 | 0 | Plain text. Any obfuscation attempt is futile if the code gets distributed. | 3 | 8 | 0 | In my case I'm using the Dropbox API. Currently I'm storing the key and secret in a JSON file, just so that I can gitignore it and keep it out of the Github repo, but obviously that's no better than having it in the code from a security standpoint. There have been lots of questions about protecting/obfuscating Python b... | How should I store API keys in a Python app? | 0.197375 | 0 | 1 | 5,852 |
10,356,870 | 2012-04-27T19:42:00.000 | 2 | 0 | 1 | 0 | python,api,dropbox-api,api-key | 10,360,373 | 3 | false | 0 | 0 | Don't know if this is feasible in your case. But you can access the API via a proxy that you host.
The requests from the Python APP go to the proxy and the proxy makes the requests to the Dropbox API and returns the response to the Python app. This way your api key will be at the proxy that you're hosting. The access t... | 3 | 8 | 0 | In my case I'm using the Dropbox API. Currently I'm storing the key and secret in a JSON file, just so that I can gitignore it and keep it out of the Github repo, but obviously that's no better than having it in the code from a security standpoint. There have been lots of questions about protecting/obfuscating Python b... | How should I store API keys in a Python app? | 0.132549 | 0 | 1 | 5,852 |
10,356,870 | 2012-04-27T19:42:00.000 | 2 | 0 | 1 | 0 | python,api,dropbox-api,api-key | 11,080,881 | 3 | false | 0 | 0 | There are two ways depending on your scenario:
If you are developing a web application for end users, just host it in a way that your API key does not come to disclosure. So keeping it gitignored in a separate file and only upload it to your server should be fine (as long there is no breach to your server). Any obfusca... | 3 | 8 | 0 | In my case I'm using the Dropbox API. Currently I'm storing the key and secret in a JSON file, just so that I can gitignore it and keep it out of the Github repo, but obviously that's no better than having it in the code from a security standpoint. There have been lots of questions about protecting/obfuscating Python b... | How should I store API keys in a Python app? | 0.132549 | 0 | 1 | 5,852 |
10,359,617 | 2012-04-28T00:57:00.000 | 1 | 0 | 0 | 0 | python,postgresql,sqlsoup | 10,360,094 | 1 | false | 0 | 0 | After talking with some folks, it's pretty clear the better answer is to use Pig to process and aggregate my data locally. At the scale, I'm operating it wasn't clear Hadoop was the appropriate tool to be reaching for. One person I talked to about this suggests Pig will be orders of magnitude faster than in-DB operatio... | 1 | 0 | 0 | I have a large dataset of events in a Postgres database that is too large to analyze in memory. Therefore I would like to quantize the datetimes to a regular interval and perform group by operations within the database prior to returning results. I thought I would use SqlSoup to iterate through the records in the appro... | Data Transformation in Postgres Using SqlSoup | 0.197375 | 1 | 0 | 333 |
10,363,438 | 2012-04-28T12:20:00.000 | 0 | 0 | 1 | 0 | python,cherrypy,kill-process | 10,370,708 | 2 | false | 0 | 0 | If your process is using CherryPy to block (via quickstart or engine.block), then you could simply call: cherrypy.engine.exit() from your page handler. That would be the cleanest option since it would properly terminate CherryPy and plugins you may have subscribed to. | 1 | 0 | 0 | I am using cherrypy in python script.I think I have to register a callback method from the main application so that i can stop cherrypy main process from a worker thread,but how do i kill the main process within the that process.
So i want to know how to stop cherrypy from within the main process. | How to kill the cherrypy process? | 0 | 0 | 0 | 1,787 |
10,364,032 | 2012-04-28T13:41:00.000 | 2 | 0 | 1 | 0 | python,memory | 10,364,138 | 3 | false | 0 | 0 | Have you tried the built in ctypes module?
It provides a memset function which should give you what you need. | 2 | 8 | 0 | Lets say that memory address 0A7F03E4 stores a value 124. How to change it to 300 using python? Is there a module supplied for this kind of task? | How to change the value stored in memory address? | 0.132549 | 0 | 0 | 9,238 |
10,364,032 | 2012-04-28T13:41:00.000 | 1 | 0 | 1 | 0 | python,memory | 10,364,171 | 3 | false | 0 | 0 | On UNIX, you can try to open() the /dev/mem device to access the physical memory, and then use the seek() method of the file object set the file pointer to the right location. Then use the write() method to change the value. Don't forget to encode the number as a raw string!
Generally, only the root user has access to ... | 2 | 8 | 0 | Lets say that memory address 0A7F03E4 stores a value 124. How to change it to 300 using python? Is there a module supplied for this kind of task? | How to change the value stored in memory address? | 0.066568 | 0 | 0 | 9,238 |
10,364,900 | 2012-04-28T15:25:00.000 | 0 | 0 | 0 | 0 | python,events,wxpython,wxwidgets | 10,385,658 | 4 | false | 0 | 1 | I don't think there is such an event, but you can try wx.EVT_SET_CURSOR. Alternatively, you can catch wx.EVT_CHAR or one of the EVT_KEY_* events and use the TextCtrl's GetInsertionPoint() method to know where the cursor is. You may need to call the method when you click around in the text control using mouse events as ... | 1 | 1 | 0 | What event is called when the caret inside a TextCtrl / Styled TextCtrl has its position changed? I need to bind the event to show in the status bar, the current position of the caret. | wxPython caret move event | 0 | 0 | 0 | 1,551 |
10,366,424 | 2012-04-28T18:36:00.000 | 0 | 0 | 0 | 0 | python,python-2.7 | 10,366,467 | 5 | false | 0 | 0 | Just derive to a new class and override the insert function. In the overwriting function, check last insert time and call father's insert method if it has been more than five minutes, and of course update the most recent insert time. | 2 | 1 | 0 | I have a python script that gets data from a USB weather station, now it puts the data into MySQL whenever the data is received from the station.
I have a MySQL class with an insert function, what i want i that the function checks if it has been run the last 5 minutes if it has, quit.
Could not find any code on the int... | Python, function quit if it has been run the last 5 minutes | 0 | 1 | 0 | 489 |
10,366,424 | 2012-04-28T18:36:00.000 | 0 | 0 | 0 | 0 | python,python-2.7 | 10,366,452 | 5 | false | 0 | 0 | Each time the function is run save a file with the current time. When the function is run again check the time stored in the file and make sure it is old enough. | 2 | 1 | 0 | I have a python script that gets data from a USB weather station, now it puts the data into MySQL whenever the data is received from the station.
I have a MySQL class with an insert function, what i want i that the function checks if it has been run the last 5 minutes if it has, quit.
Could not find any code on the int... | Python, function quit if it has been run the last 5 minutes | 0 | 1 | 0 | 489 |
10,366,687 | 2012-04-28T19:11:00.000 | 1 | 0 | 0 | 0 | python,django,literals,base | 10,366,811 | 2 | false | 1 | 0 | What kind of field is assignedTo? I'd guess it's a foreign key, in which case it's trying to do the filter on an id, when you're passing a string. Am I right?
The problem here is that assignedTo is being treated as an int (either it is an int, or is being compared on the basis of an int, such as a foreign key id), and ... | 1 | 0 | 0 | I am using django/python.
Here's where the data comes from:
User selects one or more options from a <select name="op_assignedTo">
I also use <option value="username">
The data is sent via POST and collected in a django view:
op_assignedTo = request.POST.getlist('op_assignedTo')
But the following line is ... | Why am I getting error: "Value Error" - invalid literal for int() with base 10: 'matthew' | 0.099668 | 0 | 0 | 965 |
10,367,358 | 2012-04-28T20:41:00.000 | 1 | 0 | 1 | 0 | python,package,bitbucket,easy-install,pypi | 10,368,439 | 1 | true | 0 | 0 | PyPi meta-data changes can be done by simply redoing the python setup.py register step again, so you can simply edit your setup.py to change the download URL and then repeat the registration step.
Keep in mind that automated install tools like easy_install, pip, etc. can generally scan a page linked to by the download ... | 1 | 3 | 0 | I'm developing a python package in bitbucket and would like to index it in pypi. The operations I do whenever I have a new download seems quite inefficient, which trigger this question.
I've uploaded a new package into pypi using
python setup.py register sdist upload
Then I've configured the new package also to appea... | Is it possible just to update the details in the pypi index, without recreating package? | 1.2 | 0 | 0 | 83 |
10,368,134 | 2012-04-28T22:30:00.000 | 1 | 0 | 1 | 0 | python,data-structures | 10,368,172 | 2 | false | 0 | 0 | Python dictionary object is one of the most optimized parts of the whole Python language and the reason is that dictionaries are used everywhere.
For example normally every object instance of every class uses a dictionary to keep instance data members content, the class is a dictionary containing the methods, the modul... | 1 | 1 | 0 | I am new to python. I need a data structure to store counts of some objects. For example, I want to store the most visited webpages. Lets say. I have 100 the most visited webpages. I keep the counts of visits to each webpage. I may need to update the list. I will definitely update the visit-counts. It does not have to ... | python dictionary structure, speed concerns | 0.099668 | 0 | 0 | 249 |
10,368,361 | 2012-04-28T23:08:00.000 | 2 | 1 | 0 | 1 | python,profile,.bash-profile | 10,368,402 | 2 | true | 0 | 0 | python works out of the box on OS X (as does ruby, for that matter). The only changes I would recommend for a beginner are:
1) Python likes to be reassured that the terminal can handle UTF-8 before it will print Unicode strings. Add export LANG=en_US.UTF-8 to .profile. (It may be that the .UTF-8 part is already present... | 1 | 5 | 0 | I new to Python and to programming in general. I'm a novice, and do not work in programming, just trying to teach myself how to program as a hobby. Prior to Python, I worked with Ruby for a bit and I learned that one of the biggest challenges was actually properly setting up my computer.
Background: I'm on a Macbook ... | Proper Unix (.profile, .bash_profile) changes for Python usage | 1.2 | 0 | 0 | 479 |
10,369,219 | 2012-04-29T02:26:00.000 | 2 | 0 | 1 | 0 | python,linux,memory-management | 10,369,327 | 2 | false | 0 | 0 | Think about the multiprocessing module as just syntax sugar around os.fork().
Now what is fork? When a process forks, the operating system creates a new child process with a new process ID, duplicating the state of the parent process (memory,environment variables, and more). | 1 | 2 | 0 | I am using multiprocessing module of python and have some confusions regarding the same.
Basically, I store some data initially in the Main process, and that is around 16GB (main memory size) as shown in the top command. I have stored these data as global Variables.
Then multiprocessing is done on this data, and proce... | Multiprocessing module showing memory for each child process same as Main process. | 0.197375 | 0 | 0 | 2,566 |
10,369,496 | 2012-04-29T03:36:00.000 | 1 | 0 | 0 | 0 | python,gtk,gtk3,pygobject | 11,075,153 | 1 | false | 0 | 1 | I don't think that is possible. The status icon is not a widget and the icon is going to be scaled by the window manager. Even if you used Cairo or PIL to generate an image on the fly to use as the icon pixbuf, it wouldn't have the effect of an embedded label in the system tray. It would instead be tiny, unreadable tex... | 1 | 6 | 0 | I'd like to create a Gtk.StatusIcon with custom text. Ideally I'd like to append this to an existing image, but text-only is ok, too. How can I achieve this?
I've seen some posts about getting a Gtk.Label's pixbuf but those methods seem to be removed from Gtk3 (pixbuf_get_from_drawable) | How do I set a Gtk.StatusIcon as Text | 0.197375 | 0 | 0 | 377 |
10,372,216 | 2012-04-29T12:44:00.000 | 0 | 0 | 1 | 1 | python,windows,ubuntu,cross-compiling | 10,456,295 | 3 | false | 0 | 0 | I have no experience deploying applications on Linux - but can't you add dependencies when you package the software for apt-get? I install packages that bring in other libraries all the time. Seems like you could do this for wx. | 1 | 5 | 0 | I've created a program using Python on Windows. How do you turn it into Linux executable? To be specific Linux Ubuntu 9.10. | Cross compiling a python script on windows into linux executable | 0 | 0 | 0 | 7,825 |
10,372,287 | 2012-04-29T12:54:00.000 | 3 | 0 | 0 | 0 | python,sockets | 10,372,331 | 1 | true | 0 | 0 | You can use makefile if you find the file interface of Python convenient. For example, you can then use methods like readlines on the socket (you'd have to implement it manually when using recv). This can be more convenient if sending text data on the socket, but YMMV. | 1 | 4 | 0 | Whats the purporse of using makefile() when working with Python Sockets??
I can make a program works just with send() and recv() functions on Python. But i read that is better to use the makefile() method to buffer the data. I didn't understand this relation and differences...any help?
Tks ! | Differences between makefile() and send() recv() Python | 1.2 | 0 | 1 | 3,003 |
10,372,355 | 2012-04-29T13:05:00.000 | 6 | 0 | 1 | 0 | python,performance,printing | 10,372,392 | 3 | true | 0 | 0 | Quite a few, but another important (or even the most important) bottleneck is unrelated to the CPU: I/O overhead. Once the bytecode instruction(s) have been dispatched and all arguments have been converted to strings, a function is called to write those strings to sys.stdout. Depending on your system and how you run th... | 3 | 0 | 0 | I ask this question because when a loop is debugged with repeated print statements, it slows down the program much more that I would have originally expected. I have gotten used to this, but now I am curious as to the technical reasons why this would be the case? It seems to me that the various calculations and assign... | How many computer instructions are involved in a Python print statement? | 1.2 | 0 | 0 | 262 |
10,372,355 | 2012-04-29T13:05:00.000 | 1 | 0 | 1 | 0 | python,performance,printing | 10,372,382 | 3 | false | 0 | 0 | This is not a matter of CPU instructions, at least not the CPU instructions in your Python program. When you do a print with a terminal emulator (command window) as output, the string to be printed is copied into a kernel buffer, then to the terminal process's memory. The overhead is in the context switching (both proc... | 3 | 0 | 0 | I ask this question because when a loop is debugged with repeated print statements, it slows down the program much more that I would have originally expected. I have gotten used to this, but now I am curious as to the technical reasons why this would be the case? It seems to me that the various calculations and assign... | How many computer instructions are involved in a Python print statement? | 0.066568 | 0 | 0 | 262 |
10,372,355 | 2012-04-29T13:05:00.000 | 2 | 0 | 1 | 0 | python,performance,printing | 10,372,745 | 3 | false | 0 | 0 | A huge, huge, huge number, especially if the output is visible on screen, such as in a terminal emulator window on a modern multitasking system.
Firstly, if you’re outputting numbers in decimal, there’s a divmod for each digit, which is a relatively expensive operation compared to, say, adding. (If you output in hexade... | 3 | 0 | 0 | I ask this question because when a loop is debugged with repeated print statements, it slows down the program much more that I would have originally expected. I have gotten used to this, but now I am curious as to the technical reasons why this would be the case? It seems to me that the various calculations and assign... | How many computer instructions are involved in a Python print statement? | 0.132549 | 0 | 0 | 262 |
10,374,645 | 2012-04-29T18:11:00.000 | 3 | 0 | 1 | 0 | python,xcode | 10,374,662 | 3 | false | 0 | 0 | 1/6 is integer division, which becomes 0. Try using 1.0/6 instead. | 2 | 3 | 0 | Tried in both Objective-C (Xcode) and Python (terminal) and (1/6)*(66.900009-62.852596) evaluates to zero both times. Anyone know why this is? Shouldn't it be 0.26246? | Why is "(1/6)*(66.900009-62.852596)" evaluating to zero? | 0.197375 | 0 | 0 | 216 |
10,374,645 | 2012-04-29T18:11:00.000 | 11 | 0 | 1 | 0 | python,xcode | 10,374,661 | 3 | true | 0 | 0 | You are doing integer arithmetic on 1/6, and the floor of 1/6 is 0. Try 1.0/6 instead. | 2 | 3 | 0 | Tried in both Objective-C (Xcode) and Python (terminal) and (1/6)*(66.900009-62.852596) evaluates to zero both times. Anyone know why this is? Shouldn't it be 0.26246? | Why is "(1/6)*(66.900009-62.852596)" evaluating to zero? | 1.2 | 0 | 0 | 216 |
10,376,129 | 2012-04-29T21:27:00.000 | 1 | 0 | 1 | 0 | python,sage | 10,376,372 | 3 | false | 0 | 0 | In the case of Sage, it's easy. Sage has complete control of its own REPL (read-evaluate-print loop), so it can parse the commands you give it and make the parts of your expression into whatever classes it wants. It is not so easy to have standard Python automatically use your integer type for integer literals, however... | 1 | 1 | 0 | I have started playing with Sage recently, and I've come to suspect that the standard Python int is wrapped in a customized class called Integer in Sage. If I type in type(1) in Python, I get <type 'int'>, however, if I type in the same thing in the sage prompt I get <type 'sage.rings.integer.Integer'>.
If I wanted to ... | Creating a customized language using Python | 0.066568 | 0 | 0 | 123 |
10,377,131 | 2012-04-30T00:07:00.000 | 1 | 0 | 0 | 0 | python,openerp | 10,379,449 | 4 | false | 1 | 0 | Depending the logged in user :
You can use the variable 'uid' but I don't think you can do 'uid.name' or 'uid.groups_id'. So the easier method will be the second.
Depending on the groups
Example : We have some users who are managers and others not, create a group 'Manager' (in a xml file !!!) and add this group to man... | 1 | 1 | 0 | I am using openerp 5.16 web.
Is there any way we can hide button depending upon the logged in user.
or how can i control the group visibility depending upon the user group. | button visibility in openerp | 0.049958 | 0 | 0 | 2,413 |
10,378,539 | 2012-04-30T04:34:00.000 | 1 | 0 | 1 | 0 | python,c,parsing,scala,lisp | 10,397,259 | 2 | true | 0 | 0 | In general, this is not possible without having a nearly complete language implementation.
There is a rudimentary preprocessor in C, which could allow to mask function declarations from an ad hoc scanning. There is a powerful metaprogramming in Lisp, which means you can only extract the definitions using a full-feature... | 1 | 1 | 0 | In the title I mention 3 different languages in which I would like to find out if a python package exists which can give me a list of identifiers for a program in any of those; so doesn't have to be all three of them as I doubt it there would be one like that. So my question is does a function or class exist in python ... | Python package to parse identifiers in a program (C, Scala, Lisp)? | 1.2 | 0 | 0 | 294 |
10,378,591 | 2012-04-30T04:43:00.000 | 4 | 0 | 0 | 0 | python,google-app-engine,python-2.7,jinja2 | 10,386,640 | 1 | true | 1 | 0 | Looks like you're confused between NDB keys and db keys. The db.Key class (here shown as datastore_types.Key) does not have a get() method. However the NDB Key class (which would be google.appengine.ext.ndb.key.Key) does. | 1 | 0 | 0 | I have a list of keys and I'm trying to get the object(s) in a Jinja2 template:
{{item.cities[0].get().name}}
UndefinedError: 'google.appengine.api.datastore_types.Key object' has no attribute 'get'
I thought one could use get() on a key even in a template but here I get the error. Is it true that it can't be done? | Can I use get on a key in a jinja template? | 1.2 | 0 | 0 | 1,136 |
10,380,922 | 2012-04-30T08:57:00.000 | 1 | 0 | 0 | 0 | python,django,apache,heroku,social-networking | 10,381,862 | 1 | false | 1 | 0 | apache Solr for fast indexing,
virtual-env ,
a library that provides connection pooling (SQLAlchemy),
django-evolution or south for migration. | 1 | 1 | 0 | Iam in a plan to develop a social networking site in *python/django.*I have decided to use following technologies to implement this.I have some doubt regarding these technologies which i had planned to use. If anyone can help me regarding this it will be helpful.I want to avoid the bottle necks when it is scale into t... | Django social networking site with heroku | 0.197375 | 0 | 0 | 675 |
10,381,594 | 2012-04-30T09:48:00.000 | 0 | 0 | 0 | 0 | python,string,random,passwords,md5 | 10,382,646 | 3 | false | 1 | 0 | short answer: you can't
longr answer:
a md5 hashsum contains 128 bits of information, so to store that you also need 128 bits. the closest you get from that to a human readable form would probably be to base64 encode it, that will leave you with 22 characters (24 with padding). that's probably as short as it gets.*
wh... | 1 | 0 | 0 | I have a md5 checksum in python; like s = '14966ba801aed57c2771c7487c7b194a'.
What I want is to shorten it and make it a string in the form 'a-zA-Z0-9_.-', without loosing entropy of my random md5 checksum.
The output have to be pronounceable, so I cant just do binascii.unhexlify(s). Nor can I do base64.encodestring(s)... | Generating random string based on some hex | 0 | 0 | 0 | 730 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.