Menu

Play Money

zak
2010-06-12
2012-12-06
  • zak

    zak - 2010-06-12

    I wrote a little python program so that I could track my play money progress with PT3, it should work for fpdb as well. It goes creates a list of files in the hand history directory, checks the filenames for 'Play Money', and if that string is not in the filename then it removes it from the list. It then writes all the play money histories to a single 'playMoney.txt' file and goes through that file replacing all instances of '(Play Money) ' with an empty string (in other words, deleting them). This will only work on Linux and requires you to make a /.playmoney folder in your home directory. You also must "from os import *" for the function to work. For some reason when I type the commands one by one it works, but as a function I am getting a "typeError: integer required", so anyone that can help me iron the kinks out of this code would have my thanks. Here is the code:

    def playmoney():
    path = '/home/<usr_name_here>/.wine/drive_c/Program Files/PokerStars/HandHistory/BBAxelMan'
    histories = listdir(path)
    i = list()
    for x in range(0,len(histories)):
    if histories.find("Play Money") == -1:
    i.append(x)
    i.reverse()
    for x in i:
    histories.pop(x)
    history = open('.playmoney/playMoney.txt','a')
    for x in histories:
    history_ = open(path + repr(x),'r')
    history.write(history_.read())
    history_.close()
    history.write().replace("(Play Money) ","")
    history.close()
    return 0

     
  • zak

    zak - 2010-06-12

    oh important piece of info this was done with python 3.1

     
  • zak

    zak - 2010-06-13

    Aha! I fixed it. Do not do "from os import *", just do a regular "import os", this code will work in python 2.6 as well as 3.1. Here's the fixed code:

    def playmoney():
    path = <path_to_hand_history_files>
    histories = os.listdir(path)
    i = list()
    for x in range(0,len(histories)):
    if histories.find("Play Money") == -1:
    i.append(x)
    i.reverse()
    for x in i:
    histories.pop(x)
    history = open('.playmoney/playMoney.txt','a')
    for x in histories:
    history_ = open(path + '/' + x,'r')
    history.write(history_.read().replace('(Play Money) ',''))
    history_.close()
    history.close()
    return 0

     
  • zak

    zak - 2010-06-13

    sorry about the schizophrenic postings, this only works for PokerStars hand histories as far as I know, it sohuld work with other sites as well with slight modification

     

Log in to post a comment.