1 answer

(Django) - Forcing refresh/reload of url in one browser when url in second browser window is updated

I have a website written using django that has text entry, voting, and a table display of the entries sorted by age and votes, all on one page: http://www.highscore.a2hosted.com/index/ Now I would …

2 answers

Split string via regular expression

Suppose I am given a string like: input = """ abc@gmail.com is a very nice person xyz@gmail.com sucks lol@gmail.com is pretty funny.""" I have a regular expression for email addresses: ...

2 answers | 42 secs ago by whatisinaname on Stack Overflow stackoverflow.com
1 answer

Finding separating and processing repeatative blocks of lines with Python

I wrote the script which analyze the text containing the lines to be found: Uplink Bytes: 6168 Downlink Bytes: 40366 Uplink Packets: 69 Downlink …

1 answers | 1 min ago by valp on Stack Overflow stackoverflow.com
0 answers

module error on sublime text 2

for some reason I cannot load module for BeautifulSoup on Sublime Text 2. When I type in: from bs4 import BeautifulSoup I get the following error: ImportError: No module named bs4 I use Anacanda …

1 answer

get filtered embeded elements from all class on mongoengine

I got two class on Mongoengine: class UserPoints(EmbeddedDocument): user = ReferenceField(User, verbose_name='user') points = IntField(verbose_name='points', required=True) def ...

6 answers

Find size and free space of the filesystem containing a given file

I'm using Python 2.6 on Linux. What is the fastest way: to determine which partition contains a given directory or file? For example, suppose that /dev/sda2 is mounted on /home, and /dev/mapper/foo …

1 answer

Import issues in Python

I am having an import error problem in a test script. It looks like its something to do with the directory structure. I have the following folder structure A/F1/Src/F2 F1 has "__init__py" in its …

1 answers | 3 mins ago by user2921139 on Stack Overflow stackoverflow.com
0 answers

“NameError: global name 'change' is not defined” + other errors

I am fairly new to Python, and I am currently using Python 3.3.3 just in case you were wondering. Below is my code, which I translated from whatever language Batch Script is written with, to Python. …

0 answers

mistake with django STATICFILES_STORAGE

I'm working with django, and the settings file I put the configuration for STATICFILES_STORAGE, STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'. I run ...

3 answers

TypeError 'classobj' object has no attribute '__getitem__' in python

I'm just a beginner at python and I have no idea how to fix this. Please help. The error: Traceback (most recent call last): File "C:\Users\Priscilla\Desktop\CMPT Assn #3\page.py", line 17, in ...

3 answers | 8 mins ago by user3895456 on Stack Overflow stackoverflow.com
0 answers

Turtle.speed in Python 3.4

I have a bit of code that I'd like to not animate, so I want to use turtle.speed . In python 2, this works. No animation occurs and the result is quick. If I use the same code in python 3.4, the code …

0 answers

How to place sprites onto rect object in pygame?

I was wondering if any of you knew how to attach a sprite to a rect object I already made in pygame?

1 answer

Modify object via Python multiprocessing.Pool: strange behavior

I have an object with two attributes: a dict and an int. When I modify the object using a forked process via multiprocessing.Pool, I get back the object with it the modified int attribute, but the ...

2 answers

XORing file with multi-byte key

I'm simply trying to XOR a file with a multi-byte key. The key may vary in length. Returning the following error: TypeError: ord() expected string of length 1, but int found Here is what I'm ...

2 answers | 12 mins ago by Chris Hall on Stack Overflow stackoverflow.com
1 answer

BLAS/LAPACK not installed: How to install it?

I am trying to run pip install tsnefor python2.7 and I keep on getting the same error. I followed the instructions on http://bickson.blogspot.com/2011/02/installing-blaslapackitpp-on-amaon-ec2.html …

1 answers | 13 mins ago by mousecoder on Stack Overflow stackoverflow.com
1 answer

Should I use MySQL Lock Table or there exists better solution?

