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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
20,756,170 | 2013-12-24T06:43:00.000 | 1 | 0 | 1 | 1 | python,logging | 20,756,290 | 2 | true | 0 | 0 | Maximum size of a file is filesystem dependant. There's nothing about it in Python. | 1 | 0 | 0 | In python, what's the limit of log-file's size by default? 10M, 2G, or some other limit?
Where can I find this information in the API? I know the rollback of RotateFileHandlers, it can configure. Thanks. | what's the limit of logfile's size in python | 1.2 | 0 | 0 | 1,003 |
20,758,839 | 2013-12-24T10:02:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,peewee | 32,690,398 | 4 | false | 1 | 0 | Use of peewee in Django is totally OK. Actually I recently did a project like that. But I still recommend using Django ORM if you do not have some particular reasons to use peewee.
Here are some issues that may occur when you use Peewee in Django:
You may need to write your own db middleware and testcase base class to make django work with peewee.
A lot of django open source apps will not work any more because they depend on Django ORM.
Migrating tables in Peewee is more difficult than Django ORM.
But Obviously Peewee also brings something good:
Stand alone Database processing module, if one day for some reason you do not want to use django any more in a project, it could be very easy to reuse all these peewee code.
It is much easier to make two or more projects use the same database if you use peewee. And the table structures are totally under your control.
And maybe more. So as conclusion, I would say Peewee is great, but it is still not working perfectly with django now. | 2 | 1 | 0 | Working on a python & Django project with mysql (newbie)
Trying to figure out if it is preferable to use peewee in the python DB part & Django models in the Django forms or go ahead and use Django for the entire thing
Related answers claim that Django is high overhead but could not find a base for that assumption
Thanks,
Shimon | peewee vs django for DB processing | 0.049958 | 0 | 0 | 3,159 |
20,758,839 | 2013-12-24T10:02:00.000 | 3 | 0 | 0 | 0 | python,mysql,django,peewee | 20,759,485 | 4 | false | 1 | 0 | This is entirely opinionated, but I think you should use Django for the entire thing. It's not that I don't like peewee. On the contrary, it might very well be a better ORM. But I have a few reasons I think you'd prefer the Django ORM:
I think the Django ORM is more intuitive for beginners, and covers most use-cases pretty well. In the future, when you feel comfortable with Django in general and the Djagno ORM, it will be easier to learn how to use peewee and see if you prefer it over the default
There's a larger community of Django users that don't use peewee over those who do. That means more people being able to help you (and here at SO) and an easier time finding out the answers to any question you will have.
I think peewee is more SQL-y in it's syntax, which I find is easier to understand after you learn a little SQL, while using Django's ORM doesn't require vast SQL knowledge besides the very basic stuff
So peewee is a very viable option, but I think you shouldn't start using it straight away, not before you have any problems with the default. | 2 | 1 | 0 | Working on a python & Django project with mysql (newbie)
Trying to figure out if it is preferable to use peewee in the python DB part & Django models in the Django forms or go ahead and use Django for the entire thing
Related answers claim that Django is high overhead but could not find a base for that assumption
Thanks,
Shimon | peewee vs django for DB processing | 0.148885 | 0 | 0 | 3,159 |
20,761,523 | 2013-12-24T13:06:00.000 | 0 | 1 | 0 | 1 | python,bash,shell,email | 20,764,497 | 2 | false | 0 | 0 | procmail does this kind of thing trivally - checking the format of an incoming email and running a shell script that is. There's no need to reinvent the wheel
I'm not entirely clear from your description how python fits in to what you want to do..
Hope this helps! | 1 | 0 | 0 | Having failed to find an answer to this elsewhere, I am opening this question more widely.
I need to execute a bash shell command when a properly constructed email is received (I'm using GMail) using Python. I have previously used Python to send emails, but the only solution I have yet found is to use feedparser and Google Atom, which I don't like. I would suggest that a keyword could exist in either the subject or body of the email; security is not an issue (I don't think) as the consequence is benign.
The bash command to execute will actually call another scripts to send the latest jpg from my Python motion detection routine which runs independently. | Execute shell command when receiving properly constructed email | 0 | 0 | 0 | 817 |
20,762,556 | 2013-12-24T14:26:00.000 | 1 | 0 | 1 | 0 | python,split | 20,762,787 | 4 | false | 0 | 0 | I think I found a tricky way for my question. I don't need to use any modules for that. I can use replace method of str library and replace words like ! or ? with . . Then I can use split method for my text to split word by . . | 1 | 1 | 0 | How can I write a program in python that can split more than one word or character?
For example I have these sentences: Hi, This is a test. Are you surprised? In this example i need my program to split these sentences by ',','!','?' and '.'. I know split in str library and NLTK but I need to know is there any internal pythonic way like split? | Split more than one word in python | 0.049958 | 0 | 0 | 174 |
20,763,775 | 2013-12-24T16:14:00.000 | 0 | 0 | 0 | 1 | python,windows,apache,wsgi | 20,779,815 | 1 | false | 1 | 0 | Accordning to the links in the comments above, restarts after source changes are always necessary on windows. On linux you still need to touch the wsgi file after source changes. Is it only me that finds this being a major drawback, compared to PHP? | 1 | 0 | 0 | I am evaluating python for web development (mod_wsgi) and have noticed that on windows I have to restart Apache after changing my python source code. On Ubuntu the problem doesn't exists, probably because linux supports wsgi daemon mode.
Are there any way to have hot deployment during web development on windows, like configuring apache, replacing web server, some IDE, etc? | Apache restart when developing python wsgi apps | 0 | 0 | 0 | 217 |
20,764,023 | 2013-12-24T16:33:00.000 | 4 | 0 | 1 | 0 | window,ipython-notebook | 20,764,676 | 1 | true | 0 | 0 | alias ipn='ipython notebook --pylab inline
But the dev team recommend not to start with --pylab it leads to bugs for newcommers that do not know what pylab really does :-(. It is better to use %matplotlib inline at beginning of notebooks ! (explicit is better than implicit)
As for opening in a new window, IPython rely on webbrowser.open in notebookapp.py line 711 on master. And the ability to choose new tab or new window is not configurable. (You can try to open an issue or a Pull request on github, but it might fall in the "to little use case to make it configurable")
Cannot you just 'detach' the current tab ? | 1 | 3 | 0 | so I've been talked into ipython notebook. I even set a shortcut (should be added to the beginners guides: alias ipn='ipython notebook --pylab inline &') but it opens a new tab in an open browsing session.
I'd like it to start the ipython in a NEW window. How do I do that?
Thanks guys! | ipython notebook in a new broswer window (and not a new tab in an existing window) | 1.2 | 0 | 0 | 1,761 |
20,764,462 | 2013-12-24T17:10:00.000 | 0 | 0 | 1 | 1 | python,c,debugging,gdb | 20,764,514 | 2 | false | 0 | 0 | ubiQ,
I've always used IDLE for debugging. Do a google search for it. Hope this helps, if not, let me know! | 1 | 1 | 0 | I'm looking to 'watch' a program as it executes. I want to, for example, keep track of a program's stack pointer as it changes through execution. I've been looking at scripting GDB with python but the solutions to this are very buggy - I've been unsuccessful thus far at installing PythonGDB. If anyone has any solutions / recommendations as to how to approach this problem I would be very grateful.
EDIT: I should have mentioned, I'm looking to record these values - ideally automatically - to be able to review them afterwards. I understand GDB allows me to step through the program and view the each state but I want to automate this process to be able to 'watch' how a particular values (such as the SP) change over time. | Following a program's execution | 0 | 0 | 0 | 73 |
20,766,813 | 2013-12-24T21:14:00.000 | 17 | 0 | 1 | 0 | python,integer,unsigned,signed | 20,766,849 | 6 | false | 0 | 0 | Python doesn't have builtin unsigned types. You can use mathematical operations to compute a new int representing the value you would get in C, but there is no "unsigned value" of a Python int. The Python int is an abstraction of an integer value, not a direct access to a fixed-byte-size integer. | 1 | 99 | 0 | Let's say I have this number i = -6884376.
How do I refer to it as to an unsigned variable?
Something like (unsigned long)i in C. | How to convert signed to unsigned integer in python | 1 | 0 | 0 | 253,575 |
20,773,538 | 2013-12-25T13:59:00.000 | 0 | 1 | 1 | 0 | python,security,hide | 20,775,488 | 2 | false | 0 | 0 | You should tell us what kind of protection you want. Do you want to make everybody able to execute you script without knowing the password? Do you want to be the only able to execute you script but you want to protect the password from people who can read the source? There may be different solution.
However every solution will require you to insert another password to get access to the stored password. So I think that the best solution would be not to save the password in the source at all. | 2 | 1 | 0 | I am writing a Python code and it is requisite to include a password of one of my online account. I want to cover it in some way as keeping its functionality in the code. Is there nay way to masquerade this kind of credential information as keeping its use in the source code? | How could I securely embed a required password into source code? | 0 | 0 | 0 | 329 |
20,773,538 | 2013-12-25T13:59:00.000 | 1 | 1 | 1 | 0 | python,security,hide | 20,775,416 | 2 | false | 0 | 0 | I would recommend two levels to secure passwords. 1 encrypt, 2, protect the key used for encrypting in key store.
Details- Encrypt the password using aes 256 or similar based on the risk. Key used for encrypting should be in key store and you can hard code the key store password.
You can also choose number of levels based on risk, usually at least two is recommended. | 2 | 1 | 0 | I am writing a Python code and it is requisite to include a password of one of my online account. I want to cover it in some way as keeping its functionality in the code. Is there nay way to masquerade this kind of credential information as keeping its use in the source code? | How could I securely embed a required password into source code? | 0.099668 | 0 | 0 | 329 |
20,774,949 | 2013-12-25T16:53:00.000 | 0 | 0 | 0 | 0 | python,sockets,networking,tcp,client-server | 20,775,026 | 3 | false | 0 | 0 | I believe what you are trying to achieve is a bit similar to jsonp. While sending to the client, send through a callback method which you know of, that is existing in client.
like if you are sending "some data xyz", send it like server.send("callback('some data xyz')");. This suggestion is for javascript because it executes the returned code as if it were called through that method., and I believe you can port this theory to python with some difficulty. But I am not sure, though. | 2 | 0 | 0 | As far as I understand the basics of the client-server model, generally only client may initiate requests; server responds to them. Now I've run into a system where the server sends asynchronous messages back to the client via the same persistent TCP connection whenever it wants. So, a couple of questions:
Is it a right thing to do at all? It seems to really overcomplicate implementation of a client.
Are there any nice patterns/methodologies I could use to implement a client for such a system in Python? Changing the server is not an option.
Obviously, the client has to watch both the local request queue (i.e. requests to be sent to the server), and the incoming messages from the server. Launching two threads (Rx and Tx) per connection does not feel right to me. Using select() is a major PITA here. Do I miss something? | Is it OK to send asynchronous notifications from server to client via the same TCP connection? | 0 | 0 | 1 | 530 |
20,774,949 | 2013-12-25T16:53:00.000 | 0 | 0 | 0 | 0 | python,sockets,networking,tcp,client-server | 20,775,573 | 3 | false | 0 | 0 | Yes this is very normal and Server can also send the messages to client after connection is made like in case of telnet server when you initiate a connection it sends you a message for the capability exchange and after that it asks you about your username & password.
You could very well use select() or if I were in your shoes I would have spawned a separate thread to receive the asynchronous messages from the server & would have left the main thread free to do further processing. | 2 | 0 | 0 | As far as I understand the basics of the client-server model, generally only client may initiate requests; server responds to them. Now I've run into a system where the server sends asynchronous messages back to the client via the same persistent TCP connection whenever it wants. So, a couple of questions:
Is it a right thing to do at all? It seems to really overcomplicate implementation of a client.
Are there any nice patterns/methodologies I could use to implement a client for such a system in Python? Changing the server is not an option.
Obviously, the client has to watch both the local request queue (i.e. requests to be sent to the server), and the incoming messages from the server. Launching two threads (Rx and Tx) per connection does not feel right to me. Using select() is a major PITA here. Do I miss something? | Is it OK to send asynchronous notifications from server to client via the same TCP connection? | 0 | 0 | 1 | 530 |
20,777,307 | 2013-12-25T22:33:00.000 | 0 | 0 | 0 | 1 | python,macos,sublimetext,read-eval-print-loop,sublimerepl | 65,398,436 | 4 | false | 0 | 0 | I would suggest to change the directory to
/Library/Frameworks/Python.framework/Versions/Current/bin/python3
This way whenever you update python, SublimeREPL will always get the updated version. | 1 | 5 | 0 | My question is the following, I have sublime 2 and sublime repl plugin installed all working fine, the only thing i need is to change the version of python that is running on the sublimerepl built in console. What I mean is, I have python 2.7.5 (which is pre installed with maveriks) running fine in sublime (via sublimerepl), and I have installed via the installer from python.org, python 3.3.3 , that I need to use, I want to run this version of python on the sublimerepl console but I don't know how.
I know that there are alternatives to sublime but none of those are so beautiful as sublime is.
Can someone help me with this ? I've searched for all over the internet and couldn't find anything helpful.
Btw if I use terminal python 3.3.3 is working fine (Terminal>'python3'), I know this is possible beacause a friend of mine got it working and I have installed mine like he did, but mine is not working. | How to run Python 3 in Sublime 2 REPL Mac | 0 | 0 | 0 | 6,952 |
20,778,806 | 2013-12-26T03:38:00.000 | 0 | 0 | 0 | 0 | python,numpy,ubuntu-12.04,scientific-computing,intel-mkl | 20,780,564 | 1 | false | 0 | 0 | As far as I know the only way is to compile NumPy again without MKL, preferably in a virtualenv.... | 1 | 4 | 1 | So, I compiled NumPy from source, linking to MKL. Now I want to compare NumPy's performance with and without MKL. Is there any way I can "tell" NumPy not to use MKL, so I can produce the benchmarks? For instance, with numExpr we can do numexpr.use_vml = False. Is there anything similar for NumPy? I really don't wanna have to compile NumPy without MKL just for this.
(Ubuntu 12.04, Python 2.7.3, NumPy 1.8, Intel Composer XE 2013 SP1) | compare NumPy vs. NumPy+MKL performance | 0 | 0 | 0 | 1,214 |
20,779,360 | 2013-12-26T04:58:00.000 | 1 | 1 | 0 | 0 | python,radius,freeradius | 20,792,780 | 1 | false | 0 | 0 | Not directly no. You can use sqlite if you want an easily modifiable local data store for clients definitions. | 1 | 0 | 0 | I wrote an auth module for FreeRADIUS with Python.
I want to manage a NAS with it.
Is there way except generating a client.conf file and restarting? | Can I define RADIUS clients with Python? | 0.197375 | 0 | 1 | 961 |
20,786,478 | 2013-12-26T14:27:00.000 | 47 | 0 | 1 | 1 | python,windows,python-2.7,python-3.x,cmd | 34,838,251 | 3 | false | 0 | 0 | I also met the case to use both python2 and python3 on my Windows machine. Here's how i resolved it:
download python2x and python3x, installed them.
add C:\Python35;C:\Python35\Scripts;C:\Python27;C:\Python27\Scripts to environment variable PATH.
Go to C:\Python35 to rename python.exe to python3.exe, also to C:\Python27, rename python.exe to python2.exe.
restart your command window.
type python2 scriptname.py, or python3 scriptname.py in command line to switch the version you like. | 1 | 32 | 0 | How can I configure windows command dialog to run different python versions in it? For example when I type python2 it runs python 2.7 and when I type python3 it runs python 3.3? I know how to configure environment variables for one version but two? I mean something like Linux terminal. | How to run different python versions in cmd | 1 | 0 | 0 | 170,536 |
20,789,687 | 2013-12-26T18:52:00.000 | 3 | 0 | 0 | 0 | python,django,model,django-forms | 20,789,744 | 1 | true | 1 | 0 | This behavior is by design. Django would rather have empty strings than NULLs, for various reasons. Google will tell you, but long story short, Django finds NULL and "" overlapping in meaning, and does away with the former.
What you can do, is intercept the value coming from the database driver and change empty strings to NULL and the other way round. Implementing a custom CharField subclass will get you there.
In doing so, you'll experience the ambiguity between NULL and "" for yourself :). | 1 | 0 | 0 | I've looked all around the documentation and internet, but I can't find an answer for this. I have a model with several fields that have (blank=True, null=True). When I save the ModelForm, the columns get set as empty strings in the database. I would like it to save them as NULL in the database (if they are empty).
How can I tell ModelForm to save empty values as NULL? | Django ModelForm not saving NULL values | 1.2 | 0 | 0 | 277 |
20,793,740 | 2013-12-27T02:01:00.000 | 1 | 0 | 1 | 0 | python,error-handling | 28,821,129 | 2 | false | 0 | 0 | Compile errors will be shown when you first try to compile the RPY files. They will be put in "errors.txt" in your project directory. Most errors are not found at compile-time, however, and will only show up once you encounter them at run-time.
You can use Lint to check for some common errors (It's called "Check Script (Lint)"), but mostly you'll have to playtest to ensure there are no errors. Errors during playback should pop up a gray screen showing the error and traceback with the option to Ignore, Rollback, or Quit. Is this screen not showing up for you? | 2 | 2 | 0 | I'm making a game using Ren'py (based on python) and most errors aren't shown, especially the errors in python code. Is there a possibility to check for possible errors at compile time and how do I get where some errors occur? If there are errors the game normally doesn't run or breaks at the a errors appearance without a message.Is there maybe a file, where they are written in or something like that? Or do I have to debug using logs everywhere? | How do I handle errors in Ren'py | 0.099668 | 0 | 0 | 2,449 |
20,793,740 | 2013-12-27T02:01:00.000 | 0 | 0 | 1 | 0 | python,error-handling | 56,918,348 | 2 | false | 0 | 0 | If you're looking for some kind of intellisense like you have for some languages, where as you write the code the IDE shows errors, then it doesn't exist. You have to launch the game so that the code is compiled, just then Ren'py will show you errors. You can see them in the editor or in the errors.txt that Ren'Py creates. To test you python code you can launch the game and type Shift + O to open the console. | 2 | 2 | 0 | I'm making a game using Ren'py (based on python) and most errors aren't shown, especially the errors in python code. Is there a possibility to check for possible errors at compile time and how do I get where some errors occur? If there are errors the game normally doesn't run or breaks at the a errors appearance without a message.Is there maybe a file, where they are written in or something like that? Or do I have to debug using logs everywhere? | How do I handle errors in Ren'py | 0 | 0 | 0 | 2,449 |
20,794,033 | 2013-12-27T02:44:00.000 | 1 | 0 | 0 | 0 | python,tornado | 20,817,404 | 2 | true | 1 | 0 | Tornado doesn't know anything about html comments, so any html comments will be passed through as-is. (You can use {# #} to add comments to your templates). There is limited support for stripping whitespace, which is enabled by default based on file extension (.html and .js). There's also a half-implemented compress_whitespace setting, although there is no clean way to set it unless you implement your own template loader. | 1 | 0 | 0 | I am using tornado and the tornado templating engine. Even when debug is set to False, tornado-rendered pages still have HTML comments and unnecessary whitespace in them. Is there a setting to automatically strip this out when rendering pages (essentially minifying the rendered pages)? | Strip unnecessary whitespace and html comments from Tornado-rendered Pages | 1.2 | 0 | 0 | 662 |
20,795,990 | 2013-12-27T06:31:00.000 | 1 | 0 | 0 | 0 | python | 70,174,450 | 2 | false | 0 | 0 | Try color = '#FF000000' its the Hex code. | 1 | 0 | 1 | How do I plot a line of transparent colour or no colour ?
For example :
plot(x,y,color='transparent')
or
plot(x,y,color='None')
BTW , color='white' is not what I'm looking for .
Thanks in advance invisible computer people . | Python . Select transparent colour or no colour for lines / points etc | 0.099668 | 0 | 0 | 18,046 |
20,797,277 | 2013-12-27T08:19:00.000 | 1 | 0 | 1 | 0 | python | 20,797,309 | 6 | false | 0 | 0 | If the list returns is guaranteed not to be empty, then simply using if result will do it.
Using if lst is the standard way of checking if a list is non-empty, as empty lists evaluate to False in a boolean context. Because your function only ever returns non-empty lists or False, this will work.
This can become confusing however, and it would make much more sense returning an empty list rather than False (although this is depending on the context). | 1 | 0 | 0 | I have a function that return either a list or False, what is the most elegant way to test if the function returns a list in an if statement ( or else if it returns False ). I'm testing the "type" of the value returned but it feels clumsy , surely there is a better way to test if the function returns False ( or a list ) .
thank you | Testing if a function returns a list or a bool | 0.033321 | 0 | 0 | 95 |
20,798,818 | 2013-12-27T10:15:00.000 | 0 | 0 | 0 | 0 | python,mysql,connection-pooling,mysql-python,zope | 21,954,872 | 1 | false | 0 | 0 | I guess you've advanced with your problem, but this is not a reason not to comment.
1) Long-term answer: seriously consider building a path to migrating to ZODB instead of mysql. ZODB is integrated with Zope and is way more efficient than mysql for storing Zope data. You can't do it at once, but may be you can identify part of the data that can be migrated to ZODB first, and then do it by "clusters of data".
2) short-term answer: I don't know what library you're using to connect to mysql (there aren't many of them), let's say it's python-mysqldb, and the function to Connect to the database is Connect. You Can write your own MySqlDB module, and put it before the system MySqlDB in the sys.path (manipulating the sys.path of your zope application if necessary), so your module is called instead of the system MySqlDB one. In your module, you write a Connect function that encapsulates your pooling logic and proxy everything else to the original (system) MySqlDB module.
Hope I've been clear for you or everyone else having the same problem. | 1 | 1 | 0 | I'm started enhancing an application which has developed in Python. Zope server has been used to deploy the application.
In many modules DB connection has established and used for DB transaction, and which has not used any connection pooling mechanism. Considering the volume of users it is vulnerable to have DB connections established for every request and it is a bad design.
Now In order to have connection pooling, what should I do? My application
uses Python 2.4,Zope 2.11.4 and MySQL 5.5.
Is Zope provides any way to achieve it, like configure the DB in external file and inside the Python code referring the connection which Zope takes care of utilizing from connection pool? Or Do I need to write in a Python code in such a way that independent of the server(Zope or other) provided MySQL module for python | How to configure DB connection pooling in Python Zope server | 0 | 1 | 0 | 309 |
20,803,514 | 2013-12-27T15:47:00.000 | 1 | 0 | 1 | 1 | macos,ipython,ipython-notebook | 21,111,278 | 2 | false | 0 | 0 | thanks for the info but I have found out the problems a few weeks ago and have forgotten to post it here....
It is just that for Mac installation, it is pretty tricky and hence while installing, instead of typing in: easy_install ipython, users have to specify the python version.
Thus, I will need to type in easy_install ipython2.7
After which all is fine and working great! | 1 | 1 | 0 | I am wondering if anyone has installed ipython notebook on mac OSX?
Currently I am able to run it in the terminal note but as soon as I type in the notebook version, there are problems encountered in running it.
Below is the error I have gotten:
Traceback (most recent call last): File
"/Users/tayyangki/anaconda/bin/ipython", line 9, in
load_entry_point('ipython==2.0.0-dev', 'console_scripts', 'ipython')() File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/init.py",
line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 565, in launch_instance
app.initialize(argv) File "", line 2, in initialize File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/terminal/ipapp.py",
line 314, in initialize
super(TerminalIPythonApp, self).initialize(argv) File "", line 2, in initialize File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/core/application.py",
line 371, in initialize
self.parse_command_line(argv) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/terminal/ipapp.py",
line 309, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv) File "", line 2, in parse_command_line File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 474, in parse_command_line
return self.initialize_subcommand(subc, subargv) File "", line 2, in initialize_subcommand File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 92, in catch_config_error
return method(app, *args, **kwargs) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/config/application.py",
line 405, in initialize_subcommand
subapp = import_item(subapp) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/utils/importstring.py",
line 42, in import_item
module = import(package, fromlist=[obj]) File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/html/notebookapp.py",
line 75, in
from IPython.consoleapp import IPythonConsoleApp File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/consoleapp.py",
line 43, in
from IPython.kernel.zmq.kernelapp import ( File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/kernel/zmq/kernelapp.py",
line 54, in
from .ipkernel import Kernel File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/kernel/zmq/ipkernel.py", line 40, in
from .zmqshell import ZMQInteractiveShell File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/kernel/zmq/zmqshell.py", line 36, in
from IPython.core.payloadpage import install_payload_page File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/core/payloadpage.py",
line 24, in
from docutils.core import publish_string File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/core.py",
line 20, in
from docutils import frontend, io, utils, readers, writers File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/frontend.py",
line 41, in
import docutils.utils File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/utils/init.py",
line 20, in
import docutils.io File "/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/io.py",
line 18, in
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput File
"/Users/tayyangki/anaconda/lib/python2.7/site-packages/docutils/utils/error_reporting.py",
line 47, in
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1] File
"/Users/tayyangki/anaconda/lib/python2.7/locale.py", line 511, in
getdefaultlocale
return _parse_localename(localename) File "/Users/tayyangki/anaconda/lib/python2.7/locale.py", line 443, in
_parse_localename
raise ValueError, 'unknown locale: %s' % localename ValueError: unknown locale: UTF-8
Greatly appreciated if someone could help me? | ipython notebook installation on mac os x | 0.099668 | 0 | 0 | 3,347 |
20,808,909 | 2013-12-27T22:52:00.000 | 0 | 1 | 0 | 1 | python,apache,mod-wsgi | 20,809,616 | 1 | false | 0 | 0 | There are two options. Use mod_wsgi daemon mode and run the daemon process as a distinct user. Then lock down all your file permissions appropriately to deny access from that user. The second is that mod_wsgi daemon mode also supports a chroot option. Using a chroot is obviously a lot more complicated to set up however. | 1 | 0 | 0 | Lets say I have directory with subdirectories where are projects stored.
How to lock Python script inside that subdirectory ? That it can not scan parent directories, read files, import etc. Is it possible with mod_wsgi ?
And how to disable any python functions ?
Thank | Apache: python directory restriction | 0 | 0 | 0 | 50 |
20,809,396 | 2013-12-27T23:48:00.000 | 0 | 0 | 1 | 0 | python,file,memory,file-read | 20,809,521 | 6 | false | 0 | 0 | Unless you have an index built or fixed length records, you'll probably need to read the file, one line at a time, throwing out early values until you get the one you want. | 1 | 2 | 0 | I'm trying to read through a very large text file (> 1.5gb) line by line but would like to avoid loading the whole file into memory, is there a way to just read a specific line at once without loading everything first? | Read specific line of file in Python without filling memory | 0 | 0 | 0 | 2,160 |
20,813,532 | 2013-12-28T10:34:00.000 | 0 | 0 | 0 | 1 | python-2.7,hadoop,hadoop-streaming | 20,821,705 | 1 | true | 0 | 0 | MapReduce isn't really meant to handle that small of an input dataset. The MapReduce framework has to determine which nodes will run tasks and then spin up a JVM to run each individual Map and Reduce task(s) (the number of tasks is dependent on the size of your data set). That usually has a latency on the order of tens of seconds. Shipping non local data between nodes is also expensive as it involves sending data over the wire. For such a small dataset, the overhead of setting up a MapReduce job in a distributed cluster is likely higher than the runtime of the job itself. On a single node you only see the overhead of starting up tasks on a local machine and don't have to do any data copying over the network, that's why the job finishes faster on a single machine. If you had multi gigabyte files, you would see better performance on several machines. | 1 | 0 | 0 | I am running three MapReduce jobs in sequence (output of one is the input to another) on a Hadoop cluster with 3 nodes (1 master and 2 slaves).
Apparently, the total time taken by individual jobs to finish on a single node cluster is less than the above by quite a margin.
What could be the possible reasons? Is it the network latency? It's running on 100Mbps Ethernet network. Will it help if I increase the number of nodes?
I am using Hadoop Streaming and my code is in python2.7. | Hadoop : single node vs cluster performance | 1.2 | 0 | 0 | 1,247 |
20,815,873 | 2013-12-28T14:52:00.000 | 0 | 0 | 1 | 0 | python,regex,python-3.x | 20,815,915 | 5 | false | 0 | 0 | I think you need to do this in two steps: first, find the dots inside the double quotes, and "protect" them (for example, replace them with a string like $%$%$%$ that is unlikely to appear in a Chinese text.). Next, explode the strings as before. Finally, replace the $%$%$%$ with a dot again. | 1 | 0 | 0 | I am writing a program about getting the abstract of Chinese article. Firstly I have to explode each sentence with symbols like “。!?”.
In Chinese article, when referring other's word, they would use double quotation marks to mark the referred words, which may contain "。" but should not be exploded. For example, the following sentence:
他说:“今天天气很好。我很开心。”
It will be exploded into three sentences:
他说:“今天天气很好
我很开心
”
The result is wrong, but how to solved it?
I have tried use regular expression, but I am not good at it, so could figure it out.
PS: I write this program with python3 | How to explode sentences with "。" but ignore the "。" in the double quotation marks | 0 | 0 | 0 | 202 |
20,816,257 | 2013-12-28T15:38:00.000 | 0 | 0 | 1 | 1 | python,macos,automation | 20,816,671 | 2 | false | 0 | 0 | Set a variable to the future time, and check it in a while() loop | 1 | 0 | 0 | I have the following set-up
A Python script
A Mac OSX Automator application with said script
An iCal alert that runs the Automator (and thus the Python script) on a regular schedule
All of the above works just fine. But I need to make a change. I need the script to check a web site for a time in the future (that same day) and then come back prior to that time and run itself again. I know how to do the first part (get the time) but I have no clue how to do the second part. How do you get a Python script to (1) run itself at a regular time and then (2) run again at some point in the future? The point in the future will change on a regular basis. Sometimes it would be as early as 10AM, other times it may be 7PM.
Any thoughts on this and pseudo-code are welcome. Thanks! | Architecture for a self-running Python script on Mac OSX | 0 | 0 | 0 | 217 |
20,816,984 | 2013-12-28T16:53:00.000 | 6 | 0 | 1 | 0 | python,virtualenv,virtualenvwrapper | 20,817,628 | 4 | false | 0 | 0 | Generally this is considered good practice. However, keep in mind that this can result in disk consumption fairly quickly if you have multiple large projects. Moreover, sometimes virtualenv may not be appropriate if you have low level system integration in your project.
If you are sharing your projects, it is good to release a requirements file for pip so people can replicate your project. Virtualenv makes this easy. One alternative to not creating unique virtualenvs for projects is to specify a requirements file and then test by creating a virtualenv and loading the requirements file and seeing if the project runs. | 2 | 13 | 0 | After googling around regarding virtualenv, I was under the impression that virtual environments should be created for every project I create (that are related and use the same site packages).
Is this true and why or why not?
Also, if I am currently using a virtualenv for one of my projects, how would I go about upgrading when upgrades for the packages come along? | Should I be creating a virtual environment for each project? | 1 | 0 | 0 | 7,906 |
20,816,984 | 2013-12-28T16:53:00.000 | -4 | 0 | 1 | 0 | python,virtualenv,virtualenvwrapper | 20,817,834 | 4 | false | 0 | 0 | Q : I was under the impression that virtual environments should be created for every project I create (that are related and use the same site packages).
Answer:
No. You keep a single virtualenv for a set of projects that share same characteristics.
Q : Also, if I am currently using a virtualenv for one of my projects, how would I go about upgrading when upgrades for the packages come along?
Answer:
In my view, it is difficult. You have to remember which version each virtualenv is, and how many virtualenv s you created, what characteristics each projects have, Do they break if you upgrade, Do other dependent modules break if you upload one library in them..., that itself is a pain
What I do..
I never go for virtualenv. | 2 | 13 | 0 | After googling around regarding virtualenv, I was under the impression that virtual environments should be created for every project I create (that are related and use the same site packages).
Is this true and why or why not?
Also, if I am currently using a virtualenv for one of my projects, how would I go about upgrading when upgrades for the packages come along? | Should I be creating a virtual environment for each project? | -1 | 0 | 0 | 7,906 |
20,817,133 | 2013-12-28T17:07:00.000 | 1 | 0 | 1 | 0 | python,django,pycharm | 63,396,738 | 2 | false | 0 | 0 | Another way is to navigate to the first line using goto line: Ctrl-G and then 1. But this will move the cursor to the first line.
A small disadvantage is it is a two step process and adds a navigation step. Moving back to your previous location with CtrlAlt-< will have to be done in two steps if you do an edit. | 2 | 23 | 0 | I'm new to PyCharm and haven't been able to figure out what I'm sure is a very simple thing -- what's the key stroke to go to the top of the current file?
(Bonus question -- is there a way to scroll to the top of the current file without moving the cursor there also, a la the Home key in Sublime Text 2?) | In PyCharm, how to navigate to the top of the file? | 0.099668 | 0 | 0 | 8,443 |
20,817,133 | 2013-12-28T17:07:00.000 | 19 | 0 | 1 | 0 | python,django,pycharm | 20,817,174 | 2 | true | 0 | 0 | You navigate to the top of the file using Ctrl+Home. It moves cursor too. So does navigating via Page Up and Page Down keys.
Ctrl+Up and Ctrl+Down move the view without moving cursor but scrolling the long file takes some time.
Additionally You can change the keymap (Settings > Keymap). There is 'Scroll to Top' in 'Editor Actions'. You can use Your own key binding for this action, by default (in PyCharm 4 and later) it is not set. | 2 | 23 | 0 | I'm new to PyCharm and haven't been able to figure out what I'm sure is a very simple thing -- what's the key stroke to go to the top of the current file?
(Bonus question -- is there a way to scroll to the top of the current file without moving the cursor there also, a la the Home key in Sublime Text 2?) | In PyCharm, how to navigate to the top of the file? | 1.2 | 0 | 0 | 8,443 |
20,818,230 | 2013-12-28T19:02:00.000 | 2 | 0 | 1 | 0 | java,python,image,matlab,image-processing | 33,393,680 | 3 | false | 0 | 0 | Spatial = Space
Example, Image consist of pixel values which needs memory space to store. Spatial information = Pixel values stored into Memory
Temporal = Time
Example, Video consists of image frame sequence. With respect to time the frames are changed in video. This is called Temporal Information. | 2 | 13 | 1 | I am a beginner in learning image processing and I am a bit confused with the concept of spatial and temporal characterization. So, for Spatial characterization, is it like a 2D map which contains some statistical information about the map? And in terms of the temporal characterization, is the value with respect to time? What does it mean and why do we care? Thanks! | what's the difference between spatial and temporal characterization in terms of image processing? | 0.132549 | 0 | 0 | 72,641 |
20,818,230 | 2013-12-28T19:02:00.000 | 0 | 0 | 1 | 0 | java,python,image,matlab,image-processing | 70,253,700 | 3 | false | 0 | 0 | Example of Spatial analysis application: Inspecting an image e.g. pose estimation on an image.
Example of Temporal analysis application: Inspecting a video e.g. vehicle monitoring or pedestrian path prediction | 2 | 13 | 1 | I am a beginner in learning image processing and I am a bit confused with the concept of spatial and temporal characterization. So, for Spatial characterization, is it like a 2D map which contains some statistical information about the map? And in terms of the temporal characterization, is the value with respect to time? What does it mean and why do we care? Thanks! | what's the difference between spatial and temporal characterization in terms of image processing? | 0 | 0 | 0 | 72,641 |
20,825,590 | 2013-12-29T13:25:00.000 | 1 | 0 | 1 | 1 | python,linux,shell | 20,825,952 | 1 | true | 0 | 0 | You won't have any problem with what you're trying to do. You can call the same script in parallel a lot of times, with different input arguments. (sys.argv entries). For each run, a new memory space will be allocated. | 1 | 0 | 0 | I have a question about the Python Interpreter. How does is treat the same script running 100 times, for example with different sys.argv entries? Does it create a different memory space for each script or something different?
System is Linux , CentOS 6.5. Is there any operational limit that can be observed and tuned? | Call a Python Script from parallel shell scripts at the same time | 1.2 | 0 | 0 | 88 |
20,826,619 | 2013-12-29T15:17:00.000 | 1 | 0 | 1 | 1 | python,eclipse,pydev | 20,826,849 | 2 | false | 0 | 0 | I bet it's the problem of 3.x version of PyDev. It demands java 7.
2 solutions are possible:
Install java 7. re-run the Eclipse, Pydev should function well now. OR
Install last 2.x version of PyDev.
To do it
1) Remove PyDev : In Eclipse About window click Installation Details
button below. You will see controls for removing plug-ins.
2) Install 2.x version of PyDev:
Eclipse Help->Install New Software.
REMOVE CHECKBOX "Show only the latest version" located at the bottom of the dialog.
Choose Pydev update site from the list and in the appeared list of PyDev versions choose latest in 2.x branch. | 1 | 0 | 0 | This isn't my first time using Eclipse or installing PyDev but this is the first time it both succeeded and failed.
It succeeded because it installed, it shows up as being installed and installation went on fine without a problem.
It failed because nothing has shown up, there is no Python perspective, no PyDev views in the view list, no new projects under PyDev, no PyDev preferences. It is as if it is not actually installed at all.
The only thing I did differently is extract the latest eclipse to a folder called ~/eclipse and create a short cut to run it there (the latest Eclipse), usually I use apt-get to install eclipse, realise it's an old version (C++11 stuff missing) then upgrade and do this. Somehow PyDev is usually carried forward.
I'm not sure how it can list it as being installed but have this error, I'd appreciate any help you guys can offer. | Eclipse - Installed PyDev and nothing changed | 0.099668 | 0 | 0 | 762 |
20,827,199 | 2013-12-29T16:15:00.000 | 1 | 0 | 1 | 0 | python,pygame,paint,undo,redo | 20,828,238 | 2 | false | 0 | 1 | My suggestion is to have a buffer of the last operations that have been done. Each operation will consist of a sprite, and a position of where it is placed.
You will be drawing the canvas, as well as all sprites from that buffer. When you have to many sprites in the buffer, you can blit the oldest onto the canvas, thus saving memory.
The undo itself would be rather easy. Just remove the last sprite that was added.
A redo would be slightly more difficult. Since instead of removing, I would have a pointer, that points to the last sprite that I will draw. If a new action will be added, only then I remove all the sprites that have been "invisible". | 1 | 1 | 0 | I am currently working on creating a paint program using python and pygame. I am currently having trouble with creating the undo/redo function in the program. The way I was thinking of doing so would be to save the canvas image after each time the user releases the mouse, but I am not sure if the individual images would have to be saved in a temporary folder that is deleted after the program is closed. I have also read that this method can affect performance of the program so I am wondering if there are any other methods that will work more efficiently. Thank you. | Paint Program in Python - Undo and Redo | 0.099668 | 0 | 0 | 982 |
20,829,163 | 2013-12-29T19:23:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,google-cloud-storage | 20,847,501 | 1 | true | 1 | 0 | Stupid question now that i found the solution.
It was because i was running old_dev_appserver.py in my server startup script.
GCS is only supported from the 1.8.1 and greater. | 1 | 0 | 0 | I'm trying to work with gae-boilerplate on google app engine and I want to
communicate with the cloud on local development server (for now).
I took the test app example and it runs perfectly but when trying to integrate with
gae-boilerplate it falls apart.
If I extend my class with webapp2.request it will work but I can't call it from routes.py,
when I extend it with boilerplate BaseHandler, I can call it but ` get a deadlineexceeded exception:
TimeoutError: ('Request to Google Cloud Storage timed out.', DeadlineExceededError('Deadline exceeded while waiting for HTTP response from URL: http:// localhost: 8080/_ah/gcs/yey-cloud-storage-trial/demo-testfile',)) | gae-boilerplate and gcs client | 1.2 | 0 | 0 | 156 |
20,830,698 | 2013-12-29T22:16:00.000 | 3 | 0 | 1 | 1 | python,pip,pypi | 20,890,406 | 1 | true | 0 | 0 | pip does not support installing packages distributed as '"dumb" binaries'. Only source distributions, eggs and wheels are supported.
There are various other drawbacks to using dumb binaries, not least in that the Python version for which they were compiled is not listed, and they contain the full path to the files making these distributions next to useless to most end-users. Such binaries should really only be used in internal distributions where the target machines have the exact dependencies already present. They don't really have any place on PyPI.
Use setuptools and distribute eggs for Windows, only. For all other platforms, distribute just the source. If you are planning on providing a wheel distributions too, do so in addition to the source distribution.
Eggs with compiled C extensions have some drawbacks (specifically when having to support Unicode strings; Python has both wide and narrow Unicode builds and eggs don't record what version they were compiled for), so sticking to source distributions for most platforms is best. | 1 | 2 | 0 | I have a package that I have registered on Pypi. However when I do sudo pip install mypackage from ubuntu it gives me the windows package rather than the linux one. How do you configure your package to give the right version for the right OS? | How to get pypi to recognise the OS correctly | 1.2 | 0 | 0 | 157 |
20,831,821 | 2013-12-30T00:43:00.000 | 0 | 0 | 0 | 0 | python,captcha,bots,google-finance | 20,929,338 | 2 | true | 1 | 0 | Yahoo YQL works fairly well, but throws numerous HTTP 500 errors that need to be handled, they are all benign. TradeKing is an option, however, the oauth2 package is required and that is very difficult to install properly | 1 | 0 | 0 | So I have run into the issue of getting data from Google Finance. They have an html access system that you can use to access webpages that give stock data in simple text format (ideal for minimizing parsing). However, if you access this service too frequently, Google locks you out and you need to enter a captcha. I currently have a list of about 50 stocks and I want to update my price data every 15 seconds, but I soon get locked out (after about 3-4 minutes).
Does anyone have any solutions to this/understand the nature of how often is the max I could ping Google for this information?
Not sure why a feature like this would be on a service designed to give data like this... but similar alternative services with realtime data would also be accepted. | Google Finance Lock Out - Robot | 1.2 | 0 | 1 | 447 |
20,832,826 | 2013-12-30T03:17:00.000 | 8 | 0 | 1 | 0 | python,python-3.x,sublimetext | 33,468,290 | 3 | false | 0 | 0 | Click on tools > build systems > select Python, then Build with using ctr+shif B and select python, and it ll work. Second time you can use the build command, ctr + B since python is now set as default | 1 | 7 | 0 | New to Python & Sublime
Problem:
I type 'print ("Hello world")
How do I get it to show me the output (Hello world), is it in a separate window? or...
I understand I can use the Python Console built in, but that's a command line, what about when I get to use a ton of code, how do I get the output? | Display Python Output in Sublime text | 1 | 0 | 0 | 29,017 |
20,833,826 | 2013-12-30T05:27:00.000 | 0 | 0 | 1 | 0 | python,python-2.7 | 47,946,736 | 2 | false | 0 | 1 | You need to activate the appropriate virtual environment and then use the command pip install PyQt4or pip install PyQt5. Since you are using virtualenvwrapper, the virtual environment is activated automatically. Otherwise, use workon virtualenv_name to activate the environment.Do tell if the problem still persists. | 1 | 0 | 0 | I'm trying to maintain 2 python projects. one of them is using PyQt4 and another one is using PyQt5. So I created 2 virtualenv as follow.
1) installed virtualenv and virtualenvwrapper by sudo
2) logout from root(sudo)
3) created virtualenv at /home/thura/workspace/python/virtualenv
4) mkvirtualenv gui_pyqt4 under
/home/thura/workspace/python/virtualenv
5) mkvirtualenv gui_pyqt5 under
/home/thura/workspace/python/virtualenv
And I want to install the lib/module/etc of PyQt4 into gui_pyqt4 and install the lib/module/etc of PyQt5 into gui_pyqt5. I tried to install "pip install python-qt4" and "pip install python-qt5" but not working.
How can I install different module into different environment.? | How to install PyQt4 and PyQt5 at different virtualenv? | 0 | 0 | 0 | 1,320 |
20,834,740 | 2013-12-30T06:52:00.000 | 1 | 0 | 0 | 0 | python,sqlite,sqlalchemy | 20,835,718 | 2 | false | 0 | 0 | Sounds like the python binary you are using wasn't compiled with the sqlite module. If you are compiling from source, make sure you have the sqlite headers available. | 1 | 0 | 0 | I am trying to import sqlalchemy.databases.sqlite.DateTimeMixIn. I get ImportError: No module named sqlite. SQLAlchemy 0.8.4 is installed. If I do import sqlite I get the same error. | Importing SQLAlchemy DateTimeMixin raises ImportErrror | 0.099668 | 1 | 0 | 79 |
20,839,182 | 2013-12-30T12:04:00.000 | 39 | 0 | 1 | 0 | python,pycharm | 23,500,783 | 12 | false | 0 | 0 | If you want to remove the project from the recent projects list, just highlight the project with your mouse and hit the del key. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 1 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 87 | 0 | 1 | 0 | python,pycharm | 21,887,362 | 12 | true | 0 | 0 | Just follow these steps in order. They assume you currently have the project open in a PyCharm window:
Close your project by clicking on File -> Close Project
Locate your project in the PyCharm file directory
Delete your project's directory
I agree that PyCharm's handling of what should be a very simple procedure is crappy. Maybe this will be improved in the future? | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 1.2 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 6 | 0 | 1 | 0 | python,pycharm | 50,676,466 | 12 | false | 0 | 0 | click the project you want to remove.
menu bar Edit-> Remove from Project View. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 1 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 67,867,930 | 12 | false | 0 | 0 | In 2021 maybe another way to do it. My problem was in project with user directory (root was /Users) that contains too many not Python files, and it triggers some problems with Git and file index.
What I did:
show hidden files (Cmd + Shift + .),
find .idea directories,
delete all .idea directories.
open PyCharm and add project from correct directory.
That's it. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 0.016665 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 47,864,018 | 12 | false | 0 | 0 | I had the same issue. My solution was:
Close project.
Rename the folder you want to dissapear
Open pycharm project. A dialog will be shown asking if you want Pycharm remove the folder. Answer: yes.
That is enough. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 0 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 4 | 0 | 1 | 0 | python,pycharm | 44,430,173 | 12 | false | 0 | 0 | Version 2017.2.1
Press Alt+1 to bring the project pane, and make sure you're in
Project view (not Project Files view).
Select the desired project, and choose "Delete from project
view" from the context menu (right click). You can also use Delete
key. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 0.066568 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 43,861,035 | 12 | false | 0 | 0 | In version 2017.2.1
File → Close Project
You will be taken to the start-up window, where you can see the projects you've created on the left. You can then delete a project by clicking the cross sign ('x') following the project name. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 0 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 1 | 0 | 1 | 0 | python,pycharm | 34,987,731 | 12 | false | 0 | 0 | Highlight the project with your mouse and hit the del key, which works for me. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 0.016665 | 0 | 0 | 108,420 |
20,839,182 | 2013-12-30T12:04:00.000 | 2 | 0 | 1 | 0 | python,pycharm | 51,585,059 | 12 | false | 0 | 0 | In PyCharm 2018 I finally had to resort to deleting .idea folder and the project went away. | 9 | 78 | 0 | If I'm closing a project and then just delete the project folder, after PyCharm restarts an empty project folder is created again. | How to remove project in PyCharm? | 0.033321 | 0 | 0 | 108,420 |
20,839,246 | 2013-12-30T12:07:00.000 | 0 | 0 | 0 | 0 | python,pygame,sprite | 20,843,239 | 1 | false | 0 | 1 | Can't you just stop drawing the pig? Each frame you fill the screen with the background, so it won't be visible. | 1 | 0 | 0 | I have two objects troll and pig. I'm detecting collisions between these two characters with Pygame's colliderect function. collisions for this works perfectly, however I am unable to remove the object from the screen when a collision occurs. When a troll collideswith a pig, I want the pig to disappear from the screen. I set an image for both of these and bit them, is there a way to un-blit? Ive tried pygame.image.set_alpha(255) (which set full transparency of an image) function to no avail.
Any suggestions? | remove object after collision | 0 | 0 | 0 | 489 |
20,839,944 | 2013-12-30T12:50:00.000 | 0 | 0 | 0 | 0 | c++,python,sockets | 20,840,334 | 4 | false | 0 | 1 | I would go for named pipes, would be readily available in your circumstance because it is just similar to reading and writing to file, but it also has features similar to sockets i.e. you can make them communicate on a network (different hosts) | 1 | 4 | 0 | I'm looking for some advice mainly here.
I'm working on an application, where the main processing (stored on a server) is carried out in C++ and the GUI (front-end) is carried out in Python. These two programs will communicate with each other. The Python will send across the files needed for the C++ program to work, and give the C++ program some data to work with.. The back-end will then communicate back with the processed data.
Would therefore it be better to use Sockets? I thought about completing this using text files, but, have gone off this idea, instead will just save the data as a .txt file so it can be opened up in future instances. Also, if I was to use sockets, would there be any conflict in using Python/C++?
Any help or advice would be greatly appreciated. | Sending/Receiving data between two different programs | 0 | 0 | 0 | 3,600 |
20,840,803 | 2013-12-30T13:45:00.000 | -2 | 0 | 1 | 0 | python,string,integer | 60,319,095 | 9 | false | 0 | 0 | only with this:
const a = true;
const b = false;
console.log(+a);//1
console.log(+b);//0 | 4 | 161 | 0 | Is there a way to convert true of type unicode to 1 and false of type unicode to 0 (in Python)?
For example: x == 'true' and type(x) == unicode
I want x = 1
PS: I don’t want to use if-else. | How to convert 'false' to 0 and 'true' to 1? | -0.044415 | 0 | 0 | 324,682 |
20,840,803 | 2013-12-30T13:45:00.000 | 4 | 0 | 1 | 0 | python,string,integer | 64,686,481 | 9 | false | 0 | 0 | +(False) converts to 0 and
+(True) converts to 1 | 4 | 161 | 0 | Is there a way to convert true of type unicode to 1 and false of type unicode to 0 (in Python)?
For example: x == 'true' and type(x) == unicode
I want x = 1
PS: I don’t want to use if-else. | How to convert 'false' to 0 and 'true' to 1? | 0.088656 | 0 | 0 | 324,682 |
20,840,803 | 2013-12-30T13:45:00.000 | 0 | 0 | 1 | 0 | python,string,integer | 45,032,626 | 9 | false | 0 | 0 | bool to int:
x = (x == 'true') + 0
Now the x contains 1 if x == 'true' else 0.
Note: x == 'true' will return bool which then will be typecasted to int having value (1 if bool value is True else 0) when added with 0. | 4 | 161 | 0 | Is there a way to convert true of type unicode to 1 and false of type unicode to 0 (in Python)?
For example: x == 'true' and type(x) == unicode
I want x = 1
PS: I don’t want to use if-else. | How to convert 'false' to 0 and 'true' to 1? | 0 | 0 | 0 | 324,682 |
20,840,803 | 2013-12-30T13:45:00.000 | 13 | 0 | 1 | 0 | python,string,integer | 48,975,163 | 9 | false | 0 | 0 | You can use x.astype('uint8') where x is your Boolean array. | 4 | 161 | 0 | Is there a way to convert true of type unicode to 1 and false of type unicode to 0 (in Python)?
For example: x == 'true' and type(x) == unicode
I want x = 1
PS: I don’t want to use if-else. | How to convert 'false' to 0 and 'true' to 1? | 1 | 0 | 0 | 324,682 |
20,847,122 | 2013-12-30T20:36:00.000 | 1 | 0 | 0 | 0 | javascript,python | 31,151,979 | 4 | false | 1 | 0 | In my opinion, the best option for achieving real time data streaming to a frontend UI is to use a messaging service like pubnub. They have libraries for any language you are going to want to be using. Basically, your user interfaces subscribe to a data channel. Things which create data then publish to that channel, and all subscribers receive the publish very quickly. It is also extremely simple to implement. | 1 | 3 | 0 | I am using Flask and I want to show the user how many visits that he has on his website in realtime.
Currently, I think a way is to, create an infinite loop which has some delay after every iteration and which makes an ajax request getting the current number of visits.
I have also heard about node.js however I think that running another process might make the computer that its running on slower (i'm assuming) ?
How can I achieve the realtime updates on my site? Is there a way to do this with Flask?
Thank you in advance! | How to achieve realtime updates on my website (with Flask)? | 0.049958 | 0 | 0 | 5,285 |
20,847,499 | 2013-12-30T21:01:00.000 | 0 | 0 | 0 | 0 | python-2.7,segmentation-fault,nuitka | 25,286,959 | 1 | false | 0 | 0 | Did you try taking a look at the core file? That should give you an idea where the segmentation fault is happening. | 1 | 0 | 0 | I'm developing an embedded device controlled by a python2.7 script. And I need to compile the source for both security (I don't want device users to mess with my sources) and performance (I'm working on an BeagleBone Black, ARM microPC, and it's pretty short on CPU/RAM).
I'm using Nuitka python compiler for this. I've tried compiling separate modules of my application and it works fine, I can transparently replace random .py with it's compiled .so analogue and it all works fine.
Yet if I try to compile whole application into solid blob - it doesn't work. Meaning that Nuitka compiles whole application with no problem, but when I try to run the resulting binary - I get Segmentation fault and that's it. No debug output, no clues on what's wrong.
So, any idea what is wrong with this thing and why it doesn't work?
Or at least how can I debug it and figure out why this segfault happens? | python package compiled with nuitka fails with segmentation fault | 0 | 0 | 0 | 651 |
20,847,649 | 2013-12-30T21:11:00.000 | 0 | 0 | 0 | 1 | python,aptana,pydev | 21,073,033 | 3 | false | 1 | 0 | Aptana 3.5.0 and PyDev 3.0 does not work under Mac OS X 10.9 Mavericks yet. PyDev reports builtin symbols such as None could not be recognized.
I rolled back to 3.4.2 as well. | 2 | 0 | 0 | Aptana Studio is my primary Python IDE and I have been using it for years with much joy and success! Recently, when I start Aptana Studio it fails to recognize any PyDev projects that I have previously created. I noticed that this was happening after installing a recent update of the IDE. I tried uninstalling Aptana and resinstalling the latest version from the website. Nada...I updated Java thinking there might be a misalignment between Java versions or something like that. Nada...The latest version of Eclipse works fine and Aptana seems to be functioning correctly for everything except for PyDev (Python).
I am running a current version of Windows 8. Does anyone know how to fix this or maybe trouble shoot the problem? PyDev worked perfectly in Aptana Studio until I installed the update. Has anyone come across this and know how to fix it? | PyDev won't start in Aptana Studio3 | 0 | 0 | 0 | 666 |
20,847,649 | 2013-12-30T21:11:00.000 | 0 | 0 | 0 | 1 | python,aptana,pydev | 20,851,621 | 3 | false | 1 | 0 | I went back to the Aptana website and this time around it gave me Aptana Studio 3, build: 3.4.2.201308081805 which works fine. 3.5.0 does still not appear to work for Python development at the moment. | 2 | 0 | 0 | Aptana Studio is my primary Python IDE and I have been using it for years with much joy and success! Recently, when I start Aptana Studio it fails to recognize any PyDev projects that I have previously created. I noticed that this was happening after installing a recent update of the IDE. I tried uninstalling Aptana and resinstalling the latest version from the website. Nada...I updated Java thinking there might be a misalignment between Java versions or something like that. Nada...The latest version of Eclipse works fine and Aptana seems to be functioning correctly for everything except for PyDev (Python).
I am running a current version of Windows 8. Does anyone know how to fix this or maybe trouble shoot the problem? PyDev worked perfectly in Aptana Studio until I installed the update. Has anyone come across this and know how to fix it? | PyDev won't start in Aptana Studio3 | 0 | 0 | 0 | 666 |
20,849,706 | 2013-12-31T00:10:00.000 | 1 | 0 | 1 | 0 | python,function,project,structure | 20,850,514 | 2 | true | 0 | 0 | I generally find it easiest to put such code in a separate file, because for clarity you don't want more than one different copyright/licensing term to apply within a single file. So in Python this does indeed mean a separate module. Then the file can contain whatever attribution and other legal boilerplate you need.
As long as your file headers don't accidentally claim copyright on something to which you do not own the copyright, I don't think it's actually a legal problem to mix externally-licensed or public domain code into files you mostly own. I may be wrong, though, which is why I normally avoid giving myself reason to think about it. A comment saying "this is external code from the following source with the following license:" may well be clearer than dividing code into different files that naturally wouldn't be. So I do occasionally do that.
I don't see any definite need for a separate directory (or package) per separate external source. If that's already part of your project structure (that is, it already uses external libraries by incorporating their source) then I suppose you might as well continue the trend. | 2 | 0 | 0 | Recently, I have been working on a Python project with usual directory structure, and have received help from someone else who has given me a code snippet (a single function definition, about 30 lines long) which I would like to import into my code. What is the most proper directory/location in a Python project to store borrowed code of this size? Is it best to store the snippet into an entirely different module and import it from there? | Where to Store Borrowed Python Code? | 1.2 | 0 | 0 | 133 |
20,849,706 | 2013-12-31T00:10:00.000 | 1 | 0 | 1 | 0 | python,function,project,structure | 20,849,824 | 2 | false | 0 | 0 | I usually place scripts I copy off the internet in a folder/package called borrowed so I know all of the code here is stuff that I didn't write myself.
That is, if it's something more substantial than a one or two-liner demonstrating how something works. | 2 | 0 | 0 | Recently, I have been working on a Python project with usual directory structure, and have received help from someone else who has given me a code snippet (a single function definition, about 30 lines long) which I would like to import into my code. What is the most proper directory/location in a Python project to store borrowed code of this size? Is it best to store the snippet into an entirely different module and import it from there? | Where to Store Borrowed Python Code? | 0.099668 | 0 | 0 | 133 |
20,852,789 | 2013-12-31T06:18:00.000 | 4 | 0 | 1 | 0 | python | 20,852,864 | 3 | false | 0 | 0 | A dictionary of key value pairs: __builtins__.__dict__
Only the objects: __builtins__.__dict__.values()
These will give you a list of a dictionary you can iterate over to your hearts content!
EDIT: Not recommended, see below comment and that users answer | 1 | 1 | 0 | how can i get a list of all built-in objects in python recursively?
what i'm exactly searching for is a function like dir() which returns a list of objects instead of strings.
also, why does "dir(__builtins__.print)" fail in python's interactive mode with a syntax error?
thanks for your answers! | How can i get a list of all built-in objects in python recursively? | 0.26052 | 0 | 0 | 23,981 |
20,854,222 | 2013-12-31T08:24:00.000 | 2 | 0 | 0 | 0 | python,google-nativeclient | 20,912,809 | 1 | true | 1 | 0 | The interpreter is currently the only python example in naclports. However, it should be possible to link libpython into any nacl binary, and use it just as you would embed python in any other C/C++ application. A couple of caveats: you must initialize nacl_io before making any python calls, and as you should not make python calls on the main (PPAPI) thread.
In terms of interacting with the HTML page, as with all NaCl applications this must be done by sending messages back and forth between native and javascript code using PostMessage(). There is no way to directly access the HTML or JavaScript from native code. | 1 | 1 | 0 | There is a Python interpreter in naclports (to run as Google Chrome Native Client App).
Are there any examples for bundling the interpreter with a custom Python application and how to integrate this application with a HTML page? | Practical use of Python as Chrome Native Client | 1.2 | 0 | 1 | 779 |
20,855,659 | 2013-12-31T10:15:00.000 | 0 | 0 | 0 | 0 | python,cassandra | 20,928,821 | 1 | true | 0 | 0 | If you want to verify that an update happened as planned, execute a SELECT against the updated row. | 1 | 0 | 0 | Is there any way to check whether a row in a table has been modified or not in Cassandra.
I don't want to compare the date before and after updating row in table.
After Update operation I need to verify the query executed properly or not using python scripts. I am using Cassandra Driver for python. | Cassandra row update check in a table | 1.2 | 1 | 0 | 167 |
20,856,465 | 2013-12-31T11:14:00.000 | 0 | 0 | 0 | 0 | android,python-2.7,sqlite,apk,kivy | 20,856,571 | 2 | false | 1 | 1 | if you're using local sqlite then you have to embed the database file within the app as failure to do so it means there's no database, in case for updates database have version numbers where as it can not upgrade the database provided the version number is the same as the previous app updates | 2 | 4 | 0 | I want to publish an Android application that I have developed but have a minor concern.
The application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep their saved entries in their sqlite3 files.
So what is the best practice to send updates? Compile the apk files with the new updated code only and without the database files? Or is there any other suggestion?
PS: I am not working with Java and Eclipse, but with python for Android and the Kivy platform which is an amazing new way for developing Android applications. | Update apk file on Google Play | 0 | 1 | 0 | 487 |
20,856,465 | 2013-12-31T11:14:00.000 | 0 | 0 | 0 | 0 | android,python-2.7,sqlite,apk,kivy | 46,767,741 | 2 | false | 1 | 1 | I had the same issue when I started my app but since kivy has no solution for this I tried to create a directory outside my app directory in android with a simple os.mkdir('../##') and I put all the files there. Hope this helps! | 2 | 4 | 0 | I want to publish an Android application that I have developed but have a minor concern.
The application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep their saved entries in their sqlite3 files.
So what is the best practice to send updates? Compile the apk files with the new updated code only and without the database files? Or is there any other suggestion?
PS: I am not working with Java and Eclipse, but with python for Android and the Kivy platform which is an amazing new way for developing Android applications. | Update apk file on Google Play | 0 | 1 | 0 | 487 |
20,856,854 | 2013-12-31T11:44:00.000 | 0 | 1 | 0 | 0 | python,web2py | 54,032,848 | 2 | false | 1 | 0 | I was getting a very similar error ("name 'auth' is not defined"). Had to add from django.contrib import auth at the top of views.py and it worked. | 1 | 1 | 0 | I have a web2py application where I have written various modules which hold business logic and database related stuff. In one of the files I am trying to access auth.settings.table_user_name but it doesn't work and throws and error as global name 'auth' is not defined. If I write the same line in controller, it works. But I want it to be accessed in module file. Please suggest how do I do that. | auth is not available in module | 0 | 0 | 0 | 2,882 |
20,860,045 | 2013-12-31T16:10:00.000 | 0 | 0 | 0 | 0 | python,django | 20,860,360 | 2 | false | 1 | 0 | I think you're better of with pulling the data by using ajax from your dashboard, it will be a better UX when you have a lot of data to fetch. For that you can use one of the known 3rd party apps for creating REST API or change your existing views to deliver json response as well. | 1 | 1 | 0 | So im trying to use my django installation to create a dashboard a combination of all the data from the 4 other models and views. For our use of django we mainly use it for stats so it's generally just pulling numbers out onto the main index page. Right now I have my index template set up as a redirect_to_template and it goes straight to a template (since everything is still static). Im trying to figure out if im going to have to create another app and pull in all the data to a new view & model for this dashboard page, or if I should create sub-templates if that would work to pull the data.
Thanks again! | Django Multiple Views for index/dashboard template | 0 | 0 | 0 | 693 |
20,861,890 | 2013-12-31T18:41:00.000 | 0 | 0 | 0 | 0 | python,pygame | 20,862,261 | 1 | false | 0 | 1 | If it is at all possible for two instances of a Pygame program to share a common display, then try using pygame.display.get_surface() to get the display surface- this will return None if the display isn't already initialized.
Another issue you will have to overcome in your project is the fact that calling pygame.event.get() (or a similar method) in one program will hide it from the other, so you will have to share the pygame.event.Events between the two programs.
This would only work if you can get the two programs to share the same window though; if Pygame's written so that separate Python processes will have separate Pygame windows, then I doubt you'll be able to get around that without changing up the Pygame source. | 1 | 0 | 0 | I want to call a python/pygame program from inside another. I do this with the os.startfile(minigame1) command. But when the program launches it first runs a python command line window and then opens the minigame in a seperate window. How can I make both programs share the same pygame window? Thank you in advance | Two python/pygame programs to run in the same window | 0 | 0 | 0 | 296 |
20,862,898 | 2013-12-31T20:31:00.000 | -1 | 0 | 0 | 0 | python,django | 27,697,984 | 3 | false | 1 | 0 | In Windows where you can edit PATH, under this you have PATHEXT. At the end, add .PY so PowerShell will know that .py files are executable. | 2 | 1 | 0 | This happened to me on multiple machines already... typing django-admin.py startproject test yields the The term 'django-admin.py' is not recognized as the name of a cmdlet.... error, while trying to call on any other module or script in the python Scripts folder works...
Typing python [Scripts path]\django-admin.py startproject test works perfectly, so does copying django-admin.py to my working directory... it just won't call it straight up.
I've been googling for a while and it seems like this problem is always people not having Scripts added in their PATH. I did, however. Is there something else I am missing? Much appreciated. | In Powershell django-install.py not recognized. Already added Scripts directory to PATH | -0.066568 | 0 | 0 | 725 |
20,862,898 | 2013-12-31T20:31:00.000 | 0 | 0 | 0 | 0 | python,django | 23,613,376 | 3 | false | 1 | 0 | Seems to be related to django not being in your PATH variable properly. I'll play around with it more later, but in the mean time a quick fix is just to call it directly:
C:\Python27\Scripts\django-admin.py startproject YourProjectName
(this will be different with Python3 obviously).
Worked for me, and so I hope it helps. | 2 | 1 | 0 | This happened to me on multiple machines already... typing django-admin.py startproject test yields the The term 'django-admin.py' is not recognized as the name of a cmdlet.... error, while trying to call on any other module or script in the python Scripts folder works...
Typing python [Scripts path]\django-admin.py startproject test works perfectly, so does copying django-admin.py to my working directory... it just won't call it straight up.
I've been googling for a while and it seems like this problem is always people not having Scripts added in their PATH. I did, however. Is there something else I am missing? Much appreciated. | In Powershell django-install.py not recognized. Already added Scripts directory to PATH | 0 | 0 | 0 | 725 |
20,864,226 | 2013-12-31T23:30:00.000 | 3 | 0 | 1 | 0 | python,sublimetext2 | 20,864,273 | 1 | false | 0 | 0 | In the nav go View => Layout => Columns:2 (alt+shift+2) and open your file again in the other pane (i.e. click the other pane and use ctrl+p filename.py)
It appears you can also reopen the file using the command File -> New View into File which will open the current file in a new tab | 1 | 3 | 0 | Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? I can't find anything in the view options. | Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? | 0.53705 | 0 | 0 | 75 |
20,867,464 | 2014-01-01T10:01:00.000 | 1 | 0 | 1 | 1 | python,linux,bash | 20,867,582 | 2 | true | 0 | 0 | Yes, it will change for the next execution of the loop.
The shell re-reads and executes ./file.py for each iteration. | 1 | 1 | 0 | This is a very dumb question. I have a python script that I am running on multiple files using a for loop:
for i in *; do ./file.py -i $i -o $i"_out"; done
Now, during this operation if I alter the script, will it change for the next execution in the loop ? | Change a script post-execution in a for loop | 1.2 | 0 | 0 | 54 |
20,868,780 | 2014-01-01T12:46:00.000 | 2 | 0 | 1 | 0 | python,pycharm | 26,771,541 | 5 | false | 0 | 0 | I'm doing this on a Mac, but hopefully this will be helpful for Windows or Linux.
Go to Run > Edit Configurations
There will be a dialog box that opens.
Script: file you want to run (ending with .py)
Script Parameters: the command line arguments
Working Directory: directory where your project is. | 3 | 20 | 0 | While writing an application parsing command line arguments I would like to run it with various parameters.
I don't want to create a Run Configuration for every possible command line argument that I want my script to test with. Is there a way in PyCharm (and I guess with any JetBrains IDE) to make a Run Configuration that asks for the Script parameters when executed?
I am currently using PyCharm 3.1 (EAP). | PyCharm "Run configuration" asking for "script parameters" | 0.07983 | 0 | 0 | 23,561 |
20,868,780 | 2014-01-01T12:46:00.000 | 0 | 0 | 1 | 0 | python,pycharm | 52,803,459 | 5 | false | 0 | 0 | My simple answer is adding another wrapper as the cover in the source code which will run on the selection you made through code branch or external command or file, so choosing different branch is just a 'ddp' tap distance in vim(line change for parameter settings). You dont have to depend on pycharm updating by building your own code world:) | 3 | 20 | 0 | While writing an application parsing command line arguments I would like to run it with various parameters.
I don't want to create a Run Configuration for every possible command line argument that I want my script to test with. Is there a way in PyCharm (and I guess with any JetBrains IDE) to make a Run Configuration that asks for the Script parameters when executed?
I am currently using PyCharm 3.1 (EAP). | PyCharm "Run configuration" asking for "script parameters" | 0 | 0 | 0 | 23,561 |
20,868,780 | 2014-01-01T12:46:00.000 | 12 | 0 | 1 | 0 | python,pycharm | 21,081,281 | 5 | true | 0 | 0 | Currently the only possibility is to use the "Before launch | Show this page" option. | 3 | 20 | 0 | While writing an application parsing command line arguments I would like to run it with various parameters.
I don't want to create a Run Configuration for every possible command line argument that I want my script to test with. Is there a way in PyCharm (and I guess with any JetBrains IDE) to make a Run Configuration that asks for the Script parameters when executed?
I am currently using PyCharm 3.1 (EAP). | PyCharm "Run configuration" asking for "script parameters" | 1.2 | 0 | 0 | 23,561 |
20,870,798 | 2014-01-01T16:43:00.000 | 1 | 0 | 1 | 1 | python,subprocess | 20,870,883 | 2 | false | 0 | 0 | It will look in the directories in the PATH environment variable. But you can always specify an absolute or relative path, so if you know where your custom process is located, you can just give the full path to it. | 1 | 0 | 0 | For example, when I type:
child = Popen('cmd'), how does the interpreter know where to look for cmd? and if I want to use my custom process, where do I put it that it will get recognized? | Where does subprocess.Popen look for the argument process? (Python) | 0.099668 | 0 | 0 | 58 |
20,872,804 | 2014-01-01T20:16:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,http,rest,client-server | 20,874,529 | 1 | true | 1 | 0 | What you suggest is the right way. 1&2 is a single post. Then you post again to the server. | 1 | 0 | 0 | I have a need for my client(s) to send data to my app engine application that should go something like this:
Client --> Server (This is the data that I have)
Server --> Client (Based on what you've just given me, this is what I'm going to need)
Client --> Server (Here's the data that you need)
I don't have much experience working with REST interfaces, but it seems that GET and POST are not entirely appropriate here. I'm assuming that the client needs to establish some kind of persistent connection with the server so they can both have a proper "conversation". My understanding is that sockets are reserved for paid apps, and I'd like to keep this on the free tier. However, I'm not sure of how to go about this. Is it the Channel API I should be using? I'm a bit confused by the documentation.
The app engine app is Python, as is the client. The solution that I'm leaning towards right now is that the client does a POST to the server (here's what I have), and subsequently does a GET (tell me what you need) and lastly does a POST (here's the data you wanted). But it seems messy.
Can anyone point me in the right direction please?
EDIT:
I didn't realize that you could get the POST response with Pythons urllib using the 'read' function of the object returned by urlopen. That makes things a lot nicer, but if anyone has any other suggestions I'd be glad to hear them. | Establishing connection between client and Google App Engine server | 1.2 | 0 | 1 | 98 |
20,874,180 | 2014-01-01T23:00:00.000 | 0 | 0 | 0 | 0 | python,django,autocomplete,django-admin,django-autocomplete-light | 21,414,137 | 2 | true | 1 | 0 | The only way to do this is to have a separate model with only those possibilities and to make the field we want to limit into a foreign key field. | 1 | 0 | 0 | I have a field in a Django model, and I want there to be a small (~20) set of possibilities (which are strings) which can be autocompleted (preferably with django-autocomplete-light, which I am using already) in django-admin. Should I make this a foreign key field and create a model containing just these 20 possibilities? or is there a better way? | Autocomplete a specific set of possibilities in Django-admin | 1.2 | 0 | 0 | 125 |
20,877,808 | 2014-01-02T06:52:00.000 | 4 | 0 | 1 | 0 | python,django,introspection,traceback | 20,877,968 | 2 | true | 1 | 0 | The Zen of Python says: Explicit is better than implicit.
Why not call it like this: your.autodiscover(__file__), or even your.autodiscover(dirname(__file__)). That way, someone who reads your code doesn't have to look for the magic in your autodiscover function, or look it up in the documentation. | 1 | 3 | 0 | I'm designing something similar to Admin.Autodiscover() of Django.
The first hurdle that I'm facing is getting the path of the file from which admin.autodiscover() is called, so that I can traverse the apps/libraries in that folder and figure out which models should be kept in admin.
How do I do that? | How to get the path of the function call in Python? | 1.2 | 0 | 0 | 1,301 |
20,878,709 | 2014-01-02T08:01:00.000 | 2 | 0 | 0 | 0 | python,django,django-models | 21,235,393 | 1 | false | 1 | 0 | The original confusion is that Django tries to connect to its databases on startup. This is actually not true. Django does not connect to database, until some app tries to access the database.
Since my web application uses auth and site apps, it looks like it tries to connect on startup. But its not tied to startup, its tied to the fact that those app access the database "early".
If one defines second database backend (non-default), then Django will not try connecting to it unless application tries to query it.
So the solution was very trivial - originally I had one database that hosted both auth/site data and also "real" data that I've exposed to users. I wanted to make "real" database connection to be volatile. So I've defined separate psql backend for it and switched default backend to sqlite.
Now when trying to access "real" database through Query, I can easily wrap it with try/except and handle "Sorry, try again later" over to the user. | 1 | 1 | 0 | I have a Django app that has several database backends - all connected to different instances of Postgresql database. One of them is not guaranteed to be always online. It even can be offline when application starts up.
Can I somehow configure Django to use lazy connections? I would like to:
Try querying
return "sorry, try again later" if database is offline
or return the results if database is online
Is this possible? | Lazy psql connection with Django | 0.379949 | 1 | 0 | 380 |
20,878,718 | 2014-01-02T08:02:00.000 | 3 | 0 | 0 | 0 | python,linux,sockets,select | 20,883,107 | 1 | true | 0 | 0 | I suspect what's happening is that the first process is waking up, returning from select(), and calling accept() before the subsequent context switch to the other processes can occur.
I'm not sure what select() actually blocks on or how it wakes up. I suspect when it does wake up from it's waiting on, it re-checks the queue to see if data is still available. If not, it goes back to waiting.
I'll double-down on my hypothesis as well. The fact that 2 processes are waking up is indicative of the fact that you have a dual-core processor. If you had a quad-core, you might see up to 4 processes wake up simultaneously.
One simple way to prove this theory: Put a 2 second sleep() call just prior to calling accept(). I suspect you'll see all 10 processes waking up and logging an attempt to call accept.
If your goal is to have N processes (or threads) servicing incoming connections, your approach is probably still good. You could probably switch from doing a select() call on a non-blocking socket, to just using a blocking socket that calls accept() directly. When an incoming connection comes in, one of the processes will return from accept() with a valid client socket handle. The others will still remain blocked. | 1 | 1 | 0 | There are 10 processes sharing a socket in my application.
They all wait for it to become readable using select.
But I notice in the application log that only 2 of these 10 processes any time the socket become readable.
What could be the reason? | Why is only 2 of 10 selecting process notified when a socket become readable? | 1.2 | 0 | 1 | 92 |
20,880,422 | 2014-01-02T10:03:00.000 | 1 | 0 | 0 | 0 | python,openerp,crm | 20,882,835 | 4 | false | 1 | 0 | We have two values like client side and server side. In Server side coding done like float value have 0.0 etc. Read only field doesn't take value from the Client side because it's read only. In View, we see that 0.0 for float value because of server side coding. If you remove read only attribute, you can get value from the Client side and that value pass to the Server and store into the Database. Field with read only attribute, can't get value from the client side and store NULL into the Database.
Hope this will help you. | 3 | 1 | 0 | On CRM opportunity form view, i added readonly="1" for probability field. When i saved, whatever the value of my probability, it's stored with NULL value.
Is it a bug on OpenERP ? | ReadOnly field saved with NULL value | 0.049958 | 0 | 0 | 2,529 |
20,880,422 | 2014-01-02T10:03:00.000 | 1 | 0 | 0 | 0 | python,openerp,crm | 21,577,500 | 4 | false | 1 | 0 | In openerp Readonly field is use to just display the content but it will not store any data in database. So it is displaying Null value.
Readonly is just for informative purpose only. | 3 | 1 | 0 | On CRM opportunity form view, i added readonly="1" for probability field. When i saved, whatever the value of my probability, it's stored with NULL value.
Is it a bug on OpenERP ? | ReadOnly field saved with NULL value | 0.049958 | 0 | 0 | 2,529 |
20,880,422 | 2014-01-02T10:03:00.000 | 0 | 0 | 0 | 0 | python,openerp,crm | 35,739,858 | 4 | false | 1 | 0 | change your probability field to function field, and write a function (ex _get_probability). And keep the current probability calculating function as it is. Now default probability calculate function display the value and second function (_get_probability) will save the value. | 3 | 1 | 0 | On CRM opportunity form view, i added readonly="1" for probability field. When i saved, whatever the value of my probability, it's stored with NULL value.
Is it a bug on OpenERP ? | ReadOnly field saved with NULL value | 0 | 0 | 0 | 2,529 |
20,882,048 | 2014-01-02T11:35:00.000 | 1 | 0 | 0 | 1 | python,jenkins,nosetests | 20,882,158 | 1 | true | 1 | 0 | It's hard to help you when you don't provide more information. What's the error message you get? Check "Console Output" and add it to your question.
It sounds like you're using the build step "Execute shell". On windows you should use "Execute Windows batch command" instead. | 1 | 0 | 0 | I have installed Python 3.3 on Windows. When i run nosetests from the command prompt giving the absolute path to the python test scripts folder, it runs. However, when i configure build shell in Jenkins as 'nosetests path/to/tests --with-xunit', the build fails. I am trying to install build monitor to see reasons for build failure. The build shell has nosetests C:\seltests\RHIS_Tests\ --with-xunit . I did not set Postbuild to nosetests.xml since it rejects that entry.
Thanks.
Sorry i am adding console output here
Building in workspace C:\Program Files\Jenkins\jobs\P1\workspace
Updating svn://godwin:3691/SVNRepo at revision '2014-01-02T18:28:06.781 +0530'
U Allows SQL in text fields.html
At revision 3
[workspace] $ sh -xe C:\WINDOWS\TEMP\hudson796644116462335904.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory "C:\Program Files\Jenkins\jobs\P1\workspace"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:773)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.Launcher$ProcStarter.join(Launcher.java:360)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:94)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:63)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:566)
at hudson.model.Run.execute(Run.java:1678)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method) | How to configure Jenkins to run Nosetests as build action in Windows | 1.2 | 0 | 0 | 2,371 |
20,882,174 | 2014-01-02T11:42:00.000 | 0 | 0 | 0 | 1 | java,python,google-app-engine,google-cloud-datastore | 21,276,528 | 1 | false | 1 | 0 | --datastore_path=Location/datastore.db worked for me | 1 | 0 | 0 | How can I use my Java Datastore on Python version on Local, As Python environment has Inbuilt Interactive Console(for custom query), I want to use my application's Datastore which is currently running on GAE Java 1.8.2 to another version of GAE Python. | Using Java GAE Datastore on Python locally | 0 | 0 | 0 | 78 |
20,883,944 | 2014-01-02T13:20:00.000 | 0 | 0 | 0 | 0 | python,user-interface | 29,543,626 | 3 | false | 0 | 1 | I have used tk GUIs with Abaqus but I find they don't ingrate that well and end up causing all sorts of strange errors (eg ignoring text input, windows hanging etc). If you are used to tk its not that much of a leap with the FX & AFX routines. I didnt know about RSG though and just had a quick play, liking it. | 2 | 0 | 0 | I'm very new in the python world I know some about command line commands and gui commands.
I've already succeeded in writing a working python script for Abaqus and now I want to add some GUI in it instead of changing the parameters in the text file everytime.
I discovered GUI Toolkit but it seems to difficult, for two reasons: 1) it doesn't seem to be portable; 2) I don't really like the code written by someone else, especially because most of the times it adds things that I don't understand and gives me error that I can't fix, maybe because the GUI Toolkit interface is not complete.
Here's my question.
Can I use python tk GUI for abaqus? Is there anyone who has tried it and can share some simple codes.
Thanks for the help | Is it possible to use python GUI instead of Abaqus GUI Toolkit? | 0 | 0 | 0 | 3,171 |
20,883,944 | 2014-01-02T13:20:00.000 | 3 | 0 | 0 | 0 | python,user-interface | 24,072,899 | 3 | false | 0 | 1 | I am no expert in the topic, but I do have some experience with writing plug-ins for Abaqus.
You may want to look into using the RSG (Really Simple GUI) Dialogue Builder. It is under the plug-ins options on the Abaqus toolbar.
The RSG is a GUI for building GUIs based on Abaqus's customized version of the FOX Toolkit. It is limited compared to programming the GUI yourself, but has plenty of options for creating some useful plug-ins. I generally start writing a plug-in by using the RSG to develop the base layout of my GUI. If there are options that I wish to include in my GUI that are not included in the RSG, I just edit the python files generated by the RSG.
Responding to your original question about whether or not you can use tk in Abaqus; I have run scripts in Abaqus that calls for the tk file browser and it has worked successfully. I don't see why you wouldn't be able to register the plug-in using the FOX Toolkit and then call tk to open a GUI.
Hope this helps. I know this is an old question, but the responses were weak. Additionally, I know how hard it can be to find good help/information on Abaqus scripting. | 2 | 0 | 0 | I'm very new in the python world I know some about command line commands and gui commands.
I've already succeeded in writing a working python script for Abaqus and now I want to add some GUI in it instead of changing the parameters in the text file everytime.
I discovered GUI Toolkit but it seems to difficult, for two reasons: 1) it doesn't seem to be portable; 2) I don't really like the code written by someone else, especially because most of the times it adds things that I don't understand and gives me error that I can't fix, maybe because the GUI Toolkit interface is not complete.
Here's my question.
Can I use python tk GUI for abaqus? Is there anyone who has tried it and can share some simple codes.
Thanks for the help | Is it possible to use python GUI instead of Abaqus GUI Toolkit? | 0.197375 | 0 | 0 | 3,171 |
20,884,520 | 2014-01-02T13:53:00.000 | 3 | 1 | 0 | 1 | c++,python | 20,884,754 | 1 | false | 0 | 0 | Hate to be the one to post it, but a nasty solution is the system function - dare I speak its name. Call it with code that you want executed in the command prompt and it will run. If you want to start task manager like this, call it like this:
system("C:\\Windows\\System32\\taskmgr.exe");
Fair warning that nobody really likes to see system in live code. | 1 | 0 | 0 | I'm interested in writing a program in C++ to automate the instructions necessary to run a certain python script I've been experimenting with. I was hoping someone could tell me where to look to find information on sending instructions to the command line from a C++ application, as I don't know what to google to find info on that. | Writing a program to output instructions to Windows command line | 0.53705 | 0 | 0 | 724 |
20,891,900 | 2014-01-02T21:07:00.000 | 3 | 1 | 0 | 0 | python,linux,opencv,raspberry-pi,simplecv | 20,910,789 | 2 | true | 0 | 1 | Try the nopreview option
pkill uv4l
uv4l --driver raspicam --auto-video_nr --encoding yuv420 --width 320 --height 240 --nopreview
export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so
Hope that helps | 1 | 0 | 0 | I installed the SimpleCv on my raspberryPi and the driver to use the camera board with it (uv4l driver) and now I'd like to play with it.
When I type on simpleCV shell "Camera(0).getImage().save("foo.jpg") " , on the screen appears the camera preview and I am not able to type other command because this preview covers the shell
What Have I to do to remove the camera preview ?
Thanks a lot !
Filippo | How remove camera preview to raspberry pi | 1.2 | 0 | 0 | 3,614 |
20,897,140 | 2014-01-03T05:28:00.000 | 1 | 0 | 0 | 0 | python,image,numpy,fill,polygons | 20,914,427 | 1 | true | 0 | 0 | In this case the point to achieve speed is more the used algorithms than the language of choice. Drawing and filling poligons rasterized over a grid of pixel falls into the domain of image processing algorithms and for sure AggDraw is using algorithms from that field.
The idea is that if you evaluate for each points a function that considers the vectorial nature of the polygon you need to do a number of operations that is at least O(2*p*A) where:
A = image area
p = average number of points in the perimeter of the polygons.
Conversely if you use image processing algorithms for each point you can consider to have a fixed and low number of operations. For example if you consider the FloodFill algorithm it is O(A) and I can say it is less than 30*A (about 30 operations per pixel).
So basically since the GADM polygons has many vertex is better to eliminate the vectorial nature of the problem as soon as possible and go with something like this:
construct the pixel map of the boundary
find one internal pixel
use the Floodfill algorithm that will work without any need to know about polygons as vectorial entities
The same algorithms can for sure be implemented in Numpy but before going for a Numpy graphical lib I would suggest to do the following:
measure the time spent in your code for the various steps:
Numpy array to AggDraw lists/sequences conversion
time taken by AggDraw
try to decimate the vertex of the polygons removing the ones that stay in the same pixel based on the current Zoom level and see if an how the times will be reduced | 1 | 3 | 1 | Here goes a difficult one for the expert Numpyer!
Does someone know or can come up with a way to use pure Numpy arrays and functions to draw as well as fill colored polygons on top of a numpy array grid?
This I think would take two steps:
The ability to fill the grid array with color values so that the
polygon filling could be written in one color, and the outline in
another one. What would be ideal and fastest for such a system, eg
tuples of rgb values, color name strings, etc?
The ability to draw and fill the inside of a polygon based on an
array of its pixel coordinates. Drawing the outline of it I think
should be pretty easy by just using the coordinates as indexes to
the grid array and setting them to the outline color values. More
difficult would be to fill the polygon. One way would be to iterate
through all pixel cell coordinates (or better yet only for the
neighboring cells of each polygon coordinate point) and test if its
coordinates are within the polygon pixel coordinates. I know there
are some simple inside-outside/biggerthan-smallerthan algorithms to
test for point in poly using regular Python, but for my purpose this
would be too slow and I am wondering if someone has the numpy skills
to set up such an advanced linked code using only the speed of the
numpy builtin functions to return True if a numpy pixel coordinate
is inside a polygon.
Lastly, if someone would know how to draw a line between two
pixel/grid/array coordinates by filling in all the cells in between
two pixels with a True or color value?
I know this is a tall order, but I was just curious to see if anyone would know. If so, then this could make for a pretty powerful and fast Numpy-based drawing library. In the end I would like to save the grid array as an image which is easy by passing it to PIL.
I am aware that PIL and Aggdraw can do the polygon drawings and that this has been suggested in many similar posts, but they are not very effective when receiving a numpy array of xy polygon/line coordinates. The assumption here is that my polygon coordinates are already in a numpy array format and I want to avoid the overhead of having to copy them into lists for every drawing (when we're talking about thousands of polygons frequently). So the difference in this post is about how to fill a polygon using pure Numpy. | How to draw and fill a polygon on a grid array using pure Numpy functions? | 1.2 | 0 | 0 | 2,144 |
20,897,851 | 2014-01-03T06:24:00.000 | 0 | 0 | 1 | 0 | python,django,python-2.7,pip | 36,064,213 | 11 | false | 1 | 0 | I used the same method mentioned by @S-T after the pip uninstall command. And even after that the I got the message that Django was already installed. So i deleted the 'Django-1.7.6.egg-info' folder from '/usr/lib/python2.7/dist-packages' and then it worked for me. | 5 | 18 | 0 | I uninstalled django on my machine using pip uninstall Django. It says successfully uninstalled whereas when I see django version in python shell, it still gives the older version I installed.
To remove it from python path, I deleted the django folder under /usr/local/lib/python-2.7/dist-packages/.
However sudo pip search Django | more /^Django command still shows Django installed version. How do i completely remove it ? | Uninstall Django completely | 0 | 0 | 0 | 137,290 |
20,897,851 | 2014-01-03T06:24:00.000 | 0 | 0 | 1 | 0 | python,django,python-2.7,pip | 29,770,392 | 11 | false | 1 | 0 | Remove any old versions of Django
If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version.
If you installed Django using pip or easy_install previously, installing with pip or easy_install again will automatically take care of the old version, so you don’t need to do it yourself.
If you previously installed Django using python setup.py install, uninstalling is as simple as deleting the django directory from your Python site-packages. To find the directory you need to remove, you can run the following at your shell prompt (not the interactive Python prompt):
$ python -c "import django; print(django.path)" | 5 | 18 | 0 | I uninstalled django on my machine using pip uninstall Django. It says successfully uninstalled whereas when I see django version in python shell, it still gives the older version I installed.
To remove it from python path, I deleted the django folder under /usr/local/lib/python-2.7/dist-packages/.
However sudo pip search Django | more /^Django command still shows Django installed version. How do i completely remove it ? | Uninstall Django completely | 0 | 0 | 0 | 137,290 |
20,897,851 | 2014-01-03T06:24:00.000 | 5 | 0 | 1 | 0 | python,django,python-2.7,pip | 57,724,958 | 11 | false | 1 | 0 | open the CMD and use this command :
**
pip uninstall django
**
it will easy uninstalled . | 5 | 18 | 0 | I uninstalled django on my machine using pip uninstall Django. It says successfully uninstalled whereas when I see django version in python shell, it still gives the older version I installed.
To remove it from python path, I deleted the django folder under /usr/local/lib/python-2.7/dist-packages/.
However sudo pip search Django | more /^Django command still shows Django installed version. How do i completely remove it ? | Uninstall Django completely | 0.090659 | 0 | 0 | 137,290 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.