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
2,543,315
2010-03-30T06:52:00.000
1
0
0
0
python,pylons,authkit
2,543,332
1
true
1
0
There is no single "logged-in user" if you're serving requests on multiple threads -- by setting a single global variable the threads would trample upon each other and end up very very confused on who "the logged-in user" actually is. There is (at most;-) a single logged-in user per request, so keeping that info in the request object seems vastly preferable;-).
1
0
0
How can I can set a global variable for the username of the logged-in user? At the moment i have the following code in all my controllers to get the username. I rather set it as a global variable if possible. request.environ.get("REMOTE_USER") I tried putting the same code in the app_globals.py file but it gave me the following error message: "No object (name: request) has been registered for this thread"
Pylons: Set global variable for Authkit user
1.2
0
0
360
2,544,331
2010-03-30T10:09:00.000
3
0
0
0
python,xml,soap,suds,envelope
2,545,937
4
true
1
0
I managed to get this working, the soap envelope is hard coded into bindings.py that is stored in suds.egg installed in your site-packages. I changed the SOAP envelope address to http://www.w3.org/2003/05/soap-envelope. This was compatible with my camera. I was unable to find a command to overwrite this envelope in suds so I hard coded it in to the bindings.py. Thanks for any help
1
7
0
I have a camera and I am trying to connect to it vis suds. I have tried to send raw xml and have found that the only thing stopping the xml suds from working is an incorrect Soap envelope namespace. The envelope namespace is: xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" and I want to rewrite it to: xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" In order to add a namespace in python I try this code: message = Element('Element_name').addPrefix(p='SOAP-ENC', u='www.w3.org/ENC') But when I add the SOAP-ENV to the namespace it doesn't write as it is hardcoded into the suds bindings. Is there a way to overwrite this in suds? Thanks for any help.
Overwrite the Soap Envelope in Suds python
1.2
0
0
4,252
2,545,783
2010-03-30T14:02:00.000
0
0
1
0
python,xml
2,546,454
5
false
0
0
It looks like you're dealing with data which are saved with some kind of encoding "as if" they were ASCII. XML file should normally be UTF8, and SAX (the underlying parser used by minidom) should handle that, so it looks like something's wrong in that part of the processing chain. Instead of focusing on "cleaning up" I'd first try to make sure the encoding is correct and correctly recognized. Maybe a broken XML directive? Can you edit your Q to show the first few lines of the file, especially the <?xml ... directive at the very start?
1
1
0
I'm using minidom to parse an xml file and it threw an error indicating that the data is not well formed. I figured out that some of the pages have characters like ไอเฟล &, causing the parser to hiccup. Is there an easy way to clean the file before I start parsing it? Right now I'm using a regular expressing to throw away anything that isn't an alpha numeric character and the </> characters, but it isn't quite working.
Cleaning an XML file in Python before parsing
0
0
1
5,927
2,545,820
2010-03-30T14:07:00.000
6
1
0
0
python
2,545,940
9
false
1
0
ok, not entirely to the point, but before you go and start fixing it, make sure everyone understands the situation. it seems to me that they're putting some pressure on you to fix the "problem". well first of all, when you wrote the application, have they specified the performance requirements? did they tell you that they need operation X to take less than Y secs to complete? Did they specify how many concurrent users must be supported without penalty to the performance? If not, then tell them to back off and that it is iteration (phase, stage, whatever) one of the deployment, and the main goal was the functionality and testing. phase two is performance improvements. let them (with your help obviously) come up with some non functional requirements for the performance of your system. by doing all this, a) you'll remove the pressure applied by the finance team (and i know they can be a real pain in the bum) b) both you and your clients will have a clear idea of what you mean by "performance" c) you'll have a base that you can measure your progress and most importantly d) you'll have some agreed time to implement/fix the performance issues. PS. that aside, look at the indexing... :)
3
11
0
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
Optimization Techniques in Python
1
1
0
1,942
2,545,820
2010-03-30T14:07:00.000
4
1
0
0
python
2,546,955
9
true
1
0
A surprising feature of Python is that the pythonic code is quite efficient... So a few general hints: Use built-ins and standard functions whenever possible, they're already quite well optimized. Try to use lazy generators instead one-off temporary lists. Use numpy for vector arithmetic. Use psyco if running on x86 32bit. Write performance critical loops in a lower level language (C, Pyrex, Cython, etc.). When calling the same method of a collection of objects, get a reference to the class function and use it, it will save lookups in the objects dictionaries (this one is a micro-optimization, not sure it's worth) And of course, if scalability is what matters: Use O(n) (or better) algorithms! Otherwise your system cannot be linearly scalable. Write multiprocessor aware code. At some point you'll need to throw more computing power at it, and your software must be ready to use it!
3
11
0
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
Optimization Techniques in Python
1.2
1
0
1,942
2,545,820
2010-03-30T14:07:00.000
2
1
0
0
python
2,546,996
9
false
1
0
before you can "fix" something you need to know what is "broken". In software development that means profiling, profiling, profiling. Did I mention profiling. Without profiling you don't know where CPU cycles and wall clock time is going. Like others have said to get any more useful information you need to post the details of your entire stack. Python version, what you are using to store the data in (mysql, postgres, flat files, etc), what web server interface cgi, fcgi, wsgi, passenger, etc. how you are generating the HTML, CSS and assuming Javascript. Then you can get more specific answers to those tiers.
3
11
0
Recently i have developed a billing application for my company with Python/Django. For few months everything was fine but now i am observing that the performance is dropping because of more and more users using that applications. Now the problem is that the application is now very critical for the finance team. Now the finance team are after my life for sorting out the performance issue. I have no other option but to find a way to increase the performance of the billing application. So do you guys know any performance optimization techniques in python that will really help me with the scalability issue Guys we are using mysql database and its hosted on apache web server on Linux box. Secondly what i have noticed more is the over all application is slow and not the database transactional part. For example once the application is loaded then it works fine but if they navigate to other link on that application then it takes a whole lot of time. And yes we are using HTML, CSS and Javascript
Optimization Techniques in Python
0.044415
1
0
1,942
2,545,961
2010-03-30T14:26:00.000
3
0
1
0
python,multiprocessing,dictionary
2,546,152
4
false
0
0
Is there a reason that the dictionary needs to be shared in the first place? Could you have each thread maintain their own instance of a dictionary and either merge at the end of the thread processing or periodically use a call-back to merge copies of the individual thread dictionaries together? I don't know exactly what you are doing, so keep in my that my written plan may not work verbatim. What I'm suggesting is more of a high-level design idea.
1
28
0
I am using Python 2.6 and the multiprocessing module for multi-threading. Now I would like to have a synchronized dict (where the only atomic operation I really need is the += operator on a value). Should I wrap the dict with a multiprocessing.sharedctypes.synchronized() call? Or is another way the way to go?
How to synchronize a python dict with multiprocessing
0.148885
0
0
19,928
2,546,039
2010-03-30T14:35:00.000
3
0
0
0
python,random
2,546,266
4
false
0
0
jumpahead(1) is indeed sufficient (and identical to jumpahead(50000) or any other such call, in the current implementation of random -- I believe that came in at the same time as the Mersenne Twister based implementation). So use whatever argument fits in well with your programs' logic. (Do use a separate random.Random instance per thread for thread-safety purposes of course, as your question already hints). (random module generated numbers are not meant to be cryptographically strong, so it's a good thing that you're not using for security purposes;-).
1
4
1
I have a application that does a certain experiment 1000 times (multi-threaded, so that multiple experiments are done at the same time). Every experiment needs appr. 50.000 random.random() calls. What is the best approach to get this really random. I could copy a random object to every experiment and do than a jumpahead of 50.000 * expid. The documentation suggests that jumpahead(1) already scrambles the state, but is that really true? Or is there another way to do this in 'the best way'? (No, the random numbers are not used for security, but for a metropolis hasting algorithm. The only requirement is that the experiments are independent, not whether the random sequence is somehow predictable or so)
How should I use random.jumpahead in Python
0.148885
0
0
2,828
2,546,197
2010-03-30T14:55:00.000
3
0
1
1
python,windows
2,546,238
2
false
0
0
Environment settings always happen in the child process and never directly affect the parent process. However you can run (in the same child process that has changed its environment, at the very end of that process) a command (env in Unix-like environment, I believe set in DOS where .bat files lived and in Windows where .cmd files are similar) that outputs the environment to its standard-output, or to a file; the parent process can read that file and apply the changes to its own environment. In Unix, subprocess.Popen('thescript; env', shell=True, stdout=...) may suffice. In Windows, I'm not sure passing as the first argument foo.bat; set would work; if it doesn't, just create a tiny temporary "auxiliary bat" that does foo.bat then set, and run that one instead.
1
4
0
I call .bat files in Python to set system environments, and check the system environments were set properly, and then back to run python code, the system environments are changed back to original. How can I solve this problem?
How can I keep the system environments set by a bat file, which called by a python script
0.291313
0
0
375
2,547,554
2010-03-30T18:19:00.000
91
0
1
1
python
2,547,577
11
true
0
0
I think it is totally independent. Just install them, then you have the commands e.g. /usr/bin/python2.5 and /usr/bin/python2.6. Link /usr/bin/python to the one you want to use as default. All the libraries are in separate folders (named after the version) anyway. If you want to compile the versions manually, this is from the readme file of the Python source code: Installing multiple versions On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure script) you must take care that your primary python executable is not overwritten by the installation of a different version. All files and directories installed using "make altinstall" contain the major and minor version and can thus live side-by-side. "make install" also creates ${prefix}/bin/python3 which refers to ${prefix}/bin/pythonX.Y. If you intend to install multiple versions using the same prefix you must decide which version (if any) is your "primary" version. Install that version using "make install". Install all other versions using "make altinstall". For example, if you want to install Python 2.5, 2.6 and 3.0 with 2.6 being the primary version, you would execute "make install" in your 2.6 build directory and "make altinstall" in the others.
3
107
0
Is there official documentation on the Python website somewhere, on how to install and run multiple versions of Python on the same machine on Linux? I can find gazillions of blog posts and answers, but I want to know if there is a "standard" official way of doing this? Or is this all dependent on OS?
Multiple Python versions on the same machine?
1.2
0
0
165,340
2,547,554
2010-03-30T18:19:00.000
0
0
1
1
python
2,547,576
11
false
0
0
It's most strongly dependent on the package distribution system you use. For example, with MacPorts, you can install multiple Python packages and use the pyselect utility to switch the default between them with ease. At all times, you're able to call the different Python interpreters by providing the full path, and you're able to link against all the Python libraries and headers by providing the full paths for those. So basically, whatever way you install the versions, as long as you keep your installations separate, you'll able to run them separately.
3
107
0
Is there official documentation on the Python website somewhere, on how to install and run multiple versions of Python on the same machine on Linux? I can find gazillions of blog posts and answers, but I want to know if there is a "standard" official way of doing this? Or is this all dependent on OS?
Multiple Python versions on the same machine?
0
0
0
165,340
2,547,554
2010-03-30T18:19:00.000
28
0
1
1
python
2,547,801
11
false
0
0
On Windows they get installed to separate folders, "C:\python26" and "C:\python31", but the executables have the same "python.exe" name. I created another "C:\python" folder that contains "python.bat" and "python3.bat" that serve as wrappers to "python26" and "python31" respectively, and added "C:\python" to the PATH environment variable. This allows me to type python or python3 in my .bat Python wrappers to start the one I desire. On Linux, you can use the #! trick to specify which version you want a script to use.
3
107
0
Is there official documentation on the Python website somewhere, on how to install and run multiple versions of Python on the same machine on Linux? I can find gazillions of blog posts and answers, but I want to know if there is a "standard" official way of doing this? Or is this all dependent on OS?
Multiple Python versions on the same machine?
1
0
0
165,340
2,548,705
2010-03-30T21:02:00.000
1
1
0
0
python,wsgi
9,439,466
2
false
1
0
Psyco is dead -- its successor is called PyPy. You are unlikely to get any speed increase with an I/O bound application however.
2
2
0
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your set up look like? Did you get measurable results?
Does anyone have any feedback on using Psyco in a wsgi application?
0.099668
0
0
186
2,548,705
2010-03-30T21:02:00.000
2
1
0
0
python,wsgi
2,553,516
2
true
1
0
The question you should ask is not did you get measurable results, but does it make your site noticeably faster? Most web applications are not CPU bound, so even if JIT makes them faster, you probably weren't fully utilizing your processor to begin with. It has been a very long time since I played with psyco, but order to get measurable results I would have to simulate thousands of concurrent requests, an unrealistic situation for the average web site. Keep in mind that psyco is not compatible with 64-bit python. The average website doesn't need more than 4gb of ram, but think that ram is generally of more value than CPU cycles.
2
2
0
Have you tried Psyco in a wsgi application (custom, Pylons, Django...)? What does your set up look like? Did you get measurable results?
Does anyone have any feedback on using Psyco in a wsgi application?
1.2
0
0
186
2,550,292
2010-03-31T03:19:00.000
6
0
0
0
python,sql,mysql,sqlalchemy
2,550,578
3
false
0
0
In addition to what Alex said... "Not wanting to learn SQL" is probably a bad thing. However, if you want to get more non-technical people involved as part of the development process, ORMs do a pretty good job at it because it does push this level of complexity down a level. One of the elements that has made Django successful is its ability to let "newspaper journalists" maintain a website, rather than software engineers. One of the limitations of ORMs is that they are not as scalable as using raw SQL. At a previous job, we wanted to get rid of a lot of manual SQL generation and switched to an ORM for ease-of-use (SQLAlchemy, Elixir, etc.), but months later, I ended up having to write raw SQL again to get around the inefficient or high latency queries that were generated by the ORM system.
3
24
0
Why do people use SQLAlchemy instead of MySQLdb? What advantages does it offer?
Purpose of SQLAlchemy over MySQLdb
1
1
0
19,410
2,550,292
2010-03-31T03:19:00.000
32
0
0
0
python,sql,mysql,sqlalchemy
2,550,364
3
true
0
0
You don't use SQLAlchemy instead of MySQLdb—you use SQLAlchemy to access something like MySQLdb, oursql (another MySQL driver that I hear is nicer and has better performance), the sqlite3 module, psycopg2, or whatever other database driver you are using. An ORM (like SQLAlchemy) helps abstract away the details of the database you are using. This allows you to keep from the miry details of the database system you're using, avoiding the possibility of errors some times (and introducing the possibility of others), and making porting trivial (at least in theory).
3
24
0
Why do people use SQLAlchemy instead of MySQLdb? What advantages does it offer?
Purpose of SQLAlchemy over MySQLdb
1.2
1
0
19,410
2,550,292
2010-03-31T03:19:00.000
12
0
0
0
python,sql,mysql,sqlalchemy
2,550,304
3
false
0
0
Easier portability among different DB engines (say that tomorrow you decide you want to move to sqlite, or PostgreSQL, or...), and higher level of abstraction (and thus potentially higher productivity). Those are some of the good reasons. There are also some bad reasons for using an ORM, such as not wanting to learn SQL, but I suspect SQLAlchemy in particular is not really favored by people for such bad reasons for wanting an ORM rather than bare SQL;-).
3
24
0
Why do people use SQLAlchemy instead of MySQLdb? What advantages does it offer?
Purpose of SQLAlchemy over MySQLdb
1
1
0
19,410
2,550,308
2010-03-31T03:25:00.000
0
0
0
0
python,django,views
2,550,450
2
false
1
0
whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) So... why not just expect a model instance to be passed in as a parameter? Or a QuerySet from which you will take element 0? Then you can combine it with the QuerySet case, and maybe roll it into get_object_or_404. My suggestion is to look at how Django's generic views are written. They're solving the same general class of problems you are. You seem most of the way there, except for the last part.
2
0
0
These are the techniques that I use regularly to make my views reusable: take the template_name as an argument with a default take an optional extra_context which defaults to empty {} right before the template is rendered the context is updated with the extra_context for further re-usability, call any callable in extra_context.values() whenever the view deals with a queryset, there is a queryset argument with a default whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) First, should I add anything to my list? Should I remove anything from my list? The items accommodates a large number of cases. However, whenever an app extends a model of another in some way (e.g. adding a field or changing the behavior in some way) I end up writing my own views and only reusing the model. Is this normal? Edit/answering my own question partially: signals: the view should emit a signal when it starts and one before it returns the response
how to write re-usable views in django?
0
0
0
151
2,550,308
2010-03-31T03:25:00.000
0
0
0
0
python,django,views
2,550,339
2
false
1
0
I would think that doing all of those puts a large burden on your urlconf to get everything right. Perhaps making a function that takes all that and hardcoding your views to be a glorified wrapper around said function would be better.
2
0
0
These are the techniques that I use regularly to make my views reusable: take the template_name as an argument with a default take an optional extra_context which defaults to empty {} right before the template is rendered the context is updated with the extra_context for further re-usability, call any callable in extra_context.values() whenever the view deals with a queryset, there is a queryset argument with a default whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) First, should I add anything to my list? Should I remove anything from my list? The items accommodates a large number of cases. However, whenever an app extends a model of another in some way (e.g. adding a field or changing the behavior in some way) I end up writing my own views and only reusing the model. Is this normal? Edit/answering my own question partially: signals: the view should emit a signal when it starts and one before it returns the response
how to write re-usable views in django?
0
0
0
151
2,550,370
2010-03-31T03:45:00.000
3
0
1
0
c#,visual-studio,ironpython,ironruby
2,550,627
2
true
0
1
You can't add reference to a project since it's a Visual Studio thing. I suggest that during the development process, call import (IronPython) or require (IronRuby) with the full path of your project assembly like c:\dev\MyProject\bin\Debug\MyProject.dll.
1
2
0
I know how to reference an existing .dll to IronPython, but is there any way to add my project as a reference like I can between Visual Studio projects? Or is it best practice to create a separate class library?
Any way to add my C# project as a reference in IronPython / IronRuby?
1.2
0
0
1,069
2,550,523
2010-03-31T04:37:00.000
1
0
0
1
python,linux,dbus
2,559,633
2
true
0
0
I'm pretty sure that both Pidgin and Empathy assume you're online if you disable NM by right-clicking the Network Manager tray icon and untick Enable Networking. So you can do this when you're connecting via a non-NM mechanism. No code necessary! (You could write an application which implements the same D-Bus interface as NetworkManager, sits on the system bus, and pretends to be online, and then when you want to use your network kill the real NetworkManager program and start your fake one, but that smells like overkill to me...)
2
0
0
Is there a way using Python to simulate the presence of an active network connection using dbus? If I call getstate() on the dbus, I'm able to get the current network state. I want to set the current state to 4 (Connection Present). This is because Network Manager is not able to connect using my modem and I use other tools to connect. Pidgin, Empathy and other software are not able to detect the network.
Simulate Network Presence in dbus
1.2
0
0
438
2,550,523
2010-03-31T04:37:00.000
0
0
0
1
python,linux,dbus
2,550,541
2
false
0
0
Your options are to write something that mocks NetworkManager's D-Bus interface, or to write a module for NetworkManager that supports the tools you use.
2
0
0
Is there a way using Python to simulate the presence of an active network connection using dbus? If I call getstate() on the dbus, I'm able to get the current network state. I want to set the current state to 4 (Connection Present). This is because Network Manager is not able to connect using my modem and I use other tools to connect. Pidgin, Empathy and other software are not able to detect the network.
Simulate Network Presence in dbus
0
0
0
438
2,550,980
2010-03-31T06:51:00.000
0
0
1
0
python,dictionary,dataset,large-files
2,550,988
4
false
0
0
Assuming you are on a *nix platform, you are just BEGGING for tokyo-cabinet... It has a native set of ruby bindings... You can more information at 1978th.net...
1
2
0
I have a set of key/values (all text) that is too large to load in memory at once. I would like to interact with this data via a Python dictionary-like interface. Does such a module already exist? Reading key values should be efficient and values compressed on disk to save space. Edit: Ideally cross platform, but only using Linux for now Needs to be thread safe
dictionary interface for large data sets
0
0
0
1,360
2,552,605
2010-03-31T11:53:00.000
4
1
0
0
python,pylint
2,552,989
6
true
0
0
No you can't, Global Evaluation is part of the reports and with --reports=n you disable all the reports .
2
8
0
In pylint I use this command --reports=n to disable the reports, but now I don't see the Global evaluation more. Is possible enable only the Global evaluation?
Pylint only Global evaluation
1.2
0
0
2,700
2,552,605
2010-03-31T11:53:00.000
0
1
0
0
python,pylint
3,458,752
6
false
0
0
As systempunttoout said, this is currently not possible. But you can ask for this on the python-projects@logilab.org mailing list, and submitting a patch is a very good way of getting that feature soon. :-)
2
8
0
In pylint I use this command --reports=n to disable the reports, but now I don't see the Global evaluation more. Is possible enable only the Global evaluation?
Pylint only Global evaluation
0
0
0
2,700
2,553,088
2010-03-31T13:04:00.000
2
0
0
0
python,django,django-admin
2,553,104
4
false
1
0
do you have permission to write to the directory?
2
0
0
I'm totally new to django, and I'm using its documentation to get help on how to use it but seems like something is missing. i installed django using setup.py install command and i added the ( django/bin ) to system path variable but. i still cant start a new project i use the following syntax to start a project : django-admin.py startproject myNewProject but it says Type 'django-admin.py help' for usage. 1 UPDATES : i use windows vista x64 . i checked the environment variables and i don't have DJANGO_SETTINGS_MODULE variable in there . should i add one ?? and with what value ? do i miss anything ? thank u
Django newbie question: can't start a new project
0.099668
0
0
2,582
2,553,088
2010-03-31T13:04:00.000
0
0
0
0
python,django,django-admin
2,559,610
4
false
1
0
check whether you have djagno or not and the it is in python path or not.if using linux go to terminal type python and then try to import django
2
0
0
I'm totally new to django, and I'm using its documentation to get help on how to use it but seems like something is missing. i installed django using setup.py install command and i added the ( django/bin ) to system path variable but. i still cant start a new project i use the following syntax to start a project : django-admin.py startproject myNewProject but it says Type 'django-admin.py help' for usage. 1 UPDATES : i use windows vista x64 . i checked the environment variables and i don't have DJANGO_SETTINGS_MODULE variable in there . should i add one ?? and with what value ? do i miss anything ? thank u
Django newbie question: can't start a new project
0
0
0
2,582
2,553,110
2010-03-31T13:07:00.000
10
0
0
1
python,distutils,cx-freeze
2,553,685
1
true
0
0
You need all of them.
1
2
0
I'm using cx_freeze to freeze a Python script for distribution to other windows systems. I did everything as instructed and cx_freeze generated a build\exe.win32-2.6 folder in the folder containing my sources. This directory now contains a a bunch of PYD files, a library.zip file, the python DLL file and the main executable. Which of these files would I need to distribute? Any help, guys? Thanks in advance.
Which files to distribute using cx_Freeze?
1.2
0
0
897
2,554,722
2010-03-31T16:37:00.000
9
0
1
0
.net,python,exception,invalidoperationexception
2,554,808
4
false
0
0
I'd probably go between one of two options: A custom exception, best defined as follows: class InvalidOperationException(Exception): pass Just using Exception I don't believe there's a direct analogue; Python seems to have a very flat exception hierarchy.
2
26
0
What is the analog for .Net InvalidOperationException in Python?
What is the analog for .Net InvalidOperationException in Python?
1
0
0
4,104
2,554,722
2010-03-31T16:37:00.000
20
0
1
0
.net,python,exception,invalidoperationexception
2,554,816
4
true
0
0
There's no direct equivalent. Usually ValueError or TypeError suffices, perhaps a RuntimeError or NotImplementedError if neither of those fit well.
2
26
0
What is the analog for .Net InvalidOperationException in Python?
What is the analog for .Net InvalidOperationException in Python?
1.2
0
0
4,104
2,554,758
2010-03-31T16:41:00.000
0
0
1
0
python,format,specifications
2,555,037
3
false
0
0
I don't believe that it's possible to define a new format specifier for print. You might be able to add a method to your class that sets a format that you use, and define the str method of the class to adjust it's output according to how it was set. Then the main print statement would still use a '%s' specifier, and call your custom str.
2
2
0
in python, how can a custom format-specification be added, to a class ? for example, if i write a matrix class, i would like to define a '%M' (or some such) which would then dump the entire contents of the matrix... thanks
custom format specifications in python
0
0
0
1,108
2,554,758
2010-03-31T16:41:00.000
5
0
1
0
python,format,specifications
2,554,780
3
false
0
0
Defining the __str__()/__unicode__() and/or __repr__() methods will let you use the existing %s and %r format specifiers as you like.
2
2
0
in python, how can a custom format-specification be added, to a class ? for example, if i write a matrix class, i would like to define a '%M' (or some such) which would then dump the entire contents of the matrix... thanks
custom format specifications in python
0.321513
0
0
1,108
2,555,393
2010-03-31T18:18:00.000
1
0
1
0
python,distribution
2,555,428
5
false
0
0
Normally you would just include the libraries in the final released version, but not necessarily include them in the source releases.
3
1
0
I'm writing a Python open-source app. My app uses some open source Python libraries. These libraries in turn use other open-source libraries. I intend to release my code at Sourceforge or Google Code but do I need to include the sources of the other libraries? Is this a good practice? ...or should I simply write this information into a README file informing the use about the other required libraries. I've placed all these libraries into a libs sub folder in my source directory. When checking my code into SVN, should I use something called svn:externals to link to other sources? Is there a way to dynamically update my libraries to the latest version or is this something I have to do manually when I release a new version. My sincerest apologies if my question sounds vague but I'm pretty lost in this matter and I don't know what to Google for. Thanks all.
Including libraries in project. Best practice
0.039979
0
0
734
2,555,393
2010-03-31T18:18:00.000
1
0
1
0
python,distribution
2,555,599
5
false
0
0
In general (for Python): don't ship the source of other libraries which you depend upon in your code. Just state the required dependencies (complete with minimum required version, installation instructions etc) on a website and in instructions shipped with the source.
3
1
0
I'm writing a Python open-source app. My app uses some open source Python libraries. These libraries in turn use other open-source libraries. I intend to release my code at Sourceforge or Google Code but do I need to include the sources of the other libraries? Is this a good practice? ...or should I simply write this information into a README file informing the use about the other required libraries. I've placed all these libraries into a libs sub folder in my source directory. When checking my code into SVN, should I use something called svn:externals to link to other sources? Is there a way to dynamically update my libraries to the latest version or is this something I have to do manually when I release a new version. My sincerest apologies if my question sounds vague but I'm pretty lost in this matter and I don't know what to Google for. Thanks all.
Including libraries in project. Best practice
0.039979
0
0
734
2,555,393
2010-03-31T18:18:00.000
3
0
1
0
python,distribution
2,555,736
5
false
0
0
As others say, do not include the libraries, state the requirements in documentation. This way your project can use the libraries users already have, sometimes provided by their operating system distribution. But then, keep in mind those external dependencies, that may exist in different versions or even configurations. Choose a stable branch (not the bleeding edge development snapshots) of the libraries whenever possible. When you really need a specific snapshot of the library, then including it in your package may be a better choice then forcing users to install something non-standard in their systems.
3
1
0
I'm writing a Python open-source app. My app uses some open source Python libraries. These libraries in turn use other open-source libraries. I intend to release my code at Sourceforge or Google Code but do I need to include the sources of the other libraries? Is this a good practice? ...or should I simply write this information into a README file informing the use about the other required libraries. I've placed all these libraries into a libs sub folder in my source directory. When checking my code into SVN, should I use something called svn:externals to link to other sources? Is there a way to dynamically update my libraries to the latest version or is this something I have to do manually when I release a new version. My sincerest apologies if my question sounds vague but I'm pretty lost in this matter and I don't know what to Google for. Thanks all.
Including libraries in project. Best practice
0.119427
0
0
734
2,559,659
2010-04-01T10:21:00.000
2
0
1
1
python,database,jet
2,559,686
4
false
0
0
Probably the most simple solution: Download VirtualBox and install Windows and MS access in it. Write a small Python server which use ODBC to access the database and which receives commands from a network socket. On Linux, connect to the server in the virtual machine and access the database this way. This gives you full access to all features. Every other solution will either limit the features you can use (for example, you won't be able to modify the data) or be pretty unsafe.
1
12
0
Is there a way to access a JET database from Python? I'm on Linux. All I found was a .mdb viewer in the repositories, but it's very faulty. Thanks
Accessing a JET (.mdb) database in Python
0.099668
0
0
8,629
2,561,472
2010-04-01T15:20:00.000
0
1
0
0
python,svn,fabric
2,561,630
6
false
0
0
You might need to supply the user as well? If not, you may have better luck exporting your repo and making a tar of it (locally) to upload+deploy on the server. If you run the svn commands locally, you'll be able to get prompted for your username and/or password.
1
7
0
Assuming that I cannot run something like this with Fabric: run("svn update --password 'password' .") how's the proper way to pass to Fabric the password for the remote interactive command line? The problem is that the repo is checked out as svn+ssh and I don't have a http/https/svn option
fabric and svn password
0
0
0
3,015
2,561,542
2010-04-01T15:28:00.000
3
0
0
1
python,eclipse,wxpython
12,983,874
3
false
0
1
wxPython install by default to the following path /usr/local/lib/wxPython-2.9.4.0 When adding a path to the Interpreter libraries section in the eclipse preferences add this path: /usr/local/lib/wxPython-2.9.4.0/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa
2
3
0
I've been browsing documentation, but haven't been able to find a straightforward tutorial, so I apologize if this is a really simple question. Anyway, I have eclipse with pydev installed on MAC OSX, and I want configure wxPython to work with eclipse, how do I do this? Once I've downloaded wxpython, what steps do I take to allow wxPython development from eclipse? Thanks!
Configuring Eclipse with wxPython
0.197375
0
0
8,700
2,561,542
2010-04-01T15:28:00.000
7
0
0
1
python,eclipse,wxpython
2,562,141
3
false
0
1
Vinay's answer above is correct. However, if code completion is not picking it up, you might need to add the WX directory to the Pydev's interpreter library path. Window | Preferences | Pydev | Interpreter - Python | Libraries If wx is not present, New Folder and select the install directory.
2
3
0
I've been browsing documentation, but haven't been able to find a straightforward tutorial, so I apologize if this is a really simple question. Anyway, I have eclipse with pydev installed on MAC OSX, and I want configure wxPython to work with eclipse, how do I do this? Once I've downloaded wxpython, what steps do I take to allow wxPython development from eclipse? Thanks!
Configuring Eclipse with wxPython
1
0
0
8,700
2,561,804
2010-04-01T16:05:00.000
4
0
0
0
python,database,cassandra,thrift
2,567,396
1
true
0
0
Use pycassa if you don't know what to use. Use lazyboy if you want it to maintain indexes for you. It's significantly more complex.
1
5
0
I'm going to write the web portal using Cassandra databases. Can you advise me which python interface to use? thrift, lazygal or pycassa? Are there any benefits to use more complicated thrift then cleaner pycassa? What about performace - is the same (all of them are just the layer)? Thanks for any advice.
Cassandra database, which python interface?
1.2
1
0
1,065
2,562,167
2010-04-01T17:03:00.000
4
0
0
0
python,django,template-engine,mako
2,562,356
3
false
1
0
Ask yourself this question: What are you getting out of this project? What do you want to learn? If you want to know the nuts and bolts of a web server the hard way: concoct your own web framework using Mako and other useful building blocks as needed. As @pulegium says, you'll have to choose how to handle the HTTP layer and database layer. If you want to get a website up and running quickly: do use Django. It's well documented and is an all-in-one solution. I've found its admin interface to be a real killer. What Django doesn't provide is tools for deployment; you'll have to write a script or use a deployment solution to update your code on the server. If you want to be more lazy: use Google App Engine. (With the silent agreement to follow the rules of the BigTable, which is quite different from popular relational database systems.) GAE takes care of installation and deployment of your web app, logging, versioning and other stuffs you need to take care of when running a website. You can also use Django on GAE.
3
4
0
I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks
What should I use - Mako or Django?
0.26052
0
0
1,845
2,562,167
2010-04-01T17:03:00.000
2
0
0
0
python,django,template-engine,mako
2,562,185
3
true
1
0
Django. Because it takes care for all bits and pieces (url mapping, request object handling etc) and hides the DB access from you as well. If you want you can use SQLite DB so no need for MysQL or other "proper" DBs. If you were using just template engine you'd have to take care of HTTP layer yourself. And the DB stuff as well.
3
4
0
I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks
What should I use - Mako or Django?
1.2
0
0
1,845
2,562,167
2010-04-01T17:03:00.000
0
0
0
0
python,django,template-engine,mako
5,249,036
3
false
1
0
I have used mako for some time and have also tried to get to grips with django in google appengine. If you are a python whizz... definitely opt for Mako. I'm finding django frustrating as the syntax doesn't allow me to do really nice pythonic code. I'm going to drop Mako into my appengine project before it's too late!
3
4
0
I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks
What should I use - Mako or Django?
0
0
0
1,845
2,562,697
2010-04-01T18:31:00.000
0
0
1
0
python,numpy,ipython
2,569,226
4
false
0
0
in ipython, ipipe.igrid() can be used to view tabular data.
2
4
1
Is there a data viewer in Python/IPython like the variable editor in MATLAB?
MATLAB-like variable editor in Python
0
0
0
2,415
2,562,697
2010-04-01T18:31:00.000
0
0
1
0
python,numpy,ipython
28,463,696
4
false
0
0
Even Pycharm will be a good option if you are looking for MATLAB like editor.
2
4
1
Is there a data viewer in Python/IPython like the variable editor in MATLAB?
MATLAB-like variable editor in Python
0
0
0
2,415
2,563,528
2010-04-01T20:40:00.000
1
1
0
0
python,pylons
2,563,615
1
true
0
0
You can modify __call__ function in BaseController.
1
1
0
I want to check whether or not a cookie is set with every page load in Pylons. Where's the best place to put this logic? Thanks!
Pylons check for cookie on every page load
1.2
0
0
109
2,563,773
2010-04-01T21:17:00.000
3
1
0
0
python,arrays,numpy,tuples,complex-numbers
2,564,787
2
false
0
0
A numpy array with an extra dimension is tighter in memory use, and at least as fast!, as a numpy array of tuples; complex numbers are at least as good or even better, including for your third question. BTW, you may have noticed that -- while questions asked later than yours were getting answers aplenty -- your was laying fallow: part of the reason is no doubt that asking three questions within a question turns responders off. Why not just ask one question per question? It's not as if you get charged for questions or anything, you know...!-)
2
10
1
I'm porting an C++ scientific application to python, and as I'm new to python, some problems come to my mind: 1) I'm defining a class that will contain the coordinates (x,y). These values will be accessed several times, but they only will be read after the class instantiation. Is it better to use an tuple or an numpy array, both in memory and access time wise? 2) In some cases, these coordinates will be used to build a complex number, evaluated on a complex function, and the real part of this function will be used. Assuming that there is no way to separate real and complex parts of this function, and the real part will have to be used on the end, maybe is better to use directly complex numbers to store (x,y)? How bad is the overhead with the transformation from complex to real in python? The code in c++ does a lot of these transformations, and this is a big slowdown in that code. 3) Also some coordinates transformations will have to be performed, and for the coordinates the x and y values will be accessed in separate, the transformation be done, and the result returned. The coordinate transformations are defined in the complex plane, so is still faster to use the components x and y directly than relying on the complex variables? Thank you
Better use a tuple or numpy array for storing coordinates
0.291313
0
0
6,196
2,563,773
2010-04-01T21:17:00.000
7
1
0
0
python,arrays,numpy,tuples,complex-numbers
2,564,868
2
true
0
0
In terms of memory consumption, numpy arrays are more compact than Python tuples. A numpy array uses a single contiguous block of memory. All elements of the numpy array must be of a declared type (e.g. 32-bit or 64-bit float.) A Python tuple does not necessarily use a contiguous block of memory, and the elements of the tuple can be arbitrary Python objects, which generally consume more memory than numpy numeric types. So this issue is a hands-down win for numpy, (assuming the elements of the array can be stored as a numpy numeric type). On the issue of speed, I think the choice boils down to the question, "Can you vectorize your code?" That is, can you express your calculations as operations done on entire arrays element-wise. If the code can be vectorized, then numpy will most likely be faster than Python tuples. (The only case I could imagine where it might not be, is if you had many very small tuples. In this case the overhead of forming the numpy arrays and one-time cost of importing numpy might drown-out the benefit of vectorization.) An example of code that could not be vectorized would be if your calculation involved looking at, say, the first complex number in an array z, doing a calculation which produces an integer index idx, then retrieving z[idx], doing a calculation on that number, which produces the next index idx2, then retrieving z[idx2], etc. This type of calculation might not be vectorizable. In this case, you might as well use Python tuples, since you won't be able to leverage numpy's strength. I wouldn't worry about the speed of accessing the real/imaginary parts of a complex number. My guess is the issue of vectorization will most likely determine which method is faster. (Though, by the way, numpy can transform an array of complex numbers to their real parts simply by striding over the complex array, skipping every other float, and viewing the result as floats. Moreover, the syntax is dead simple: If z is a complex numpy array, then z.real is the real parts as a float numpy array. This should be far faster than the pure Python approach of using a list comprehension of attribute lookups: [z.real for z in zlist].) Just out of curiosity, what is your reason for porting the C++ code to Python?
2
10
1
I'm porting an C++ scientific application to python, and as I'm new to python, some problems come to my mind: 1) I'm defining a class that will contain the coordinates (x,y). These values will be accessed several times, but they only will be read after the class instantiation. Is it better to use an tuple or an numpy array, both in memory and access time wise? 2) In some cases, these coordinates will be used to build a complex number, evaluated on a complex function, and the real part of this function will be used. Assuming that there is no way to separate real and complex parts of this function, and the real part will have to be used on the end, maybe is better to use directly complex numbers to store (x,y)? How bad is the overhead with the transformation from complex to real in python? The code in c++ does a lot of these transformations, and this is a big slowdown in that code. 3) Also some coordinates transformations will have to be performed, and for the coordinates the x and y values will be accessed in separate, the transformation be done, and the result returned. The coordinate transformations are defined in the complex plane, so is still faster to use the components x and y directly than relying on the complex variables? Thank you
Better use a tuple or numpy array for storing coordinates
1.2
0
0
6,196
2,563,788
2010-04-01T21:22:00.000
0
1
1
0
python,windows,audio,pywin32
10,114,610
3
true
0
0
PyAudiere turns out to be the most convenient. It allows me to simply play an MP3, rather than generate the sound on the fly.
1
3
0
I am trying to get python to make noise when certain things happen. Preferably, i would like to play music of some kind, however some kind of distinctive beeping would be sufficient, like an electronic timer going off. I have thus far only been able to make the system speaker chime using pywin32's Beep, however this simply does not have the volume for my application. Any ideas on how I can do this? EDIT: I have been using PyAudiere for this, but unfortunately the package has been abandoned. Now I need an alternative.
Making Noise with Python
1.2
0
0
1,463
2,563,990
2010-04-01T22:04:00.000
3
0
1
0
python
2,564,014
3
false
0
0
To get the files with the latest timestamps for each day, use a dict with days as keys and tuples of (filename, timestamp) as the values. Loop through all the files, and update the dict value for that day if the dict timestamp is less than the current file, or if no value for that day exists yet.
1
1
0
I have an array of files. I'd like to be able to break that array down into one array with multiple subarrays, each subarray contains files that were created on the same day. So right now if the array contains files from March 1 - March 31, I'd like to have an array with 31 subarrays (assuming there is at least > 1 file for each day). In the long run, I'm trying to find the file from each day with the latest creation/modification time. If there is a way to bundle that into the iterations that are required above to save some CPU cycles, that would be even more ideal. Then I'd have one flat array with 31 files, one for each day, for the latest file created on each individual day. My current data structure is just a flat list of file names.
Python: Taking an array and break it into subarrays based on some criteria
0.197375
0
0
2,256
2,564,137
2010-04-01T22:44:00.000
9
0
1
0
python,multithreading,python-multithreading
18,219,516
6
false
0
0
If you spawn a Thread like so - myThread = Thread(target = function) - and then do myThread.start(); myThread.join(). When CTRL-C is initiated, the main thread doesn't exit because it is waiting on that blocking myThread.join() call. To fix this, simply put in a timeout on the .join() call. The timeout can be as long as you wish. If you want it to wait indefinitely, just put in a really long timeout, like 99999. It's also good practice to do myThread.daemon = True so all the threads exit when the main thread(non-daemon) exits.
1
91
0
If I have a thread in an infinite loop, is there a way to terminate it when the main program ends (for example, when I press Ctrl+C)?
How to terminate a thread when main program ends?
1
0
0
184,722
2,564,312
2010-04-01T23:42:00.000
1
0
0
0
python,sql,database,authorization,md5
2,564,367
2
false
0
0
You should use SSL to encrypt the connection, then send the password over plain text from the client. The server will then md5 and compare with the md5 hash in the database to see if they are the same. If so auth = success. MD5'ing the password on the client buys you nothing because a hacker with the md5 password can get in just as easy as if it was in plain text.
1
2
0
I currently have a SQL database of passwords stored in MD5. The server needs to generate a unique key, then sends to the client. In the client, it will use the key as a salt then hash together with the password and send back to the server. The only problem is that the the SQL DB has the passwords in MD5 already. Therefore for this to work, I would have to MD5 the password client side, then MD5 it again with the salt. Am I doing this wrong, because it doesn't seem like a proper solution. Any information is appreciated.
Server authorization with MD5 and SQL
0.099668
1
0
260
2,564,896
2010-04-02T03:46:00.000
3
0
1
0
python,sorting
2,564,904
3
true
0
0
[x for x in N if n - 10 <= x <= n + 10]
1
3
0
I have 1M numbers:N[], and 1 single number n, now I want to find in those 1M numbers that are similar to that single number, say an area of [n-10, n+10]. what's the best way in python to do this? Do I have to sort the 1M number and do an iteration?
Best way to find similar items in python
1.2
0
0
378
2,565,484
2010-04-02T07:15:00.000
2
0
0
0
python,django,multithreading,django-models
2,565,806
2
false
1
0
But why you need thread? why can't you just do whatever you want to do in django view? If you are using servers like apache with mod-wsgi you should be able to have good control over number of process and threads , so that part shouldn't be your worry or should not be in django views.
2
0
0
One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps: User visits application Thread starts Until the thread finishes, that user's server instance hangs Once the thread completes, a response is delivered to the user Other visitors to the site should not be affected by any other users using the application How can I accomplish something like this? If possible, I'd like to find a lightweight solution.
Django - Threading in views without hanging the server
0.197375
0
0
458
2,565,484
2010-04-02T07:15:00.000
0
0
0
0
python,django,multithreading,django-models
4,045,424
2
false
1
0
I dread to think why you'd want to do that. Are you sure you're not looking for session variables?
2
0
0
One of my applications in my Django project require each request/visitor to that instance to have their own thread. This might sound confusing, so I'll describe what I'm looking to accomplish in a case based scenario, with steps: User visits application Thread starts Until the thread finishes, that user's server instance hangs Once the thread completes, a response is delivered to the user Other visitors to the site should not be affected by any other users using the application How can I accomplish something like this? If possible, I'd like to find a lightweight solution.
Django - Threading in views without hanging the server
0
0
0
458
2,565,776
2010-04-02T08:43:00.000
0
0
0
0
python,wxpython,cursor
2,565,793
2
true
1
0
Use two cursors and change them on events as they need to be.
1
0
0
I want to use the google maps hand cursor in Python but I don't know how to do it. I've downloaded the cursor but I only get to use the hand open, I also have a event that "closes" the hand when clicked but I don't know how can I change the style cursor on it. I say this because the google maps hand cursor has two style (the open and the closed hand). If you don't know how to use the other style you can also tell me how can I create another cursor where the close hand is the default style. If I have that, I only change the cursor and it's done. Thanks in advance :)
How use the google maps hand cursor in Python?
1.2
0
0
593
2,566,357
2010-04-02T11:24:00.000
0
0
1
0
python,macports
2,566,581
2
false
0
0
If you simply want the latest version, couldn't you just not install the old version? If you are planning to build and deploy the svn version yourself and want to test it while not removing the old version, you might find virtualenv useful. It allows you to deploy a parallel Python environment with its own independent set of libraries. I'm still not clear on your requirements, so I hope the above helps somehow.
1
2
0
I am installing one library for python from MacPorts. But macports version of the library is older than actual development svn version. Is it possible to specify a custom location for a port installation in MacPorts so I could install latest library from the developer's site?
MacPorts manual port location
0
0
0
725
2,567,895
2010-04-02T16:48:00.000
0
1
0
1
python,eclipse,pydev
15,892,577
1
false
1
0
there's an easy way to install plugin for eclipse, download the pydev package zip file (not install it via eclipse update), extract it, and put it into your eclipse/dropins/pydev folder. this is a hidden way to install plugin.
1
0
0
I'm having difficulty getting PyDev to work. I had an installation of Eclipse for PHP developers (1.2.1.20090918-0703). A month ago, I installed PyDev, and everything worked great. I go to fire it up this morning, and PyDev is gone. There is no option to create a Python project, the Python language editor is missing, etc. Eclipse for PHP does not say that PyDev is installed, so I grab it from the update URL. The version that comes down is 1.5.6. I restart after the installation, and everything works fine again. Sweet. Then, I grab Subclipse 1.0.7. Upon restarting after that installation, PyDev is now gone. It isn't recognizing Python projects or Python files, etc. So I uninstall Subclipse. PyDev is still gone. Uninstalling and reinstalling PyDev again doesn't bring it back. What am I doing wrong? Do I need a different version of Eclipse? UPDATE: I downloaded a fresh copy of Eclipse for Java, did all this over again, and had PyDev working fine. Then, when I downloaded JSEclipse, PyDev again disappeared. This is super frustrating. UPDATE 2: Another fresh copy of Eclipse. This time I downloaded Subclipse first. It worked fine. Then I downloaded JSEclipse, and Subclipse is gone.
Eclipse: PyDev installation difficulties
0
0
0
1,097
2,568,707
2010-04-02T19:23:00.000
0
0
0
0
python,algorithm,math,matlab,digital-filter
2,569,232
7
false
0
0
It seems unlikely that you'll find exactly what you seek already written in Python, but perhaps the Matlab function's help page gives or references a description of the algorithm?
1
3
1
I am porting code from Matlab to Python and am having trouble finding a replacement for the firls( ) routine. It is used for, least-squares linear-phase Finite Impulse Response (FIR) filter design. I looked at scipy.signal and nothing there looked like it would do the trick. Of course I was able to replace my remez and freqz algorithsm, so that's good. On one blog I found an algorithm that implemented this filter without weighting, but I need one with weights. Thanks, David
Does Python/Scipy have a firls( ) replacement (i.e. a weighted, least squares, FIR filter design)?
0
0
0
4,383
2,568,783
2010-04-02T19:38:00.000
3
0
1
0
python,random,integer,boundary
2,568,804
4
false
0
0
I don't think there's a reason for that. But at least it's documented.
2
57
0
It has always seemed strange to me that random.randint(a, b) would return an integer in the range [a, b], instead of [a, b-1] like range(...). Is there any reason for this apparent inconsistency?
Python: why does `random.randint(a, b)` return a range inclusive of `b`?
0.148885
0
0
61,160
2,568,783
2010-04-02T19:38:00.000
9
0
1
0
python,random,integer,boundary
2,568,995
4
false
0
0
This is speculation, but normal human usage of 'give me a random number from a to b' is inclusive. Implementing it that way sort of makes sense, given Python's general philosophy of being a more human-readable language.
2
57
0
It has always seemed strange to me that random.randint(a, b) would return an integer in the range [a, b], instead of [a, b-1] like range(...). Is there any reason for this apparent inconsistency?
Python: why does `random.randint(a, b)` return a range inclusive of `b`?
1
0
0
61,160
2,569,089
2010-04-02T20:42:00.000
1
0
0
0
python,html,http,forms,screen-scraping
2,574,423
2
false
1
0
If it uses meta tags then you need to parse the HTML manually. Otherwise mechanize will handle the redirect automatically.
1
1
0
I'm trying to submit a few forms through a Python script, I'm using the mechanized library. This is so I can implement a temporary API. The problem is that before after submission a blank page is returned informing that the request is being processed, after a few seconds the page is redirected to the final page. I understand if it might sound a bit generic, but I'm not sure what is going on. :) Any ideas?
How to handle redirects while parsing HTML? - Python
0.099668
0
1
553
2,569,427
2010-04-02T22:00:00.000
-1
0
0
0
php,python,mysql
2,569,567
3
false
0
0
No, there is no way that I've ever heard of or can think of to connect to a MySQL database with vanilla python. Just install the MySqldb python package- You can typically do: sudo easy_install MySqldb
2
0
0
Is there an easy way (without downloading any plugins) to connect to a MySQL database in Python? Also, what would be the difference from calling a PHP script to retrieve the data from the database and hand it over to Python and importing one of these third-parties plugins that requires some additional software in the server. EDIT: the server has PHP and Python installed by default.
Python and MySQL
-0.066568
1
0
332
2,569,427
2010-04-02T22:00:00.000
-1
0
0
0
php,python,mysql
2,569,448
3
false
0
0
If you don't want to download the python libraries to connect to MySQL, the effective answer is no, not trivially.
2
0
0
Is there an easy way (without downloading any plugins) to connect to a MySQL database in Python? Also, what would be the difference from calling a PHP script to retrieve the data from the database and hand it over to Python and importing one of these third-parties plugins that requires some additional software in the server. EDIT: the server has PHP and Python installed by default.
Python and MySQL
-0.066568
1
0
332
2,569,503
2010-04-02T22:21:00.000
3
0
1
0
python,hash,mixed-case
2,569,508
2
true
0
0
you can base64 encode the output of the hash. This has a couple of additional characters beyond those you mentioned.
1
1
0
I am having a hard time figuring out a reasonable way to generate a mixed-case hash in Python. I want to generate something like: aZeEe9E Right now I'm using MD5, which doesn't generate case-sensitive hashes. Do any of you know how to generate a hash value consisting of upper- and lower- case characters + numbers? - Okay, GregS's advice worked like a charm (on the first try!): Here is a simple example: >>> import hashlib, base64 >>> s = 'http://gooogle.com' >>> hash = hashlib.md5(s).digest() >>> print hash 46c4f333fae34078a68393213bb9272d >>> print base64.b64encode(hash) NDZjNGYzMzNmYWUzNDA3OGE2ODM5MzIxM2JiOTI3MmQ=
How to generate a mixed-case hash in Python?
1.2
0
0
1,256
2,570,193
2010-04-03T04:03:00.000
0
0
0
0
python,django,twitter
2,570,547
3
false
1
0
I'm not sure exactly what you're asking, but what's wrong with something like {{ user.get_absolute_url }}? For the tag detail URLs, it really depends on what you're looking for, but you would have to construct the url and view for that yourself.
1
0
0
I'm writing a twitter-like note-taking web app. In a page the latest 20 notes of the user will be listed, and when the user scroll to the bottom of the browser window more items will be loaded and rendered. The initial 20 notes are part of the generated html of my django template, but the other dynamically loaded items are in json format. I want to know how do I do the tag-and-username converting consistently. Thanks in advance.
How to convert tag-and-username-like text into proper links in a twitter message?
0
0
0
207
2,570,621
2010-04-03T08:07:00.000
0
1
0
0
php,python,ftp,curl,multithreading
6,735,686
4
false
0
0
You can run the script in multiple command prompts / shells (just make sure each file is only handled once by all the different scripts). I am not sure if this quick and dirty trick will improve transfer speed though..
1
3
0
I need to upload multiple files from directory to the server via FTP and SFTP. I've solved this task for SFTP with python, paramiko and threading. But I have problem with doing it for FTP. I tried to use ftplib for python, but it seems that it doesn't support threading and I upload all files one by one, which is very slow. I'm wondering is it even possible to do multithreading uploads with FTP protocol without creating separate connections/authorizations (it takes too long)? Solution can be on Python or PHP. Maybe CURL? Would be grateful for any ideas.
Multithreaded FTP upload. Is it possible?
0
0
1
4,789
2,571,202
2010-04-03T12:07:00.000
4
0
0
0
python,user-interface,gtk,pygtk,gnome
2,571,279
1
true
0
1
I think that you should use ComboBox.set_row_separator_func to set a separator function where you would determine which items of your list will be separators. Since ListStore implements TreeModel interface, you should have no problem simply using it in your case. P.S.: nothing is easy in GTK :)
1
4
0
I'm using gtk.combo_box_new_text() to make combobox list, this uses a gtk.ListStore to store only strings, so there are some way to add a separator between items without use a complex gtk.TreeModel? If this is not possible, what is the simplest way to use a gtk.TreeModel to able secuential widget addition?
How to add a separator in a PyGTK combobox?
1.2
0
0
825
2,573,044
2010-04-03T23:32:00.000
1
0
0
0
python,timeout,httpresponse
3,602,969
4
false
0
0
Setting the default timeout might abort a download early if it's large, as opposed to only aborting if it stops receiving data for the timeout value. HTTPlib2 is probably the way to go.
1
1
0
I'm building a download manager in python for fun, and sometimes the connection to the server is still on but the server doesn't send me data, so read method (of HTTPResponse) block me forever. This happens, for example, when I download from a server, which located outside of my country, that limit the bandwidth to other countries. How can I set a timeout for the read method (2 minutes for example)? Thanks, Nir.
set timeout to http response read method in python
0.049958
0
1
3,858
2,573,132
2010-04-04T00:25:00.000
20
0
0
0
python,r,interface,python-3.x
2,661,971
3
true
0
0
edit: Rewrite to summarize the edits that accumulated over time. The current rpy2 release (2.3.x series) has full support for Python 3.3, while no claim is made about Python 3.0, 3.1, or 3.2. At the time of writing the next rpy2 release (under development, 2.4.x series) is only supporting Python 3.3. History of Python 3 support: rpy2-2.1.0-dev / Python 3 branch in the repository - experimental support and application for a Google Summer of Code project consisting in porting rpy2 to Python 3 (under the Python umbrella) application was accepted and thanks to Google's funding support for Python 3 slowly got into the main codebase (there was a fair bit of work still to be done after the GSoC - it made it for branch version_2.2.x).
1
12
1
I am using Python 3.1.1 on Mac OS X 10.6.2 and need an interface to R. When browsing the internet I found out about RPy. Is this the right choice? Currently, a program in Python computes a distance matrix and, stores it in a file. I invoke R separately in an interactive way and read in the matrix for cluster analysis. In order to simplify computation one could prepare a script file for R then call it from Python and read back the results. Since I am new to Python, I would not like to go back to 2.6.
What is the best interface from Python 3.1.1 to R?
1.2
0
0
4,111
2,573,135
2010-04-04T00:28:00.000
2
1
0
0
python
2,573,225
19
false
0
0
Not precisely what you're asking for, but I think it's good advice. Learn another language, doesn't matter too much which. Each language has it's own ideas and conventions that you can learn from. Learn about the differences in the languages and more importantly why they're different. Try a purely functional language like Haskell and see some of the benefits (and challenges) of functions free of side-effects. See how you can apply some of the things you learn from other languages to Python.
5
659
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
Python progression path - From apprentice to guru
0.02105
0
0
383,814
2,573,135
2010-04-04T00:28:00.000
24
1
0
0
python
4,147,969
19
false
0
0
If you're in and using python for science (which it seems you are) part of that will be learning and understanding scientific libraries, for me these would be numpy scipy matplotlib mayavi/mlab chaco Cython knowing how to use the right libraries and vectorize your code is essential for scientific computing. I wanted to add that, handling large numeric datasets in common pythonic ways(object oriented approaches, lists, iterators) can be extremely inefficient. In scientific computing, it can be necessary to structure your code in ways that differ drastically from how most conventional python coders approach data.
5
659
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
Python progression path - From apprentice to guru
1
0
0
383,814
2,573,135
2010-04-04T00:28:00.000
41
1
0
0
python
2,576,226
19
false
0
0
I'll give you the simplest and most effective piece of advice I think anybody could give you: code. You can only be better at using a language (which implies understanding it) by coding. You have to actively enjoy coding, be inspired, ask questions, and find answers by yourself. Got a an hour to spare? Write code that will reverse a string, and find out the most optimum solution. A free evening? Why not try some web-scraping. Read other peoples code. See how they do things. Ask yourself what you would do. When I'm bored at my computer, I open my IDE and code-storm. I jot down ideas that sound interesting, and challenging. An URL shortener? Sure, I can do that. Oh, I learnt how to convert numbers from one base to another as a side effect! This is valid whatever your skill level. You never stop learning. By actively coding in your spare time you will, with little additional effort, come to understand the language, and ultimately, become a guru. You will build up knowledge and reusable code and memorise idioms.
5
659
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
Python progression path - From apprentice to guru
1
0
0
383,814
2,573,135
2010-04-04T00:28:00.000
12
1
0
0
python
2,573,531
19
false
0
0
Thoroughly Understand All Data Types and Structures For every type and structure, write a series of demo programs that exercise every aspect of the type or data structure. If you do this, it might be worthwhile to blog notes on each one... it might be useful to lots of people!
5
659
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
Python progression path - From apprentice to guru
1
0
0
383,814
2,573,135
2010-04-04T00:28:00.000
3
1
0
0
python
4,169,614
19
false
0
0
Teaching to someone else who is starting to learn Python is always a great way to get your ideas clear and sometimes, I usually get a lot of neat questions from students that have me to re-think conceptual things about Python.
5
659
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutions and also with the semantics of the language that allows such a natural flow from thoughts to workable code. What I would like to know is your answer to a kind of question I have seldom seen in this or other forums. This question seems central to me for anyone on the path to Python improvement but who wonders what his next steps should be. Let me sum up what I do NOT want to ask first ;) I don't want to know how to QUICKLY learn Python Nor do I want to find out the best way to get acquainted with the language Finally, I don't want to know a 'one trick that does it all' approach. What I do want to know your opinion about, is: What are the steps YOU would recommend to a Python journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Python coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Python prowess, please enlighten us :) The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this: Read this (eg: python tutorial), pay attention to that kind of details Code for so manytime/problems/lines of code Then, read this (eg: this or that book), but this time, pay attention to this Tackle a few real-life problems Then, proceed to reading Y. Be sure to grasp these concepts Code for X time Come back to such and such basics or move further to... (you get the point :) I really care about knowing your opinion on what exactly one should pay attention to, at various stages, in order to progress CONSTANTLY (with due efforts, of course). If you come from a specific field of expertise, discuss the path you see as appropriate in this field. EDIT: Thanks to your great input, I'm back on the Python improvement track! I really appreciate!
Python progression path - From apprentice to guru
0.031568
0
0
383,814
2,573,670
2010-04-04T05:30:00.000
4
1
0
0
python,simplehttpserver
2,573,685
5
false
0
0
There is no one liner which would do it, also what do you mean by "download whole dir" as tar or zip? Anyway you can follow these steps Derive a class from SimpleHTTPRequestHandler or may be just copy its code Change list_directory method to return a link to "download whole folder" Change copyfile method so that for your links you zip whole dir and return it You may cache zip so that you do not zip folder every time, instead see if any file is modified or not Would be a fun exercise to do :)
1
6
0
I really like how I can easily share files on a network using the SimpleHTTPServer, but I wish there was an option like "download entire directory". Is there an easy (one liner) way to implement this? Thanks
Download whole directories in Python SimpleHTTPServer
0.158649
0
1
11,099
2,574,195
2010-04-04T10:55:00.000
0
0
0
0
python,qt,qt4,pyqt
2,574,214
2
false
0
1
How about creating multiple cursors (QTextCursor), each selection a different portion of the text. Would that work for you?
2
1
0
Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. In Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods. I have no problems being able to create a single selection of text. I am, however, unable to find a way to create multiple selections. The methods in Qt4 do not have an argument which allows you to set a selection id, nor can i find any other function in the QTextCursor or QTextEdit which looks like it might allow me to do so. Has this feature been completely removed from Qt4? or has is there a new and different way of doing it? Thanks. Ronny
how to create multiple selections in text edit box in qt4?
0
0
0
1,173
2,574,195
2010-04-04T10:55:00.000
1
0
0
0
python,qt,qt4,pyqt
2,574,559
2
true
0
1
The solution, i realise now is actually quite simple. To graphically visualise all the various selections (separate QTextCursor objects), instead of calling the setTextCursor() method for the QTextEdit widget for each of the selections, i change the background color of each of those sections of text by calling the setCharFormat() method for each of those QTextCursor objects.
2
1
0
Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. In Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods. I have no problems being able to create a single selection of text. I am, however, unable to find a way to create multiple selections. The methods in Qt4 do not have an argument which allows you to set a selection id, nor can i find any other function in the QTextCursor or QTextEdit which looks like it might allow me to do so. Has this feature been completely removed from Qt4? or has is there a new and different way of doing it? Thanks. Ronny
how to create multiple selections in text edit box in qt4?
1.2
0
0
1,173
2,574,451
2010-04-04T13:04:00.000
0
0
0
0
python,django,django-evolution
2,574,461
4
false
1
0
You need to add it to your INSTALLED_APPS section of settings.py.
4
0
0
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
0
0
0
2,147
2,574,451
2010-04-04T13:04:00.000
1
0
0
0
python,django,django-evolution
2,575,989
4
false
1
0
Does your django_evolution have a init.py file in it? Also any folder containing django_evolution needs one.
4
0
0
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
0.049958
0
0
2,147
2,574,451
2010-04-04T13:04:00.000
0
0
0
0
python,django,django-evolution
8,602,397
4
false
1
0
If you are using virtualenv and ipython is installed at the system level but your app at the env level, it will lead to this. The way out of it is to remove ipython from the system and to install it into your env.
4
0
0
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
0
0
0
2,147
2,574,451
2010-04-04T13:04:00.000
0
0
0
0
python,django,django-evolution
52,769,162
4
false
1
0
I know this is super old, but in case anyone has this issue, my issue was because I had elevated to root inside my venv. I had initialized my virtual environment, and then upgraded my privileges to root. If deactivate doesn't work and you're root, then you should exit then deactivate, then you can do sudo su and then source myenv/bin/activate. Hope this helps!
4
0
0
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing this module when clearly it's been setup and even added to the path? EDIT: This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Django manage.py can't find an INSTALLED_APP even though the module is in the path
0
0
0
2,147
2,575,810
2010-04-04T20:40:00.000
6
0
1
0
python,regex
2,575,830
3
true
0
0
No, not really. Regex is not the correct tool to parse nested structures like you describe; instead you will need to parse the C syntax (or the "dumb subset" of it you're interested in, anyway), and you might find regex helpful in that. A relatively simple state machine with three states (CODE, STRING, COMMENT) would do it.
1
0
0
I am trying to count characters in comments included in C code using Python and Regex, but no success. I can erase strings first to get rid of comments in strings, but this will erase string in comments too and result will be bad ofc. Is there any chance to ask by using regex to not match strings in comments or vice versa?
Comments in string and strings in comments
1.2
0
0
931
2,576,320
2010-04-04T23:49:00.000
1
0
1
0
python
2,576,337
3
false
0
0
That is correct, or very close. Jython and IronPython have changed their numbering scheme to match the CPython version whose features they most closely implement.
3
5
0
for example Jython is at version 2.5.1, does that imply a parallel fidelity to cpython syntax when it was at version 2.5.1?
Do alternate python implementation version numbers imply that they provide the same syntax?
0.066568
0
0
108
2,576,320
2010-04-04T23:49:00.000
1
0
1
0
python
2,576,420
3
false
0
0
The syntax (and feature set) are controlled strictly by the first two numbers -- every 2.5.* is claiming to implement the same syntax and feature set (in terms of language definition, not of aspects the language-reference manual explicitly leaves up to the implementation: for example, both Jython and IronPython have 'buh' mean "a unicode string literal", while CPython has it mean "a byte string literal"). A higher *, within any line of implementation, implies bug fixes and/or optimizations which don't affect syntax and features (except for fixing implementation bugs that had happened at some lower *, if any). So, Jython 2.5.1 may be substituted for any CPython 2.5.x for any value of x -- and it claims to be better than Jython 2.5 (IMHO shd be 2.5.0 but the trailing .0 is not used in practice), though not as good as Jython 2.5.2 if the latter exist. But it does not purport to emulate the bugs in CPython 2.5.1 that were fixed in CPython 2.5.2 or later: no doubt each implementation has its own bugs, and nobody claims bug-for-bug compatibility;-).
3
5
0
for example Jython is at version 2.5.1, does that imply a parallel fidelity to cpython syntax when it was at version 2.5.1?
Do alternate python implementation version numbers imply that they provide the same syntax?
0.066568
0
0
108
2,576,320
2010-04-04T23:49:00.000
2
0
1
0
python
2,576,341
3
false
0
0
Generally yes, but there's technically nothing stopping alternate implementations from choosing whatever version numbers they want. It's also important to note that just because Jython 2.5.1 is intended to match CPython 2.5.1, doesn't mean that they're going to behave exactly the same or be entirely compatible -- consider C-based modules, for example, and facilities for getting at the underlying bytecode. The lack of any real standards body or formal specification for the Python language means that there are no clear rules on what constitutes "Python" and what is "implementation defined".
3
5
0
for example Jython is at version 2.5.1, does that imply a parallel fidelity to cpython syntax when it was at version 2.5.1?
Do alternate python implementation version numbers imply that they provide the same syntax?
0.132549
0
0
108
2,577,967
2010-04-05T10:59:00.000
1
0
0
0
python,database,nosql,data-mining
2,981,162
9
false
0
0
It has been a couple of months since I posted this question and I wanted to let you all know how I solved this problem. I am using Berkeley DB with the module bsddb instead loading all the data in a Python dictionary. I am not fully happy, but my users are. My next step is trying to get a shared server with redis, but unless users starts complaining about speed, I doubt I will get it. Many thanks everybody who helped here, and I hope this question and answers are useful to somebody else.
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
0.022219
1
0
11,416
2,577,967
2010-04-05T10:59:00.000
0
0
0
0
python,database,nosql,data-mining
2,581,460
9
false
0
0
Take a look at mongodb.
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
0
1
0
11,416
2,577,967
2010-04-05T10:59:00.000
12
0
0
0
python,database,nosql,data-mining
2,577,979
9
false
0
0
You probably do need a full relational DBMS, if not right now, very soon. If you start now while your problems and data are simple and straightforward then when they become complex and difficult you will have plenty of experience with at least one DBMS to help you. You probably don't need MySQL on all desktops, you might install it on a server for example and feed data out over your network, but you perhaps need to provide more information about your requirements, toolset and equipment to get better suggestions. And, while the other DBMSes have their strengths and weaknesses too, there's nothing wrong with MySQL for large and complex databases. I don't know enough about SQLite to comment knowledgeably about it. EDIT: @Eric from your comments to my answer and the other answers I form even more strongly the view that it is time you moved to a database. I'm not surprised that trying to do database operations on a 900MB Python dictionary is slow. I think you have to first convince yourself, then your management, that you have reached the limits of what your current toolset can cope with, and that future developments are threatened unless you rethink matters. If your network really can't support a server-based database than (a) you really need to make your network robust, reliable and performant enough for such a purpose, but (b) if that is not an option, or not an early option, you should be thinking along the lines of a central database server passing out digests/extracts/reports to other users, rather than simultaneous, full RDBMS working in a client-server configuration. The problems you are currently experiencing are problems of not having the right tools for the job. They are only going to get worse. I wish I could suggest a magic way in which this is not the case, but I can't and I don't think anyone else will.
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
1
1
0
11,416
2,577,967
2010-04-05T10:59:00.000
1
0
0
0
python,database,nosql,data-mining
2,578,659
9
false
0
0
It sounds like each department has their own feudal database, and this implies a lot of unnecessary redundancy and inefficiency. Instead of transferring hundreds of megabytes to everyone across your network, why not keep your data in MySQL and have the departments upload their data to the database, where it can be normalized and accessible by everyone? As your organization grows, having completely different departmental databases that are unaware of each other, and contain potentially redundant or conflicting data, is going to become very painful.
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
0.022219
1
0
11,416
2,577,967
2010-04-05T10:59:00.000
0
0
0
0
python,database,nosql,data-mining
2,578,310
9
false
0
0
If you have that problem with a CSV file, maybe you can just pickle the dictionary and generate a pickle "binary" file with pickle.HIGHEST_PROTOCOL option. It can be faster to read and you get a smaller file. You can load the CSV file once and then generate the pickled file, allowing faster load in next accesses. Anyway, with 900 Mb of information, you're going to deal with some time loading it in memory. Another approach is not loading it on one step on memory, but load only the information when needed, maybe making different files by date, or any other category (company, type, etc..)
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
0
1
0
11,416
2,577,967
2010-04-05T10:59:00.000
1
0
0
0
python,database,nosql,data-mining
2,578,080
9
false
0
0
Have you done any bench marking to confirm that it is the text files that are slowing you down? If you haven't, there's a good chance that tweaking some other part of the code will speed things up so that it's fast enough.
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
0.022219
1
0
11,416
2,577,967
2010-04-05T10:59:00.000
1
0
0
0
python,database,nosql,data-mining
2,578,751
9
false
0
0
Does the machine this process runs on have sufficient memory and bandwidth to handle this efficiently? Putting MySQL on a slow machine and recoding the tool to use MySQL rather than text files could potentially be far more costly than simply adding memory or upgrading the machine.
7
15
0
I am an occasional Python programer who only have worked so far with MYSQL or SQLITE databases. I am the computer person for everything in a small company and I have been started a new project where I think it is about time to try new databases. Sales department makes a CSV dump every week and I need to make a small scripting application that allow people form other departments mixing the information, mostly linking the records. I have all this solved, my problem is the speed, I am using just plain text files for all this and unsurprisingly it is very slow. I thought about using mysql, but then I need installing mysql in every desktop, sqlite is easier, but it is very slow. I do not need a full relational database, just some way of play with big amounts of data in a decent time. Update: I think I was not being very detailed about my database usage thus explaining my problem badly. I am working reading all the data ~900 Megas or more from a csv into a Python dictionary then working with it. My problem is storing and mostly reading the data quickly. Many thanks!
Best DataMining Database
0.022219
1
0
11,416
2,578,540
2010-04-05T13:18:00.000
0
1
0
0
python,django,cakephp,web-frameworks,yii
2,844,890
8
false
1
0
If for the PHP part I would choose CodeIgniter - it doesn't get too much into your way. But it doesn't have any code/view/model generators out of the box, you need to type a bit. But languages other than PHP appear to be more sexy.
5
21
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
4
1
0
0
python,django,cakephp,web-frameworks,yii
10,847,083
8
false
1
0
Codeigniter it's fast and very documented also has a large community to and finaly friendly with the programmer.
5
21
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0.099668
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
0
1
0
0
python,django,cakephp,web-frameworks,yii
7,084,868
8
false
1
0
I am using CodeIgniter 1.7.2 and for complex websites it's very good and powerfull, but it definitely is missing some kind of code generator which will allow for example to build an IT application in one click. I had the impression (from watching a tutorial) that Django has it.
5
21
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
31
1
0
0
python,django,cakephp,web-frameworks,yii
2,578,635
8
false
1
0
This is a very subjective question but personally I'd recommend Django. Python is a very nice language to use and the Django framework is small, easy to use, well documented and also has a pretty active community. This choice was made partly because of my dislike for PHP though, so take the recommendation with a pinch of salt.
5
21
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
1
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
29
1
0
0
python,django,cakephp,web-frameworks,yii
2,578,670
8
true
1
0
Most of the frameworks out there nowadays are fast enough to serve whatever needs you will have. It really depends on in which environment you feel most comfortable. Though there are nuances here and there, MVC frameworks share a lot of the same principles, so whichever you choose to use is really a matter of which you most enjoy using. So, if you like Python more, there's your answer. Use a Python framework, and Django is the best. If you like PHP more (which I personally don't), you've got some more decisions to make. But any of the PHP frameworks are fine. They really are. Just pick one that looks nice with comprehensive documentation and get to work.
5
21
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site. Thanks, niting
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
1.2
0
0
30,143
2,579,535
2010-04-05T16:32:00.000
0
0
1
0
python,angle,degrees,format-conversion,unit-conversion
2,579,617
11
false
0
0
Use fmod and rounding to get the degrees and fraction separated. Multiply the fraction by 60 and repeat to get minutes and a remainder. Then multiply that last part by 60 again to get the number of seconds.
1
19
0
How do you convert Decimal Degrees to Degrees Minutes Seconds In Python? Is there a Formula already written?
Convert DD (decimal degrees) to DMS (degrees minutes seconds) in Python?
0
0
0
42,007
2,579,840
2010-04-05T17:26:00.000
0
0
1
0
python,getter-setter
55,134,465
8
false
0
0
I had come here for that answer(unfortunately i couldn't) . But i found a work around else where . This below code could be alternative for get . class get_var_lis: def __init__(self): pass def __call__(self): return [2,3,4] def __iter__(self): return iter([2,3,4]) some_other_var = get_var_lis This is just a workaround . By using the above concept u could easily build get/set methodology in py too.
2
87
0
Using get/set seems to be a common practice in Java (for various reasons), but I hardly see Python code that uses this. Why do you use or avoid get/set methods in Python?
Do you use the get/set pattern (in Python)?
0
0
0
98,318