I'm working on a multiprocessed application, and each process sometimes executes the following code: db_cursor.execute("SELECT MAX(id) FROM prqueue;") for record in db_cursor.fetchall(): if ...

0 answers

Change default colorbar for 3D scatter plot with matplotlib

I have 3d coordinates defining positions of points in my 3D scatter plot with a corresponding number of values who I want to create a colour scale for representing the range of values as such: from …

1 answer

Classify type of tweet based on regex in python

Extension of this question: Classify type of tweet (tweet/retweet/mention) based on tweet text in Python I would like to classify each tweet in my dataset as one of the following, and append the ...

1 answers | 14 mins ago by Curtis on Stack Overflow stackoverflow.com
4 answers

How to insert string into another string with same multiple occurrences

How the following syntax can be simplified? three='Three' result='One-Two-%s, One-Two-%s, One-Two-%s'%(three,three,three)) Edited later: Another surprise: getting KeyError: 'border' on this: ...

4 answers | 15 mins ago by Sputnix on Stack Overflow stackoverflow.com
1 answer

How do you permenantly set number of lines shown in pdb?

I can use l during run time to show more lines before and after the current line to be executed in pdb, but can we do this permanently in a script or via command-line option? ywong:tmp ywong$ python …

1 answers | 16 mins ago by CppLearner on Stack Overflow stackoverflow.com
2 answers

Scraping HTML info with Python

I'd like to find the product ID (ProductID1111111) given the product name (Product 1) using Python. My thoughts would be to use the find function to return the character position of Product1 then back …

0 answers

Python sock chat client - Problems with select.select() and sys.stdin

So I'm currently trying to make a small chat client using a server and some clients. I found some code online and I wanted to use it as a basis for making my own. The problem I'm facing now is that it …

1 answer

what is the order in which glob.glob reads files? if there is no specific order, can one be specified?

I use the following command to read the names of all files in a directory in python: import glob list_of_files = glob.glob(".../*.txt") However the elements of the list "list_of_files" seem to have …

1 answers | 22 mins ago by slmnkhokhar on Stack Overflow stackoverflow.com
1 answer

Writing full contents of Pandas dataframe to HTML table

I am embedding links in one column of a Pandas dataframe (table, below) and writing the dataframe to hmtl. Links in the dataframe table are formatted as shown (indexing first link in table): In: ...

1 answers | 23 mins ago by lmart999 on Stack Overflow stackoverflow.com
1 answer

Pycharm issue - ImportError: No module named appengine.datastore.datastore_query

I have been trying to use the excellent project located at http://docs.gae-init.appspot.com/, in order to learn python, GAE and perhaps start my own hobby project. My IDE of choice is Pycharm 3.4 ...

6 answers

Why should I close files in Python?

Usually when I open files I never call the close() method, and nothing bad happens. But I've been told this is bad practice. Why is that?

6 answers | 25 mins ago by Jessica on Stack Overflow stackoverflow.com
3 answers

Looking for a PyQt5 Tutorial

I am looking for a PyQt5 tutorial. It is rather complicated to start Gui development with Python for the first time without a tutorial. I only found some PyQt4 Tutorials so far, that are outdated for …

3 answers | 25 mins ago by WeGi on Stack Overflow stackoverflow.com
6 answers

isPrime Function for Python Language

So I was able to solve this problem with a little bit of help from the internet and this is what I got: def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return ...

1 answer

Converting tuple into list does not work

I query my SQlite Database with a loop to retrieve data from it. connector = sqlite3.connect("somedb.db") selecter = connector.cursor() selecter.execute(''' SELECT somedata FROM somedb''') for row in …

1 answer

Python: why does peek(1) return 8K bytes instead of 1 byte?

I'm using Python 3, and the peek() method for buffered file I/O doesn't seem to work as documented. For example, the following code illustrates the problem -- it prints 8192 as the length of the byte …

1 answers | 31 mins ago by Doug Mahugh on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3