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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,701,646 | 2010-09-13T15:04:00.000 | 2 | 0 | 0 | 1 | python,windows,environment-variables,pythonpath | 13,650,817 | 22 | false | 1 | 0 | This PYTHONPATH variable needs to be set for ArcPY when ArcGIS Desktop is installed.
PYTHONPATH=C:\arcgis\bin (your ArcGIS home bin)
For some reason it never was set when I used the installer on a Windows 7 32-bit system. | 5 | 435 | 0 | I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly.
I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it sti... | How to add to the PYTHONPATH in Windows, so it finds my modules/packages? | 0.01818 | 0 | 0 | 1,708,519 |
3,701,646 | 2010-09-13T15:04:00.000 | 6 | 0 | 0 | 1 | python,windows,environment-variables,pythonpath | 38,088,508 | 22 | false | 1 | 0 | The python 2.X paths can be set from few of the above instructions.
Python 3 by default will be installed in
C:\Users\\AppData\Local\Programs\Python\Python35-32\
So this path has to be added to Path variable in windows environment. | 5 | 435 | 0 | I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly.
I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it sti... | How to add to the PYTHONPATH in Windows, so it finds my modules/packages? | 1 | 0 | 0 | 1,708,519 |
3,701,646 | 2010-09-13T15:04:00.000 | 61 | 0 | 0 | 1 | python,windows,environment-variables,pythonpath | 14,753,412 | 22 | false | 1 | 0 | Just append your installation path (ex. C:\Python27\) to the PATH variable in System variables. Then close and open your command line and type 'python'. | 5 | 435 | 0 | I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly.
I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it sti... | How to add to the PYTHONPATH in Windows, so it finds my modules/packages? | 1 | 0 | 0 | 1,708,519 |
3,701,646 | 2010-09-13T15:04:00.000 | 1 | 0 | 0 | 1 | python,windows,environment-variables,pythonpath | 58,418,095 | 22 | false | 1 | 0 | While this question is about the 'real' Python, it did come up in a websearch for 'Iron Python PYTHONPATH'. For Iron Python users as confused as I was: It turns out that Iron Python looks for an environment variable called IRONPYTHONPATH.
Linux/Mac/POSIX users: Don't forget that not only does Windows use \ as path sepa... | 5 | 435 | 0 | I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly.
I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it sti... | How to add to the PYTHONPATH in Windows, so it finds my modules/packages? | 0.009091 | 0 | 0 | 1,708,519 |
3,702,724 | 2010-09-13T17:09:00.000 | 1 | 1 | 0 | 0 | php,python,cakephp | 3,702,748 | 3 | false | 0 | 0 | First of all, check what kinds of syndication CakePHP offers. It may expose part of its API through xmlrpc, json, RSS, and so on.
If that's not an option, connect directly to the same database the CakePHP application uses. Or alternatively, implement some php code within your CakePHP framework that expors relevant data... | 1 | 0 | 0 | I have a webapp, created using CakePhp. I need to interface with a Python script.
What is the best way to go about doing that?
(I could use pipe etc., but I want to check what the best practices are)
Thanks. | Php/Cakephp interface with Python script | 0.066568 | 0 | 0 | 1,320 |
3,702,889 | 2010-09-13T17:32:00.000 | 0 | 1 | 0 | 0 | python,emacs,textmate,environment | 3,703,093 | 4 | false | 0 | 0 | Use Command-R to run the script directly
Use Shift-Command-R to run the script from terminal. | 2 | 0 | 0 | I use TextMate to debug python script, as I like the feature of using 'Command-R' for running python from TextMate, and I learned that emacs provide similar feature.
I need to know if the python is run from command line or from TextMate/emacs. How can I do that?
ADDED
I use TextMate for python coding/debugging, and i... | How to know if I run python from Textmate/emacs? | 0 | 0 | 0 | 521 |
3,702,889 | 2010-09-13T17:32:00.000 | 1 | 1 | 0 | 0 | python,emacs,textmate,environment | 3,702,945 | 4 | false | 0 | 0 | sys.argv will tell you how Python was invoked. I don't know about TextMate, but when I tell Emacs to eval buffer, its value is ['-c']. That means it's executing a specified command, according to the man page. If Python's run directly from the command line with no parameters, sys.argv will be []. If you run a python scr... | 2 | 0 | 0 | I use TextMate to debug python script, as I like the feature of using 'Command-R' for running python from TextMate, and I learned that emacs provide similar feature.
I need to know if the python is run from command line or from TextMate/emacs. How can I do that?
ADDED
I use TextMate for python coding/debugging, and i... | How to know if I run python from Textmate/emacs? | 0.049958 | 0 | 0 | 521 |
3,703,621 | 2010-09-13T19:17:00.000 | 5 | 1 | 0 | 0 | python,security,cgi-bin | 3,703,723 | 3 | true | 0 | 0 | check out owasp.org - you're now writing a web application, and you need to worry about everything web apps need to worry about. The list is too long and complicated to place here, but owasp is a good starting point. | 1 | 2 | 0 | I've been writing python scripts that run locally. I would now like to offer a service online using one of these python scripts and through the webhosting I have I can run python in the cgi-bin.
The python script takes input from an html form filled in by the user, has the credentials and connects with a local database... | Security precautions for running python in cgi-bin | 1.2 | 0 | 0 | 2,862 |
3,703,704 | 2010-09-13T19:29:00.000 | 2 | 1 | 1 | 0 | java,python,dynamic-languages | 3,703,964 | 3 | false | 0 | 0 | Some things that struck me when first trying out Python (coming from a mainly Java background):
Write Pythonic code. Use idioms recommended for Python, rather than doing it the old Java/C way. This is more than just a cosmetic or dogmatic issue. Pythonic code is actually hugely faster in practice than C-like code prac... | 2 | 6 | 0 | What are the top gotchas for someone moving from a static lang (java/c#) to dynamic language like python?
It seems cool how things can be done, but renaming a method, or adding/removing parameters seems so risky!
Is the only solution to write tests for each method? | top gotchas for someone moving from a static lang (java/c#) to dynamic language like python | 0.132549 | 0 | 0 | 248 |
3,703,704 | 2010-09-13T19:29:00.000 | 3 | 1 | 1 | 0 | java,python,dynamic-languages | 3,703,732 | 3 | false | 0 | 0 | "Is the only solution to write tests for each method?"
Are you saying you didn't write tests for each method in Java?
If you wrote tests for each method in Java, then -- well -- nothing changes, does it?
renaming a method, seems so risky!
Correct. Don't do it.
adding/removing parameters seems so risky!
What? Are... | 2 | 6 | 0 | What are the top gotchas for someone moving from a static lang (java/c#) to dynamic language like python?
It seems cool how things can be done, but renaming a method, or adding/removing parameters seems so risky!
Is the only solution to write tests for each method? | top gotchas for someone moving from a static lang (java/c#) to dynamic language like python | 0.197375 | 0 | 0 | 248 |
3,704,404 | 2010-09-13T21:03:00.000 | 7 | 0 | 0 | 0 | python,django,session,django-sessions | 3,704,462 | 1 | true | 1 | 0 | Is there a good rule of thumb for which one to use?
No.
Cached_db seems like it would always be a better choice ...
That's fine.
In some cases, there a many Django (and Apache) processes querying a common database. mod_wsgi allows a lot of scalability this way. The cache doesn't help much because the sessions are... | 1 | 6 | 0 | I'm using sessions in Django to store login user information as well as some other information. I've been reading through the Django session website and still have a few questions.
From the Django website:
By default, Django stores sessions in
your database (using the model
django.contrib.sessions.models.Session).... | Using sessions in Django | 1.2 | 0 | 0 | 4,031 |
3,704,570 | 2010-09-13T21:29:00.000 | 20 | 0 | 0 | 0 | python,floating-point,numerical-stability | 3,704,637 | 4 | false | 0 | 0 | Would it be possible to do your work in a logarithmic space? (For example, instead of storing 1e-320, just store -320, and use addition instead of multiplication) | 1 | 24 | 1 | I have a Bayesian Classifier programmed in Python, the problem is that when I multiply the features probabilities I get VERY small float values like 2.5e-320 or something like that, and suddenly it turns into 0.0. The 0.0 is obviously of no use to me since I must find the "best" class based on which class returns the M... | In Python small floats tending to zero | 1 | 0 | 0 | 17,743 |
3,705,421 | 2010-09-14T00:48:00.000 | 6 | 0 | 1 | 0 | python,console,interactive | 3,705,551 | 2 | true | 0 | 0 | Run the script from the console with python -i. It will go through the commands and drop you in the usual Python console when it's done. | 1 | 3 | 0 | I'm looking to have the same functionality (history, ...) as when you simply type python in your terminal. The script I have goes through a bunch of setup code, and when ready, the user should have a command prompt. What would be the best way to achieve this? | Create console in python | 1.2 | 0 | 0 | 2,213 |
3,706,128 | 2010-09-14T04:25:00.000 | 0 | 0 | 0 | 0 | python,windows | 5,380,835 | 2 | false | 0 | 0 | If you are using pyhook, event.WindowName in your OnKeyboardEvent etc function contains the value xx | 1 | 1 | 0 | How can I get the window name?
I want to make a script where I have some keyboard event, and I want it to happens only if the window name has something in the name, like, Firefox.
how can I do it?
the simplest way | how can I get the window name? [Python] | 0 | 0 | 0 | 4,493 |
3,706,469 | 2010-09-14T06:07:00.000 | 2 | 0 | 1 | 0 | python,regex,wildcard | 3,706,506 | 4 | true | 0 | 0 | You can't do this. What should prefix.* match? What about somefiles?? These have very different meanings in regex vs glob matching, but are common use cases in both. | 2 | 1 | 0 | I have a python script that reads from a config file. The config file is going to contain some user defined regex patterns. However, I was thinking I'd like to let the user use either full regex patterns, OR shell wildcards. So I should be able to interpret both
*.txt
as well as
.*\.txt$
correctly. So those 2 should b... | Mixing regex and shell wildcards | 1.2 | 0 | 0 | 534 |
3,706,469 | 2010-09-14T06:07:00.000 | 0 | 0 | 1 | 0 | python,regex,wildcard | 3,706,626 | 4 | false | 0 | 0 | Try not to leave the creation of regex to the user. The user should have an easier means to configure their files without needing to use regex. Eg let the users have a few choices,
starts with
ends with
contains (OR and AND)
etc
Then as the programmer, you use these choices to construct your regex. | 2 | 1 | 0 | I have a python script that reads from a config file. The config file is going to contain some user defined regex patterns. However, I was thinking I'd like to let the user use either full regex patterns, OR shell wildcards. So I should be able to interpret both
*.txt
as well as
.*\.txt$
correctly. So those 2 should b... | Mixing regex and shell wildcards | 0 | 0 | 0 | 534 |
3,706,553 | 2010-09-14T06:27:00.000 | 1 | 0 | 1 | 0 | python,list,tuples | 3,706,578 | 5 | false | 0 | 0 | I wouldn't worry about the overhead of first creating a list and then a tuple from that list. My guess is that the overhead will turn out to be negligible if you measure it.
On the other hand, I would stick with the list and iterate over that instead of creating a tuple. Tuples should be used for struct like data and l... | 2 | 2 | 0 | I have a config file that contains a list of strings. I need to read these strings in order and store them in memory and I'm going to be iterating over them many times when certain events take place. Since once they're read from the file I don't need to add or modify the list, a tuple seems like the most appropriate da... | Parsing indeterminate amount of data into a python tuple | 0.039979 | 0 | 0 | 196 |
3,706,553 | 2010-09-14T06:27:00.000 | 2 | 0 | 1 | 0 | python,list,tuples | 3,706,568 | 5 | false | 0 | 0 | As you said, you're going to read the data gradually - so a tuple isn't a good idea after all, as it's immutable.
Is there a reason for not using a simple list for holding the strings? | 2 | 2 | 0 | I have a config file that contains a list of strings. I need to read these strings in order and store them in memory and I'm going to be iterating over them many times when certain events take place. Since once they're read from the file I don't need to add or modify the list, a tuple seems like the most appropriate da... | Parsing indeterminate amount of data into a python tuple | 0.07983 | 0 | 0 | 196 |
3,709,094 | 2010-09-14T13:01:00.000 | 1 | 0 | 0 | 0 | python,django | 9,905,973 | 3 | false | 1 | 0 | My company did just build such a system for a large scale enterprise based on Django including all mobile systems. With django the dev cost were low and runnability inside enterprise server stack was no problem. Even Django managed to let us pass the penetration and security test. with any other language we would not h... | 2 | 2 | 0 | I wanted to know is Django a good choice for a big web applicatin(Social Network)? More specifically, I need some suggestion on performace when number of DB transactions increases and I want to know is the embedded OR Mapping included inside Django is a good choice or should I implement them.
Thanks | Django for enterprise web application | 0.066568 | 0 | 0 | 2,228 |
3,709,094 | 2010-09-14T13:01:00.000 | 5 | 0 | 0 | 0 | python,django | 3,710,103 | 3 | true | 1 | 0 | performace when number of DB transactions increases.
Not a Django problem, really.
You can have a lot of concurrent Django sessions via Apache and mod_wsgi. All of them will share a common database.
Therefore, this is entirely a database problem. You should be able to configure enough Apache/Django sessions that you... | 2 | 2 | 0 | I wanted to know is Django a good choice for a big web applicatin(Social Network)? More specifically, I need some suggestion on performace when number of DB transactions increases and I want to know is the embedded OR Mapping included inside Django is a good choice or should I implement them.
Thanks | Django for enterprise web application | 1.2 | 0 | 0 | 2,228 |
3,710,751 | 2010-09-14T16:13:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 3,716,517 | 3 | false | 0 | 1 | We should bind wx.EVT_TEXT_COPY and wx.EVT_TEXT_PASTE with text control.
one can copy and paste data from text ctrl although text ctrl is read only mode. | 1 | 1 | 0 | In my application i have text control.
I want my text ctrl should be read only but when some one right click on this he is able to copy the value from that ctrl and he can paste that value in other text control.
If i made my text control read only with wx.TE_READONLY then copy/paste is not working.
Is there any require... | how to create read only text ctrl but support copy paste event | 0.066568 | 0 | 0 | 8,427 |
3,711,762 | 2010-09-14T18:22:00.000 | 0 | 0 | 1 | 0 | python | 3,716,937 | 2 | false | 0 | 0 | To convert a number to a list of it's binary digits: list(bin(number))[2:] | 1 | 0 | 0 | hi i am new in python just started learning with python i got a task in which i need to store "1" byte of integer into different bits just like RGB the value are store in that can any one would write a small program for me and explain that ,please i need a help
Thankyou | python bitwise operation | 0 | 0 | 0 | 1,075 |
3,712,125 | 2010-09-14T19:16:00.000 | 2 | 1 | 1 | 0 | c++,python,boost-python | 3,712,249 | 3 | false | 0 | 1 | C++ can interoperate with C by extern "C" declarations. | 1 | 8 | 0 | How is Python able to call C++ objects when the interpreter is C and has been built w/ a C compiler? | How does Boost.Python work? | 0.132549 | 0 | 0 | 1,508 |
3,712,885 | 2010-09-14T21:03:00.000 | 0 | 1 | 0 | 0 | python,module,attributes,return | 3,713,156 | 5 | false | 0 | 0 | dir is what you need :) | 1 | 1 | 0 | I already search for it on Google but I didn't have luck. | Does Python have a method that returns all the attributes in a module? | 0 | 0 | 0 | 282 |
3,712,949 | 2010-09-14T21:11:00.000 | 2 | 0 | 0 | 0 | python,sqlalchemy,primary-key | 3,713,061 | 3 | true | 0 | 0 | I always make surrogate keys when using ORMs (or rather, I let the ORMs make them for me). They solve a number of problems, and don't introduce any (major) problems.
So, you've done your job by acknowledging that there are "papers on the net" with valid reasons to avoid surrogate keys, and that there's probably a bette... | 3 | 2 | 0 | Short story
I have a technical problem with a third-party library at my hands that I seem to be unable to easily solve in a way other than creating a surrogate key (despite the fact that I'll never need it). I've read a number of articles on the Net discouraging the use of surrogate keys, and I'm a bit at a loss if it ... | How badly should I avoid surrogate primary keys in SQL? | 1.2 | 1 | 0 | 698 |
3,712,949 | 2010-09-14T21:11:00.000 | 0 | 0 | 0 | 0 | python,sqlalchemy,primary-key | 4,160,811 | 3 | false | 0 | 0 | I use surrogate keys in a db that I use reflection on with sqlalchemy. The pro is that you can more easily manage the foreign keys / relationships that exists in your tables / models. Also, the rdbms is managing the data more efficiently. The con is the data inconsistency: duplicates. To avoid this - always use the uni... | 3 | 2 | 0 | Short story
I have a technical problem with a third-party library at my hands that I seem to be unable to easily solve in a way other than creating a surrogate key (despite the fact that I'll never need it). I've read a number of articles on the Net discouraging the use of surrogate keys, and I'm a bit at a loss if it ... | How badly should I avoid surrogate primary keys in SQL? | 0 | 1 | 0 | 698 |
3,712,949 | 2010-09-14T21:11:00.000 | 0 | 0 | 0 | 0 | python,sqlalchemy,primary-key | 3,713,270 | 3 | false | 0 | 0 | "Using a surrogate key allows duplicates to be created when using a natural key would have prevented such problems" Exactly, so you should have both keys, not just a surrogate. The error you seem to be making is not that you are using a surrogate, it's that you are assuming the table only needs one key. Make sure you c... | 3 | 2 | 0 | Short story
I have a technical problem with a third-party library at my hands that I seem to be unable to easily solve in a way other than creating a surrogate key (despite the fact that I'll never need it). I've read a number of articles on the Net discouraging the use of surrogate keys, and I'm a bit at a loss if it ... | How badly should I avoid surrogate primary keys in SQL? | 0 | 1 | 0 | 698 |
3,712,992 | 2010-09-14T21:17:00.000 | 0 | 0 | 0 | 1 | python,windows | 3,954,806 | 2 | true | 0 | 0 | I had to use remote registry...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
ProductName, EditionID, CurrentVersion, CurrentBuild | 1 | 1 | 0 | So of course I'm new to Python and to programming in general...
I am trying to get OS version information from the network. For now I only care about the windows machines.
using PyWin32 I can get some basic information, but it's not very reliable. This is an example of what I am doing right now: win32net.NetWkstaGetInf... | Python: How to use platform.win32_ver() on a remote machine? | 1.2 | 0 | 0 | 1,156 |
3,714,613 | 2010-09-15T04:12:00.000 | 3 | 0 | 1 | 0 | python,thread-safety | 3,716,794 | 5 | false | 0 | 1 | In normal python this will be safe as all access to variables are protected by the GIL(Global Interpreter Lock) this means that all access to a variable are syncronised so only one thread can do this at a time. The only issue is as @Eloff noted if you need to read more than one value and need them to be consistent - yo... | 5 | 6 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display thi... | Python: safe to read values from an object in a thread? | 0.119427 | 0 | 0 | 2,094 |
3,714,613 | 2010-09-15T04:12:00.000 | 1 | 0 | 1 | 0 | python,thread-safety | 3,714,773 | 5 | false | 0 | 1 | It's quite safe.
When the count increases from n to n+1 the "n+1 object" is created and then count is switched from referring to the "n object" to the new "n+1 object".
There is no stage that count is referring to something other than the "n object" or the "n+1 object" | 5 | 6 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display thi... | Python: safe to read values from an object in a thread? | 0.039979 | 0 | 0 | 2,094 |
3,714,613 | 2010-09-15T04:12:00.000 | 8 | 0 | 1 | 0 | python,thread-safety | 3,714,627 | 5 | true | 0 | 1 | Generally as long as...
You only have one thread writing to it, and...
It's not important that the count be kept precisely in sync with the displayed value...
it's fine. | 5 | 6 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display thi... | Python: safe to read values from an object in a thread? | 1.2 | 0 | 0 | 2,094 |
3,714,613 | 2010-09-15T04:12:00.000 | 2 | 0 | 1 | 0 | python,thread-safety | 3,714,663 | 5 | false | 0 | 1 | This is fine because you have only one writer thread. Read only operations are always thread-safe. The exception to this arises when you are reading more than one related value and expecting some form of consistency between them. Since writes can happen at any time, reads of multiple values may not be consistent and in... | 5 | 6 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display thi... | Python: safe to read values from an object in a thread? | 0.07983 | 0 | 0 | 2,094 |
3,714,613 | 2010-09-15T04:12:00.000 | 0 | 0 | 1 | 0 | python,thread-safety | 3,714,667 | 5 | false | 0 | 1 | It's safe only because it's not especially critical. Weird things like the value not updating when it should won't matter. It is very hard to get a definitive answer on what happens when you pretend a single int that's being read and written to is "atomic", as it depends on the exact architecture and a bunch of other... | 5 | 6 | 0 | I have a Python/wxPython program where the GUI is the main thread and I use another thread to load data from a file. Sometimes the files are big and slow to load so I use a wxPulse dialog to indicate progress.
As I load the file, I count the number of lines that have been read in the counting thread, and I display thi... | Python: safe to read values from an object in a thread? | 0 | 0 | 0 | 2,094 |
3,715,244 | 2010-09-15T06:40:00.000 | 1 | 0 | 1 | 0 | python | 3,715,512 | 4 | false | 0 | 0 | There is no need to base64 encode the string, just paste it's repr into the code | 2 | 5 | 0 | Instead of using directories to reference an image, is it possible to code an image into the program directly? | Is it possible to code images into a python script? | 0.049958 | 0 | 0 | 9,239 |
3,715,244 | 2010-09-15T06:40:00.000 | 0 | 0 | 1 | 0 | python | 3,715,291 | 4 | false | 0 | 0 | If you mean, storing the bytes that represent the image in the program code itself, you could do it by base64 encoding the image file, and setting a variable to that string.
You could also declare a byte array, where the contents of the array are the bytes that represent the image.
In both cases, if you want to operat... | 2 | 5 | 0 | Instead of using directories to reference an image, is it possible to code an image into the program directly? | Is it possible to code images into a python script? | 0 | 0 | 0 | 9,239 |
3,715,317 | 2010-09-15T06:53:00.000 | 1 | 0 | 0 | 0 | python,user-interface,wxpython | 3,716,150 | 1 | false | 0 | 1 | Not built in. You'd have to create your own. | 1 | 0 | 0 | A wxPython program that I'm writing uses two sliders as part of the GUI. These sliders represent a three state switch with the states "On Full", "On Medium" and "Off". I'd like to be able to assign these labels to the ticks on the slider. Is there a way of doing this without having to subclass or position separate stat... | wxPython: Assigning text labels to ticks on a slider | 0.197375 | 0 | 0 | 326 |
3,715,456 | 2010-09-15T07:15:00.000 | 3 | 0 | 0 | 0 | python,mysql,database,database-design,postgresql | 3,715,621 | 3 | false | 0 | 0 | PostgreSQL doesn't impose a direct limit on this, your OS does (it depends on maximum directory size)
This may depend on your OS as well. Some filesystems get slower with large directories.
PostgreSQL won't be able to optimize queries if they're across different tables. So using less tables (or a single table) should b... | 2 | 7 | 0 | I have created a database in PostgreSQL, let's call it testdb.
I have a generic set of tables inside this database, xxx_table_one, xxx_table_two and xxx_table_three.
Now, I have Python code where I want to dynamically create and remove "sets" of these 3 tables to my database with a unique identifier in the table name d... | Is there a limitation on the number of tables a PostgreSQL database can have? | 0.197375 | 1 | 0 | 5,102 |
3,715,456 | 2010-09-15T07:15:00.000 | 0 | 0 | 0 | 0 | python,mysql,database,database-design,postgresql | 5,603,789 | 3 | false | 0 | 0 | If your data were not related, I think your tables could be in different schema, and then you would use SET search_path TO schema1, public for example, this way you wouldn't have to dynamically generate table names in your queries. I am planning to try this structure on a large database which stores logs and other trac... | 2 | 7 | 0 | I have created a database in PostgreSQL, let's call it testdb.
I have a generic set of tables inside this database, xxx_table_one, xxx_table_two and xxx_table_three.
Now, I have Python code where I want to dynamically create and remove "sets" of these 3 tables to my database with a unique identifier in the table name d... | Is there a limitation on the number of tables a PostgreSQL database can have? | 0 | 1 | 0 | 5,102 |
3,716,325 | 2010-09-15T09:27:00.000 | 20 | 0 | 1 | 1 | python,file,unix,atomic | 3,716,361 | 1 | true | 0 | 0 | It is not atomic if the files are on different filsystems. In that case, python opens the source and destination file, loops on reading from the source and writing to the desination and finally unlinks the source file.
If the source and destination file are on the same file system, python uses the rename() C call, whi... | 1 | 19 | 0 | I am wondering whether python's shutil.move is atomic on linux ? Is the behavior different if the source and destination files are on two different partitions or is it same as when they are present on the same partition ?
I am more concerned to know whether the shutil.move is atomic if the source and destination files ... | Is python's shutil.move() atomic on linux? | 1.2 | 0 | 0 | 4,324 |
3,717,785 | 2010-09-15T12:57:00.000 | 0 | 0 | 1 | 0 | python,csv | 3,718,100 | 4 | false | 0 | 0 | use the int() function to covert the boolean to their int values and then store those. that being said, eli-bendersky's comment above is worth noting. | 1 | 11 | 0 | If I store a boolean value using the CSV module, it gets converted to the strings True or False by the str() function. However, when I load those values, a string of False evaluates to being True because it's a non-empty string.
I can work around it by manually checking the string at read time with an IF statement to s... | What is a convenient way to store and retrieve boolean values in a CSV file | 0 | 0 | 0 | 17,168 |
3,718,077 | 2010-09-15T13:31:00.000 | -2 | 0 | 0 | 0 | python,django,django-admin | 28,936,398 | 5 | false | 1 | 0 | I just simply Removed all currently installed versions of Django. Then freshly install the latest version of Django and it works | 3 | 65 | 0 | I created a little app a while ago. I created admin.py and used admin.site.register(MenuEntry) to add the class to admin console. It showed the items of that class just fine.
Then I began working on another app and created everything as before. But now it says:
You don't have permission to edit anything.
I compared fi... | Django. You don't have permission to edit anything | -0.07983 | 0 | 0 | 20,078 |
3,718,077 | 2010-09-15T13:31:00.000 | 2 | 0 | 0 | 0 | python,django,django-admin | 16,760,228 | 5 | false | 1 | 0 | I had another case where this happened. I had an app called "transcription", with two models: Project and Recording. After getting it mostly developed I decided to rename the app "recordings". The admin app worked fine as the admin but any non-admin user got this error message. Eventually I found (in my sqlite db) the ... | 3 | 65 | 0 | I created a little app a while ago. I created admin.py and used admin.site.register(MenuEntry) to add the class to admin console. It showed the items of that class just fine.
Then I began working on another app and created everything as before. But now it says:
You don't have permission to edit anything.
I compared fi... | Django. You don't have permission to edit anything | 0.07983 | 0 | 0 | 20,078 |
3,718,077 | 2010-09-15T13:31:00.000 | 136 | 0 | 0 | 0 | python,django,django-admin | 3,718,260 | 5 | true | 1 | 0 | I checked files one more time and found the difference. I forgot to add admin.autodiscover() in urls.py of the project. Thanks. | 3 | 65 | 0 | I created a little app a while ago. I created admin.py and used admin.site.register(MenuEntry) to add the class to admin console. It showed the items of that class just fine.
Then I began working on another app and created everything as before. But now it says:
You don't have permission to edit anything.
I compared fi... | Django. You don't have permission to edit anything | 1.2 | 0 | 0 | 20,078 |
3,718,304 | 2010-09-15T13:54:00.000 | 2 | 1 | 1 | 0 | c++,python,text | 3,718,792 | 7 | false | 0 | 0 | On the Python side the string class' translate function is the way to go. On the C++ side I would go with a std::map to hold the character mapping. Then I would probably use std::for_each to do the look up and swap. | 1 | 3 | 0 | As a hobby project, I had like to implement a Morse code encoder and decoder in C++ and Python (both). I was wondering the right data structure I should use for that. Not only is this question related to this specific project, but in general, when one has to make predefined text replacements, what is the best and the f... | Predefined text replacements in C++ and Python | 0.057081 | 0 | 0 | 265 |
3,718,322 | 2010-09-15T13:56:00.000 | 1 | 0 | 1 | 0 | python | 3,718,337 | 3 | false | 0 | 0 | use %%.......... | 1 | 1 | 0 | I am trying to pass a string which has a '%' in it (its actually a sql query string). How do I pass the % (do I have to use a specific escape character?
eg:
compute_answertime("%how do I%") | What is the escape character for % in python's string method | 0.066568 | 0 | 0 | 179 |
3,718,657 | 2010-09-15T14:34:00.000 | 5 | 1 | 0 | 1 | python | 6,236,300 | 16 | false | 0 | 0 | Just use os.path.dirname(os.path.abspath(__file__)) and examine very carefully whether there is a real need for the case where exec is used. It could be a sign of troubled design if you are not able to use your script as a module.
Keep in mind Zen of Python #8, and if you believe there is a good argument for a use-c... | 1 | 358 | 0 | I would like to see what is the best way to determine the current script directory in Python.
I discovered that, due to the many ways of calling Python code, it is hard to find a good solution.
Here are some problems:
__file__ is not defined if the script is executed with exec, execfile
__module__ is defined only in m... | How do you properly determine the current script directory? | 0.062419 | 0 | 0 | 156,322 |
3,718,695 | 2010-09-15T14:38:00.000 | 1 | 0 | 0 | 0 | python,django,pylons | 3,723,281 | 3 | false | 1 | 0 | The ability to ask a question about it on Stackoverflow. Django has over 10,000 tagged questions, Pylon has just under 400. | 2 | 2 | 0 | From what I understand, Pylons is more of a 'bare bones' framework (where you can choose your ORM and template engine), and Django is a little more rich in nature.
What exactly are the features/frameworky elements that Django has that Pylons doesn't?
(other than its own ORM, and its auto-admin page generation) | What features does Django have that Pylons doesn't? | 0.066568 | 0 | 0 | 401 |
3,718,695 | 2010-09-15T14:38:00.000 | 1 | 0 | 0 | 0 | python,django,pylons | 3,722,992 | 3 | false | 1 | 0 | The main difference is Django's scaffolding and auto-admin interface. Both of these allow you to quickly start managing data in the website without having to create lots of views etc. | 2 | 2 | 0 | From what I understand, Pylons is more of a 'bare bones' framework (where you can choose your ORM and template engine), and Django is a little more rich in nature.
What exactly are the features/frameworky elements that Django has that Pylons doesn't?
(other than its own ORM, and its auto-admin page generation) | What features does Django have that Pylons doesn't? | 0.066568 | 0 | 0 | 401 |
3,718,868 | 2010-09-15T14:55:00.000 | 12 | 0 | 1 | 0 | python,vim,editor,cscope | 3,779,871 | 6 | true | 0 | 0 | From a correspondence with the maintainer of cscope, this tool isn't designed to work with Python, and there are no plans to implement that compatibility. Whatever works now, apparently works by mistake, and there is no promise whatsoever that it will keep working.
It appears I've been using an out-of-date version of p... | 1 | 19 | 0 | Has anyone managed successfully using cscope with Python code? I have VIM 7.2 and the latest version of cscope installed, however it doesn't get my code's tags correctly (always off by a couple of lines). I tried the pycscope script but its output isn't supported by the modern version of cscope.
Any ideas? Or an altern... | Using cscope to browse Python code with VIM? | 1.2 | 0 | 0 | 26,659 |
3,719,145 | 2010-09-15T15:24:00.000 | 0 | 0 | 0 | 0 | python,zope | 3,719,408 | 2 | false | 0 | 0 | Look at psycopg, it ships with a Zope Database Adapter. | 1 | 3 | 0 | I am into a project where zope web server is used. With this PostgreSQL database is used. But I am not able to add a new PostgreSQL connection via zope. Actually, I am not aware of what else I need to install so that I can use PostgreSQL dB with zope. From whatever I have explored about this I have come to know that I ... | What are the essentials I need to install if I want to use PostgreSQL DB with zope? for eg: Zope Database Adapter? | 0 | 1 | 0 | 110 |
3,721,126 | 2010-09-15T19:31:00.000 | 23 | 0 | 1 | 0 | python,exception,assert | 3,721,183 | 4 | true | 0 | 0 | A good guideline is using assert when its triggering means a bug in your code. When your code assumes something and acts upon the assumption, it's recommended to protect this assumption with an assert. This assert failing means your assumption isn't correct, which means your code isn't correct. | 2 | 11 | 0 | I've read about when to use assert vs. exceptions, but I'm still not "getting it". It seems like whenever I think I'm in a situation where I should use assert, later on in development I find that I'm "looking before I leap" to make sure the assert doesn't fail when I call the function. Since there's another Python id... | Example use of assert in Python? | 1.2 | 0 | 0 | 17,126 |
3,721,126 | 2010-09-15T19:31:00.000 | 3 | 0 | 1 | 0 | python,exception,assert | 3,721,144 | 4 | false | 0 | 0 | Generelly, assert is there to verify an assumption you have about your code, i.e. at that point in time, either the assert succeeds, or your implementation is somehow buggy. An exception is acutally expecting an error to happen and "embracing" it, i.e. allowing you to handle it. | 2 | 11 | 0 | I've read about when to use assert vs. exceptions, but I'm still not "getting it". It seems like whenever I think I'm in a situation where I should use assert, later on in development I find that I'm "looking before I leap" to make sure the assert doesn't fail when I call the function. Since there's another Python id... | Example use of assert in Python? | 0.148885 | 0 | 0 | 17,126 |
3,721,415 | 2010-09-15T20:11:00.000 | 2 | 1 | 0 | 0 | python | 3,721,515 | 4 | true | 0 | 0 | Make sure you have the parent directory of project/ on your pythonpath, rather than the project directory. If you add the project path itself, imports like import project.src will look for project/project/src. | 2 | 1 | 0 | although there are many posts on the internet as well as some posts on stack overflow, I still want to ask about this nasty python "import" problem.
OK. so, the open source code organization is usually like this:
project/src/model.py;
project/test/testmodel.py
if I put the famous __init__.py in project directory and al... | python import problem | 1.2 | 0 | 0 | 7,796 |
3,721,415 | 2010-09-15T20:11:00.000 | 0 | 1 | 0 | 0 | python | 3,721,437 | 4 | false | 0 | 0 | The directory where project is located is probably not in your python path. | 2 | 1 | 0 | although there are many posts on the internet as well as some posts on stack overflow, I still want to ask about this nasty python "import" problem.
OK. so, the open source code organization is usually like this:
project/src/model.py;
project/test/testmodel.py
if I put the famous __init__.py in project directory and al... | python import problem | 0 | 0 | 0 | 7,796 |
3,722,003 | 2010-09-15T21:33:00.000 | 1 | 1 | 1 | 0 | python,c,comparison | 3,722,153 | 6 | false | 0 | 0 | As I did serious c programming I read a book that claimed libraries are worth to write. (Especially in C which considered a low level language)
Libraries are build for reuse.
If you use libraries you write one line like detectFace( faceDesriptor ) or renderPDF( document) is doesn't matter whether an idiom in another la... | 5 | 3 | 0 | Hi I'm currently learning Python since the syntax feels so succinct and the idioms match well with my mental model.
However I'm also interested in learning about OS internals and reverse engineering software, which ultimately means knowing C in a rather thorough capacity.
When originally picking a language I did lots o... | Python vs C : Line of Code Comparison vs Dev Time | 0.033321 | 0 | 0 | 7,636 |
3,722,003 | 2010-09-15T21:33:00.000 | 1 | 1 | 1 | 0 | python,c,comparison | 7,054,149 | 6 | false | 0 | 0 | I think Python is more productive for small projects (up to a few thousand lines of code).
On the other hand, C is better suited for large projects (even though IMHO there are better languages for that, such as Ada): static type-checking allows to find many errors at compile time that are much more difficult to detect ... | 5 | 3 | 0 | Hi I'm currently learning Python since the syntax feels so succinct and the idioms match well with my mental model.
However I'm also interested in learning about OS internals and reverse engineering software, which ultimately means knowing C in a rather thorough capacity.
When originally picking a language I did lots o... | Python vs C : Line of Code Comparison vs Dev Time | 0.033321 | 0 | 0 | 7,636 |
3,722,003 | 2010-09-15T21:33:00.000 | 6 | 1 | 1 | 0 | python,c,comparison | 3,722,185 | 6 | true | 0 | 0 | Boost is C++, not C (emphatically not C -- virtually all of it makes heavy use of templates and such that aren't part of C).
Yes, C programmers tend to build up personal libraries of code for all sorts of "stuff" -- data structures, algorithms, user interfaces, and so on. There are also a fair number of other libraries... | 5 | 3 | 0 | Hi I'm currently learning Python since the syntax feels so succinct and the idioms match well with my mental model.
However I'm also interested in learning about OS internals and reverse engineering software, which ultimately means knowing C in a rather thorough capacity.
When originally picking a language I did lots o... | Python vs C : Line of Code Comparison vs Dev Time | 1.2 | 0 | 0 | 7,636 |
3,722,003 | 2010-09-15T21:33:00.000 | 10 | 1 | 1 | 0 | python,c,comparison | 3,722,732 | 6 | false | 0 | 0 | but is it possible with libraries, code reuse etc, to have a development time in C close to that of Python
No.
You've missed the most important point.
Python's interactive. It's not edit-compile-link-execute-break-debug. It's edit-debug. | 5 | 3 | 0 | Hi I'm currently learning Python since the syntax feels so succinct and the idioms match well with my mental model.
However I'm also interested in learning about OS internals and reverse engineering software, which ultimately means knowing C in a rather thorough capacity.
When originally picking a language I did lots o... | Python vs C : Line of Code Comparison vs Dev Time | 1 | 0 | 0 | 7,636 |
3,722,003 | 2010-09-15T21:33:00.000 | 0 | 1 | 1 | 0 | python,c,comparison | 3,790,500 | 6 | false | 0 | 0 | Depends greatly on the task and the size of the project. For many small interesting tasks, I would not be surprised by 100:1 smaller Python code simply because the standard libraries are extremely good. If you find, buy, or build C/C++ libraries that do what you want, I imagine the ratio would be much more like 3:1 on ... | 5 | 3 | 0 | Hi I'm currently learning Python since the syntax feels so succinct and the idioms match well with my mental model.
However I'm also interested in learning about OS internals and reverse engineering software, which ultimately means knowing C in a rather thorough capacity.
When originally picking a language I did lots o... | Python vs C : Line of Code Comparison vs Dev Time | 0 | 0 | 0 | 7,636 |
3,722,120 | 2010-09-15T21:49:00.000 | 0 | 0 | 0 | 0 | python,mysql,django,multithreading | 3,722,799 | 2 | true | 1 | 0 | Since it mentions the character set, my gut says you are running a different Django/Python/something from the command line than you are from the webserver. In your settings file, turn on DEBUG=True, restart the server, and then run this again. In particular, look at the list of paths shown. If they are not exactly what... | 1 | 0 | 0 | I'm running a web crawler that gets called as a separate thread via Django. When it tries to store the scraped information I get this error:
File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 147, in execute
charset = db.character_set_name()
InterfaceError: (0, '')
If I manually run the script from the co... | mySQL interface error only occuring if ran in Django | 1.2 | 1 | 0 | 1,854 |
3,724,238 | 2010-09-16T06:35:00.000 | 1 | 0 | 1 | 1 | python,process,subprocess,parent-child | 3,724,308 | 2 | false | 0 | 0 | I guess, you are asking, how do you find if the child process is hung while operating. You can't tell easily. A process could be doing a long running operation. The context is important to understand when a process is hung.
If you are expecting a process to respond to a user input and is not responsive for a long perio... | 2 | 2 | 0 | How do I know is there my child process got hang while operating? | Python subprocess how to determine if child process hangs? | 0.099668 | 0 | 0 | 2,476 |
3,724,238 | 2010-09-16T06:35:00.000 | 2 | 0 | 1 | 1 | python,process,subprocess,parent-child | 3,724,322 | 2 | true | 0 | 0 | Well, how do you tell the difference between a stuck process and a process that takes longer than usual to complete? The short answer is: No, you can't detect if your child process is stuck.
I would say that to be able to detect this you need some kind of continuous communication with the process (e.g. look at log file... | 2 | 2 | 0 | How do I know is there my child process got hang while operating? | Python subprocess how to determine if child process hangs? | 1.2 | 0 | 0 | 2,476 |
3,724,878 | 2010-09-16T08:19:00.000 | 1 | 0 | 0 | 0 | php,python,frameworks,content-management-system,web-applications | 3,724,889 | 10 | false | 1 | 0 | Have you read and heard about JOOMLA i think its very poweful CMS in php and has a lot of community support as well, In java LifeRay is a good option. | 6 | 6 | 0 | I'm looking to build a online store. However, the first question, past the idea of the store, is the platform. I've previously worked with Java and PHP and am quite comfortable with PHP. So my first considerations were Drupal or maybe CodeIgniter (which I have heard lots of good things about)
On discussions with frien... | CMS or Framework? | 0.019997 | 0 | 0 | 6,320 |
3,724,878 | 2010-09-16T08:19:00.000 | -1 | 0 | 0 | 0 | php,python,frameworks,content-management-system,web-applications | 5,641,607 | 10 | false | 1 | 0 | Yahoo has something like a specialized CMS for online stores, called Yahoo Stores. They make it very easy to set up an online store, and provide other logistical services. You may want to take a look at that. Of course, they take a small percentage from your sales. | 6 | 6 | 0 | I'm looking to build a online store. However, the first question, past the idea of the store, is the platform. I've previously worked with Java and PHP and am quite comfortable with PHP. So my first considerations were Drupal or maybe CodeIgniter (which I have heard lots of good things about)
On discussions with frien... | CMS or Framework? | -0.019997 | 0 | 0 | 6,320 |
3,724,878 | 2010-09-16T08:19:00.000 | 1 | 0 | 0 | 0 | php,python,frameworks,content-management-system,web-applications | 3,725,222 | 10 | false | 1 | 0 | I'd only use a framework if the requirements can not be engineered into an existing cart CMS.
I'd use a CMS over a shopping cart if the commerce aspect was relatively trivial
I'm surprised you're not considering an off the shelf cart. Open Cart is pretty extensible, and Trading Eye has a nice CMS component. | 6 | 6 | 0 | I'm looking to build a online store. However, the first question, past the idea of the store, is the platform. I've previously worked with Java and PHP and am quite comfortable with PHP. So my first considerations were Drupal or maybe CodeIgniter (which I have heard lots of good things about)
On discussions with frien... | CMS or Framework? | 0.019997 | 0 | 0 | 6,320 |
3,724,878 | 2010-09-16T08:19:00.000 | 2 | 0 | 0 | 0 | php,python,frameworks,content-management-system,web-applications | 3,725,165 | 10 | false | 1 | 0 | If the CMS fits you perfectly now and in the future then CMS, otherwise framework. The framework will allow you total liberty for the price of time spent on development | 6 | 6 | 0 | I'm looking to build a online store. However, the first question, past the idea of the store, is the platform. I've previously worked with Java and PHP and am quite comfortable with PHP. So my first considerations were Drupal or maybe CodeIgniter (which I have heard lots of good things about)
On discussions with frien... | CMS or Framework? | 0.039979 | 0 | 0 | 6,320 |
3,724,878 | 2010-09-16T08:19:00.000 | 0 | 0 | 0 | 0 | php,python,frameworks,content-management-system,web-applications | 3,724,939 | 10 | false | 1 | 0 | Choose Django if you want to learn Python/Django and use them in your future projects. Django is cool and you'll have fun learning Python. And you'll be able to make an informed decision for your next project.
However, if you have a budget/timeframe or just want to make this project out of the door without needing to l... | 6 | 6 | 0 | I'm looking to build a online store. However, the first question, past the idea of the store, is the platform. I've previously worked with Java and PHP and am quite comfortable with PHP. So my first considerations were Drupal or maybe CodeIgniter (which I have heard lots of good things about)
On discussions with frien... | CMS or Framework? | 0 | 0 | 0 | 6,320 |
3,724,878 | 2010-09-16T08:19:00.000 | 2 | 0 | 0 | 0 | php,python,frameworks,content-management-system,web-applications | 3,724,927 | 10 | false | 1 | 0 | CI and Django are frameworks that help you build a web application from scratch, if you are willing to do this - go ahead and try it. There should be plenty of modules available that allow you to easily extend the framework.
Drupal however is a CMS, so it comes with multiple plugins already installed and is able to man... | 6 | 6 | 0 | I'm looking to build a online store. However, the first question, past the idea of the store, is the platform. I've previously worked with Java and PHP and am quite comfortable with PHP. So my first considerations were Drupal or maybe CodeIgniter (which I have heard lots of good things about)
On discussions with frien... | CMS or Framework? | 0.039979 | 0 | 0 | 6,320 |
3,725,699 | 2010-09-16T10:19:00.000 | 1 | 0 | 0 | 0 | python,database,zope | 4,018,666 | 1 | false | 0 | 0 | Yes, you can use psycopg2 with Zope2.
Just install it in your Python with easy_install or setup.py. You will also need a matching ZPsycopgDA Product in Zope. You find the ZPsycopgDA folder in the psycopg2 source distribution tarball. | 1 | 1 | 0 | I have zope 2.11 installed. Now i want to use Posgresql 7.4.13 DB with it. So i know i need to install psycopg2 Database Adapter. Can any one tell me Is psycopg2 compatible with zope2?? | Is Zpsycopg2 compatible with zope 2? | 0.197375 | 1 | 0 | 142 |
3,725,859 | 2010-09-16T10:43:00.000 | 1 | 0 | 0 | 1 | python,windows,python-3.x | 3,727,415 | 1 | false | 0 | 0 | I sounds as if you want the callee to callback the caller (sorry for the alliteration :) Since you are using Python 3.1 maybe the subprocess module will provide the intended behavior. It is not a true callback per se, but the calling program can perform decisions based on the output of the called program (exe in this c... | 1 | 3 | 0 | After calling an exe using python script in windows, the exe should run independent of this python script and once it is initiated the control should comeback to python script and executes the further script and control of .py file will die. But on other side before finishing execution, the exe should call this python ... | How to call an executable as independent process using python in windows | 0.197375 | 0 | 0 | 1,090 |
3,726,705 | 2010-09-16T12:38:00.000 | 0 | 0 | 0 | 0 | python,django,pythonpath | 3,726,747 | 2 | false | 1 | 0 | As far as I know, it's just a matter of personal taste. I go with the directory which contains the project, but that's just my preference. | 1 | 4 | 0 | When developing a Django application, what is sys.path supposed to contain? The directory which contains the project, or the directory of the project, or both? | Django: What is `sys.path` supposed to be? | 0 | 0 | 0 | 3,276 |
3,728,310 | 2010-09-16T15:42:00.000 | 0 | 0 | 1 | 1 | python,netbeans | 3,743,725 | 1 | false | 1 | 0 | You probably want to ask this question on www.serverfault.com rather than stackoverflow as it is more of a configuration issue rather than a programming issue.
Include the version of Netbeans and the Java you are using - and whether you using native python and/or Jython as well.
Also include at which point you see the ... | 1 | 1 | 0 | I have x64 Windows XP machine.
I use Netbeans to code Java.
I am now trying to use it for Python, but I get this error:
\NetBeans was unexpected at this time.
Any idea how to fix it? | Using Python in Netbeans | 0 | 0 | 0 | 486 |
3,729,965 | 2010-09-16T19:17:00.000 | 1 | 1 | 0 | 1 | python,scripting,path,bash | 3,730,090 | 7 | false | 0 | 0 | You shouldn't. It's the user choice whether he wants that in the PATH, in what cases and how to achieve that. What you can do is inform the user about the directory where your scripts reside and suggest putting it to the PATH.
Or maybe you're asking from the user's perspective? | 5 | 3 | 0 | I am writing a python/pygtk application that is adding some custom scripts (bash) in a certain folder in $HOME (eg. ~/.custom_scripts).
I want to make that folder available in $PATH. So every time the python app is adding the script, that script could be instantly available when the user is opening a terminal (eg. gno... | How to update $PATH | 0.028564 | 0 | 0 | 3,792 |
3,729,965 | 2010-09-16T19:17:00.000 | 2 | 1 | 0 | 1 | python,scripting,path,bash | 3,730,011 | 7 | false | 0 | 0 | .profile would be a reasonable place if it's a per-user install; /etc/profile.d for system-wide installs. (You'll need root to do that, of course.)
Your installer won't be able to change the path of the current shell (unless it's being run via source, which would be...odd.) | 5 | 3 | 0 | I am writing a python/pygtk application that is adding some custom scripts (bash) in a certain folder in $HOME (eg. ~/.custom_scripts).
I want to make that folder available in $PATH. So every time the python app is adding the script, that script could be instantly available when the user is opening a terminal (eg. gno... | How to update $PATH | 0.057081 | 0 | 0 | 3,792 |
3,729,965 | 2010-09-16T19:17:00.000 | 2 | 1 | 0 | 1 | python,scripting,path,bash | 3,730,014 | 7 | false | 0 | 0 | For scripts that go in the $HOME directory you'd typically use $HOME/bin folder instead which is (usually) on the path. | 5 | 3 | 0 | I am writing a python/pygtk application that is adding some custom scripts (bash) in a certain folder in $HOME (eg. ~/.custom_scripts).
I want to make that folder available in $PATH. So every time the python app is adding the script, that script could be instantly available when the user is opening a terminal (eg. gno... | How to update $PATH | 0.057081 | 0 | 0 | 3,792 |
3,729,965 | 2010-09-16T19:17:00.000 | 1 | 1 | 0 | 1 | python,scripting,path,bash | 3,730,027 | 7 | true | 0 | 0 | ~/.bashrc is read every time gnome-terminal is opened, (assuming the user has SHELL set to /bin/bash).
Be sure to check os.environ['PATH'] to see if the directory has already been added, so that the script doesn't add it more than once. | 5 | 3 | 0 | I am writing a python/pygtk application that is adding some custom scripts (bash) in a certain folder in $HOME (eg. ~/.custom_scripts).
I want to make that folder available in $PATH. So every time the python app is adding the script, that script could be instantly available when the user is opening a terminal (eg. gno... | How to update $PATH | 1.2 | 0 | 0 | 3,792 |
3,729,965 | 2010-09-16T19:17:00.000 | 1 | 1 | 0 | 1 | python,scripting,path,bash | 3,730,001 | 7 | false | 0 | 0 | /etc/profile.d would add it to every user's path
~/.bashrc would just be your own
you can always do "$ source ~/.bashrc" to re-read the config files. | 5 | 3 | 0 | I am writing a python/pygtk application that is adding some custom scripts (bash) in a certain folder in $HOME (eg. ~/.custom_scripts).
I want to make that folder available in $PATH. So every time the python app is adding the script, that script could be instantly available when the user is opening a terminal (eg. gno... | How to update $PATH | 0.028564 | 0 | 0 | 3,792 |
3,731,681 | 2010-09-16T23:41:00.000 | 2 | 0 | 1 | 0 | python,linux,input,interrupt | 3,731,809 | 6 | false | 0 | 0 | You need a separate process (or possibly a thread) to read the terminal and send it to the process of interest via some form of inter-process communication (IPC) (inter-thread communication may be harder -- basically the only thing you do is send a KeyboardInterrupt from a secondary thread to the main thread). Since y... | 2 | 3 | 0 | Is there a way to send an interrupt to a python module when the user inputs something in the console? For example, if I'm running an infinite while loop, i can surround it with a try/except for KeyboardInterrupt and then do what I need to do in the except block.
Is there a way to duplicate this functionality with any a... | Capturing user input at arbitrary times in python | 0.066568 | 0 | 0 | 2,997 |
3,731,681 | 2010-09-16T23:41:00.000 | 1 | 0 | 1 | 0 | python,linux,input,interrupt | 3,731,716 | 6 | false | 0 | 0 | KeyboardInterrupt is special in that it can be trapped (i.e. SIGINT under operating systems with respective POSIX support, SetConsoleCtrlHandler on Windows) and handled accordingly. If you want to process user input while at the same time doing work in a otherwise blocking loop, have a look at the threading or subproce... | 2 | 3 | 0 | Is there a way to send an interrupt to a python module when the user inputs something in the console? For example, if I'm running an infinite while loop, i can surround it with a try/except for KeyboardInterrupt and then do what I need to do in the except block.
Is there a way to duplicate this functionality with any a... | Capturing user input at arbitrary times in python | 0.033321 | 0 | 0 | 2,997 |
3,732,595 | 2010-09-17T04:04:00.000 | 0 | 0 | 0 | 0 | python,windows,search,hyperlink | 3,732,721 | 2 | false | 0 | 0 | Make sure that you change the User-Agent of urllib2. The default one tends to get blocked by Google. Make sure that you obey the terms of use of the search engine that you're scripting. | 1 | 0 | 0 | I am working on a project that requires me to collect a large list of URLs to websites about certain topics. I would like to write a script that will use google to search specific terms, then save the URLs from the results to a file. How would I go about doing this? I have used a module called xgoogle, but it always re... | Search Crawling "Bot"? | 0 | 0 | 1 | 402 |
3,733,270 | 2010-09-17T07:00:00.000 | 2 | 0 | 1 | 1 | python,timeout,pipe,subprocess,popen | 3,733,359 | 10 | false | 0 | 0 | Unfortunately, there isn't such a solution. I managed to do this using a threaded timer that would launch along with the process that would kill it after the timeout but I did run into some stale file descriptor issues because of zombie processes or some such. | 1 | 19 | 0 | Is there any argument or options to setup a timeout for Python's subprocess.Popen method?
Something like this:
subprocess.Popen(['..'], ..., timeout=20) ? | Python subprocess timeout? | 0.039979 | 0 | 0 | 37,063 |
3,733,363 | 2010-09-17T07:20:00.000 | 0 | 0 | 0 | 1 | python,networking,tcp | 3,733,452 | 3 | true | 0 | 0 | You often write clients in the plural form: are there several clients connecting to your server? In this case, each client should be using its own TCP stream, and the issue you are describing should never occur.
If the various commands are send from a single client, then you should write your client code so that it wai... | 2 | 0 | 0 | I am going to write a TCP server, the client sends me XML message, I am wondering if below condition will happen and how to avoid that:
1) client sends <cmd ...></cmd>
2) sever is busy doing something
3) clients sends <cmd ...></cmd>
4) server does a recv() and put the string to buffer
Will the buffer be filled with <c... | TCP server: how to avoid message overlapping | 1.2 | 0 | 1 | 772 |
3,733,363 | 2010-09-17T07:20:00.000 | 4 | 0 | 0 | 1 | python,networking,tcp | 3,733,419 | 3 | false | 0 | 0 | This is impossible to guarantee at the TCP level, since it only knows about streams.
Depending on the XML parser you're using, you should be able to feed it the stream and have it tell you when it has a complete object, leaving the second <cmd... in its buffer until it is closed also. | 2 | 0 | 0 | I am going to write a TCP server, the client sends me XML message, I am wondering if below condition will happen and how to avoid that:
1) client sends <cmd ...></cmd>
2) sever is busy doing something
3) clients sends <cmd ...></cmd>
4) server does a recv() and put the string to buffer
Will the buffer be filled with <c... | TCP server: how to avoid message overlapping | 0.26052 | 0 | 1 | 772 |
3,735,183 | 2010-09-17T12:11:00.000 | 5 | 1 | 0 | 0 | python,django,memcached,python-memcached | 3,735,232 | 2 | true | 1 | 0 | You should monitor your infrastructure. You can use a huge variety of tools for this, look on server fault for more discussions on monitoring.
You should probably monitor your cache hit rate and trend it in your monitoring system; if it falls below a figure (say 90%) then you can alert that the cache has stopped workin... | 1 | 2 | 0 | Is there some ready-made addon that alerts admins about memcached instance being inaccessible from a Django application? I don't mean here monitoring memcached daemon itself, but something that checks if my Django app benefits from caching.
My basic idea is to check if cache.get that follow cache.set actually returns s... | Django - alert when memcached is down | 1.2 | 0 | 0 | 481 |
3,736,311 | 2010-09-17T14:39:00.000 | 1 | 0 | 1 | 0 | python,pychecker | 4,782,453 | 3 | false | 0 | 0 | On the bonus extra question:
pychecker always imports the files you pass it, which causes it to import whatever those import. This is just like Python. This is a first pass in pychecker.
Then pychecker will actually go through the loaded modules, disassemble the code, and run through all the opcodes. This is a seco... | 1 | 1 | 0 | One of the modules I import into my python project triggers lots of warnings under Pychecker. Fixing up this external module isn't really an option, so I want to tell Pychecker to ignore it.
Does anyone know how to do this? I'm sure it's possible, and probably quite simple, but after trawling Google for a while I've no... | How can I tell Pychecker to ignore an imported library? | 0.066568 | 0 | 0 | 1,754 |
3,736,497 | 2010-09-17T15:01:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,cron | 3,736,761 | 2 | false | 0 | 0 | I would recommend just using every 5 minutes synchronized in the cron.yaml, and then just terminate immediately in the handler if the exact time is not to your liking (hour before 9 or after 20 and minute // 5 is odd, for example). GAE's cron is not very sophisticated, but running a trivial handler which just gets the... | 1 | 0 | 0 | How to config a cron job to run every 5 minutes between 9:00am~20:00pm,
but every 10 minutes in other time of the day. | How to set Google App Engine cron job using different interval in different period of time? | 0.291313 | 0 | 0 | 502 |
3,736,606 | 2010-09-17T15:15:00.000 | 4 | 1 | 0 | 0 | python,http,cherrypy | 3,737,124 | 2 | true | 0 | 0 | CherryPy has a caching Tool, but it's never on by default. Most HTTP responses are cacheable by default, though, so look for an intermediate cache between your client and server. Look at the browser first.
If you're not sure whether or not your content is being cached, compare the Date response header to the current ti... | 1 | 3 | 0 | Is it possible that CherryPy, in its default configuration, is caching the responses to one or more of my request handlers? And, if so, how do I turn that off? | How to determine if CherryPy is caching responses? | 1.2 | 0 | 1 | 2,007 |
3,737,922 | 2010-09-17T18:23:00.000 | 1 | 0 | 0 | 0 | python | 3,737,996 | 3 | false | 0 | 1 | Are you running it from an iteractive prompt and want to just get back to the prompt. Or, are you running it from a shell and want to get to a python prompt in but with the current state of the programs execution?
For the later it you could the keyboard interupt exception in your code and break out to the python debug... | 1 | 4 | 0 | I wrote a implementation of conway's game of life. I set up two modes, one is auto and the other is manual, which I mean the way to ouput the result of the game. For the auto mode, I cannot stop the running progran without ctrl + q or ctrl + c (which prints out the error message). So is there any way which can allow me... | How to quit the running python program to python prompt? | 0.066568 | 0 | 0 | 3,663 |
3,739,296 | 2010-09-17T21:47:00.000 | 1 | 0 | 0 | 0 | javascript,python,streaming,real-time | 3,739,311 | 5 | false | 0 | 0 | You could have the python script write an xml file that you get with an ajax request in your web page, and get the status info from that. | 1 | 4 | 0 | I have a simple workflow [Step 0]->[1]->[2]->...->[Step N]. The master program knows the step (state) it is currently at.
I want to stream this in real time to a website (in the local area network) so that when my colleagues open, say, http://thecomputer:8000, they can see a real time rendering of the current state of ... | Streaming the state of a Python script to a website | 0.039979 | 0 | 1 | 880 |
3,739,837 | 2010-09-18T00:05:00.000 | 0 | 0 | 1 | 1 | python,cygwin,tcl | 3,739,923 | 1 | false | 0 | 0 | If you could change the variable, you know already which it is, and to which value it is set. Would you kindly share this information, maybe someone can make an educated guess? | 1 | 0 | 0 | Idle stopped working after installing cygwin and after some troubleshooting (on windows if its not obvious), it looks like the issue is with a TCL library. They both use an environment variable to locate tcl. when I installed cygwin, it overwrote the variable to a different (and incompatible to python) version. Now I f... | is there a compatible TCL environment variable for cygwin and python idle | 0 | 0 | 0 | 167 |
3,740,330 | 2010-09-18T04:02:00.000 | 2 | 0 | 0 | 0 | python,architecture,frameworks,python-stackless | 3,740,407 | 2 | false | 1 | 0 | Before you can even begin to consider writing a continuation based framework you need a programming language that has continuations (or at least co-routines which can be used to emulate continuations). Continuation is a control structure like loops or closures or functions, not a design pattern like MVC. Unfortunately ... | 2 | 0 | 0 | There are many continuation based framework for java, ruby etc but none in python. Nagare framework somewhat solves the problem but it do not use standard python and uses stackless python to solve continuation problem.
I was wondering,
what part of standard python constraint to create such continuation web framework i... | design for continuation based python web appliction framework | 0.197375 | 0 | 0 | 635 |
3,740,330 | 2010-09-18T04:02:00.000 | 2 | 0 | 0 | 0 | python,architecture,frameworks,python-stackless | 3,743,417 | 2 | false | 1 | 0 | Right, continuation is a property of a language and CPython sadly has not continuations.
The workarounds in pure Python are well known : use callbacks / deferers like Twisted and Tornado for example or use 'yield' everywhere to mimic co-routines, like Diesel. But both approaches force you to change the way you design a... | 2 | 0 | 0 | There are many continuation based framework for java, ruby etc but none in python. Nagare framework somewhat solves the problem but it do not use standard python and uses stackless python to solve continuation problem.
I was wondering,
what part of standard python constraint to create such continuation web framework i... | design for continuation based python web appliction framework | 0.197375 | 0 | 0 | 635 |
3,740,903 | 2010-09-18T08:29:00.000 | 2 | 0 | 0 | 0 | python,dbus | 13,629,355 | 2 | false | 0 | 0 | this example does not work I think because :
'''
The available properties and whether they are writable can be determined by calling org.freedesktop.DBus.Introspectable.Introspect, see the section called “org.freedesktop.DBus.Introspectable”.
'''
and in introspection data the property are missing:
I use dbus-python-1... | 1 | 6 | 0 | In all python dbus documentations there are info on how to export objects, interfaces, signals, but there is nothing how to export interface property.
Any ideas how to do that ? | Python Dbus : How to export Interface property | 0.197375 | 0 | 0 | 5,868 |
3,740,932 | 2010-09-18T08:37:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 3,740,943 | 1 | true | 1 | 0 | Considering the distributed nature of GAE, I don't think you can do this directly.
You can store visits in the database (with timestamp) and query this (use a cookie to check if a user is already counted, avoid writing on each request!).
Alternatively, you can use some external service that uses included javascript or... | 1 | 0 | 0 | Is there a way to count total number of active sessions (e.g. in 10 minutes) on Google App Engine (Python)?
I want to show something on frontpage like, This site currently haz 200 people online | Total number of live sessions on GAE | 1.2 | 0 | 0 | 94 |
3,740,960 | 2010-09-18T08:43:00.000 | 1 | 0 | 1 | 0 | python,multithreading | 3,740,986 | 1 | false | 0 | 0 | You have two options, basically: threading and asynchronous IO.
You can have one thread fill a Queue with entered data and have the other thread print its contents. Be warned that threading is hard (impossible?) to do right.
Asynchronous IO means you have a main dispatcher that invokes callbacks when data is available... | 1 | 2 | 0 | So I have a threaded Python program that takes input from a user and prints data simultaneously. The problem is that when the program is sitting at raw_input(), it won't print anything and will print it all after the user presses enter.
Is there any way to have user input and print at the same time? | Raw input and printing simultaneously | 0.197375 | 0 | 0 | 538 |
3,742,583 | 2010-09-18T16:55:00.000 | 1 | 0 | 1 | 1 | python,windows-installer,metadata,md5 | 3,742,782 | 4 | false | 0 | 0 | To answer your second question: no, there is no way to hash a PE file or ZIP file, ignoring the metadata, without locating and reading the metadata. This is because the metadata you're interested in is stored at variable locations in the file.
In the case of PE files (EXE, DLL, etc), it's stored in a resource block, t... | 1 | 7 | 0 | I am writing a Python script to index a large set of Windows installers into a DB.
I would like top know how to read the metadata information (Company, Product Name, Version, etc) from EXE, MSI and ZIP files using Python running on Linux.
Software
I am using Python 2.6.5 on Ubuntu 10.04 64-bit with Django 1.2.1.
Found ... | Read EXE, MSI, and ZIP file metadata in Python in Linux | 0.049958 | 0 | 0 | 4,161 |
3,742,734 | 2010-09-18T17:36:00.000 | 6 | 0 | 0 | 0 | python,django,django-models,django-urls,django-views | 3,742,868 | 4 | true | 1 | 0 | runserver.py restarts automatically every time you modify any .py file, but when you are using apache you have to restart the proccess manually. | 3 | 7 | 0 | In django framework,When there are changes in urls.py or model.py or views.py .We would restart httpd.
But as the documentation says we could restart runserver to get the latest changes.
Which is the best efficient way for doing the above | Django restart server or httpd | 1.2 | 0 | 0 | 39,920 |
3,742,734 | 2010-09-18T17:36:00.000 | 4 | 0 | 0 | 0 | python,django,django-models,django-urls,django-views | 17,571,047 | 4 | false | 1 | 0 | touch your_project_name.wsgi and save without any change.
It will change data modify and django will automatically reloading code. | 3 | 7 | 0 | In django framework,When there are changes in urls.py or model.py or views.py .We would restart httpd.
But as the documentation says we could restart runserver to get the latest changes.
Which is the best efficient way for doing the above | Django restart server or httpd | 0.197375 | 0 | 0 | 39,920 |
3,742,734 | 2010-09-18T17:36:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,django-urls,django-views | 3,742,781 | 4 | false | 1 | 0 | runserver refers to the development server that is distributed with Django. Restarting this one or your httpd are the same thing, in both cases you restart the webserver. If you're using apache, you are not using the development server that is startet by runserver.py. | 3 | 7 | 0 | In django framework,When there are changes in urls.py or model.py or views.py .We would restart httpd.
But as the documentation says we could restart runserver to get the latest changes.
Which is the best efficient way for doing the above | Django restart server or httpd | 0.049958 | 0 | 0 | 39,920 |
3,743,222 | 2010-09-18T19:44:00.000 | 9 | 0 | 1 | 0 | python,datetime | 57,867,465 | 9 | false | 0 | 0 | you could enter this code form for (today date & Names of the Day & hour) :
datetime.datetime.now().strftime('%y-%m-%d %a %H:%M:%S')
'19-09-09 Mon 17:37:56'
and enter this code for (today date simply):
datetime.date.today().strftime('%y-%m-%d')
'19-09-10'
for object :
datetime.datetime.now().date()
datetime.datetime.t... | 2 | 899 | 0 | How do I convert a datetime.datetime object (e.g., the return value of datetime.datetime.now()) to a datetime.date object in Python? | How do I convert a datetime to date? | 1 | 0 | 0 | 961,155 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.