python

Python: get currently logged user and his/her special folders

Does this code win32api.GetUserName() works fine on all win system from win 2000 to win 7 ? What about if user is not local user but domain user, does it still work ? When i use this function shell.SHGetFolderPath(0, shellcon.CSIDL_someDirectory, 0, 0), do I get wanted folder for currently logged user ? Any help appreciated. ...

Dynamically update wxPython staticText

Hi all, i was wondering how to update a StaticText dynamically in wxpython? I have a script that goes every five minutes and reads a status from a webpage, then prints using wxpython the status in a static input. How would i dynamically, every 5 minutes update the statictext to reflect the status? thanks alot -soule ...

Comparison of IntelliJ Python Plugin or PyCharm

So I have IntelliJ and love it, and have been using the python plugin for a while. But I noticed that they have PyCharm coming out in beta now. I haven't been using pycharm since I just use IntelliJ for everything, but is there a compelling reason to buy pycharm? ...

smallest learning curve language to work with CSV files

VBA is not cutting it for me anymore. i have lots of huge excel files to which i need to make lots of calculations and break them down into other excel/csv files. i need a language that i can pick up within the next couple of days to do what i need because it is kind of an emergency. i have been suggested python, but i would like to che...

Change default Python version from 2.4 to 2.6

I'm wanting to use some newer software that requires Python 2.6, and we currently have both 2.4 and 2.6 installed on our dedicated CentOS server, which looks like this: $ which python /usr/local/bin/python $ which python2.6 /usr/bin/python2.6 $ which python2.4 /usr/local/bin/python2.4 $ ls -l /usr/local/bin/py* -rwxr-xr-x 1 root root ...

python beginner questions

i just installed python i am trying to run this script: import csv reader = csv.reader(open("some.csv", "rb")) for row in reader: print row i am running on windows. do i have to type each line individually into python shell or can i save this code into a text file and then run it from the shell? where does some.csv have to be i...

How do I make a stub XML file from a schema using Python

I want to create a stub xml file from a schema ... what packages are the best to use for this? x ...

csv python questions

i am opening a csv file like this: import csv reader = csv.reader(open("book1.csv", "rb")) for row in reader: print row how can i replace the value in column 3 with its log and then save the result into a new csv? ...

python csv: getting subset

here is a snapshot of my csv: alex 123f 1 harry fwef 2 alex sef 3 alex gsdf 4 alex wf35 6 harry sdfsdf 3 i would like to get the subset of this data where the occurrence of anything in the first column (harry, alex) is at least 4. so i want the resulting data set to be: alex 123f 1 alex sef 3 ale...

Can this image processing code be optimised to use less memory?

Hello stackoverflow, I have a python function that takes a string s-expression like "(add (sub 10 5) 5)", where "add" and "sub" are actually image processing functions, and evaluates and creates the image represented in the string. The image processing functions take constants, variables, or other images (represented as lists of vectors...

jira SOAP and XMLRPC

I was wondering if there are urls for the various calls that can be made to jira. get issues, get users. what format are they in xml? json? I want to write a wrapper class in python. I see the SOAP api exsists but no methods definitions in python anywhere I can find. I found the java one fairly easy. Your help is appreciated. Please a...

python receiving from a socket

So I have a simple socket server on an android emulator. When I'm only sending data to it, it works just fine. But then if I want to echo that data back to the python script, it doesn't work at all. Here's the code that works: android: try { serverSocket = new ServerSocket(port); } catch (IOException e1) ...

How do I access data programatically (load a pickled file) that is stored as a static file?

how is this solution I am using now: I have a 1MB .dbf file in the same directory of all my .py modules. In main.py I have import tools In tool.py code is : the_list_that_never_changes = loadDbf(file).variables['CNTYIDFP']. So the_list_that_never_changes is only loaded once and is always in memory ready to be used...correct? ...

Product code looks like abcd2343, what to split by letters and numbers

I have a list of product codes in a text file, on each like is the product code that looks like: abcd2343 abw34324 abc3243-23A So it is letters followed by numbers and other characters. I want to split on the first occurrence of a number. ...

when download an image, does urllib have a return code if its sucessful or not?

I want to download an image file from potentially 5 sites. Meaning that if the image wasn't found in site#1, try site#2, etc. How can I test if the file was downloaded? ...

post to page to login using beautiful soup

I'm using python and beautifulsoup (new to both!), and I want to login to a suppliers website. So their form looks like (simplified): <form name=loginform action=/index.html method="post"> <input name=user> <input name=pass"> </form> Is there a way to keep track for cookies? ...

with beautifulsoup, how to reference the first table after a given form

I want to drill down into my html, specifically I want to get the first html table that is AFTER a form that looks like: <form method="POST" action="/parts.html"> .. <table ...> ... </table> .. </form> So this table has <tr> for each product. My utlimate goal here is to loop through each tablerow, and then I need to extract the ...

Is it possible to have python open a terminal and write to it?

For example, if I have this code: subprocess.call(['gnome-terminal']) Is it possible to have python output strings to that specific terminal that was just opened? Thanks! ...

WTForms... html, autofocus?

Is it possible to have some of the new attribute only attributes used in HTML5, inside of WTForms? Eg, say you want to create a TextField with placeholder="foo", required, and autofocus attributes. How would this be done in WTForms? In html it would look like this: <input maxlength="256" name="q" value="" placeholder="foo" autofocus re...

Why tuple is faster than list?

Sorry because this is a noob question. I'm reading Dive into Python, and just read "tuple is faster than list". http://diveintopython3.org/native-datatypes.html#tuples Tuple is immutable, and list is mutable, but I don't quite understand why tuple is faster. Anyone did a performance test on this? Thanks. ...