Search Results

Search found 13693 results on 548 pages for 'python metaprogramming'.

Page 89/548 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • Splitting a list in python

    - by mglmnc
    Hey im new to python. How do you get a portion of a list by the relative value of its sorting key. example... list = [11,12,13,14,15,16,1,2,3,4,5,6,7,8,9,10] list.sort() newList = list.split("all numbers that are over 13") assert newList == [14,15,16]

    Read the article

  • python hbase exception

    - by kula
    when i use client.mutateRow(self.tableName, row, mutations) to write data to hbase . there is a exception, IOError: IOError(message="Trying to contact region server Some server, retryOnlyOne=true, index=0, islastrow=true, tries=9, numtries=10, i=0, listsize=1, region=test,,1276665207312 for region test,,1276665207312, row 'hello', but failed after 10 attempts.\nExceptions:\n") i use http://pypi.python.org/pypi/hbase-thrift/0.20.4 to write hbase. seems it is a library bug. anyone can help me ?

    Read the article

  • Code Analysis In Python

    - by Jerub
    What tools are good to use for code analysis in python? I have a large source repository split across multiple projects, and I would like to be able to run tools across the directories to see details like Cyclomatic Complexity, and perhaps be able to spot errors using static analysis. Ideally, I would like to be able to produce a report about the health of the source code, so we can spot problem areas that need to be addressed.

    Read the article

  • Difference between Python urllib.urlretrieve() and wget

    - by jrdioko
    I am trying to retrieve a 500mb file using Python, and I have a script which uses urllib.urlretrieve(). There seems to some network problem between me and the download site, as this call consistently hangs and fails to complete. However, using wget to retrieve the file tends to work without problems. What is the difference between urlretrieve() and wget that could cause this difference?

    Read the article

  • Dealing with wacky encodings in Python

    - by Tyson
    I have a Python script that pulls in data from many sources (databases, files, etc.). Supposedly, all the strings are unicode, but what I end up getting is any variation on the following theme (as returned by repr()): u'D\\xc3\\xa9cor' u'D\xc3\xa9cor' 'D\\xc3\\xa9cor' 'D\xc3\xa9cor' Is there a reliable way to take any four of the above strings and return the proper unicode string? u'D\xe9cor' # --> Décor The only way I can think of right now uses eval(), replace(), and a deep, burning shame that will never wash away.

    Read the article

  • maya2008 win32api 64 bit python

    - by knishua
    how is it possible to run import win32api successfully on a 64bit maya version 2008 following error occurs Error: No module named win32api Traceback (most recent call last): File "", line 1, in ImportError: No module named win32api # I need to get mouse cursor position in python so that i can place window exactly in that position. Is there any other way to get it Brgds, kNish

    Read the article

  • perl code to python code

    - by Eva
    can you convert this perl code to python code : $list = $ARGV[0]; open (PASSFILE, "$list") || die "[-] Can't open the List of password file !"; @strings = ; close PASSFILE; Thanks

    Read the article

  • time series in python up to microseconds

    - by Abruzzo Forte e Gentile
    Hi All I would like to handle time series in python. I have been suggested to use scikit.timeseries but I need to handle up to microseconds and this last, as far as I know, handles up to milliseconds. Do you know any other library able to do that? At some point I need to merge 2 time series sampled at different time, and I would like to avoid rewriting such kind of features or any new classes from scratch whenever it is possible. I thank you all AFG

    Read the article

  • Python urllib.urlopen() call doesn't work with a URL that a browser accepts

    - by Charles Anderson
    If I point Firefox at http://bitbucket.org/tortoisehg/stable/wiki/Home/ReleaseNotes, I get a page of HTML. But if I try this in Python: import urllib site = 'http://bitbucket.org/tortoisehg/stable/wiki/Home/ReleaseNotes' req = urllib.urlopen(site) text = req.read() I get the following: 500 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. What am I doing wrong?

    Read the article

  • set timeout to http response read method in python

    - by nirtayeb
    Hi, I'm building a download manager in python for fun, and sometimes the connection to the server is still on but the server doesn't send me data, so read method (of HTTPResponse) block me forever. This happens, for example, when I download from a server, which located outside of my country, that limit the bandwidth to other countries. How can I set a timeout for the read method (2 minutes for example)? Thanks, Nir.

    Read the article

  • Play DVDs in Python?

    - by Zachary Brown
    I want to write a custom DVD player using python that plays for 30 seconds, then pauses and asks a question. Once the question is anwered, it tells the user if they are right or wrong and gives them a Resume button to resume DVD playback. How do I do this. I have never written a DVD player before, but I am open to learning!

    Read the article

  • Implement python replace() function without using regexp

    - by jwesonga
    I'm trying to rewrite the equivalent of the python replace() function without using regexp. Using this code, i've managed to get it to work with single chars, but not with more than one character: def Replacer(self, find_char, replace_char): s = [] for char in self.base_string: if char == find_char: char = replace_char #print char s.append(char) s = ''.join(s) my_string.Replacer('a','E') Anybody have any pointers how to make this work with more than one character? example: my_string.Replacer('kl', 'lll')

    Read the article

  • How to start a Python script several functions in

    - by chrissygormley
    Hello, I have a Python script and I want to call it several functions down the script. Example code below: class Name(): def __init__(self): self.name = 'John' self.address = 'Place' self.age = '100' def printName(self): print self.name def printAddress(self): print self.address def printAge(self): print self.age if __name__ == '__main__': Person = Name() Person.printName() Person.printAddress() Person.printage() I execute this code by entering ./name.py. How could I exectute this code from the function printAddress() down the the end of the script? Thanks

    Read the article

  • python return class

    - by William P
    Hi I new to python and I read from someone else of the example code below: class A: def current(self): data = Data(a=a,b=b,c=c) return data class B(A): #something here #print data a b c How do I print out the data a, b, and c?

    Read the article

  • What to put in a python module docstring?

    - by 007brendan
    Ok, so I've read both PEP 8 and PEP 257, and I've written lots of docstrings for functions and classes, but I'm a little unsure about what should go in a module docstring. I figured, at a minimum, it should document the functions and classes that the module exports, but I've also seen a few modules that list author names, copyright information, etc. Does anyone have an example of how a good python docstring should be structured?

    Read the article

  • super function doesn't work inside a maya python module

    - by sfjedi
    Somehow, this works fine in the Maya/Python script editor, but fails when it's inside of my module code. Anyone have any ideas? class ControlShape(object): def __init__(self, *args, **kwargs): print 'Inside ControlShape...' class Cross(ControlShape): def __init__(self, *args, **kwargs): print 'Entering Cross...' super(Cross, self).__init__(*args, **kwargs) print 'Leaving Cross...' x = Cross() This gives me a TypeError: super(type, obj): obj must be an instance or subtype of type.

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >