Python IMVU Snippets

DataMine
by DataMine · 3 posts
7 years ago in Python
Posted 7 years ago · Author
In an effort to get a basic understanding of Python I'm going to write code to perform basic tasks related to IMVU that I already know how to do in other languages.

Below I am going to share a few code snippets with you that you can learn from. Each piece of code is fully functional on its own and can be saved to a file and ran via the python console. As long as you have python installed you should be able to run them.

Requirements:
1) Python
2) Python IDE/Text Editor (I'm using Notepad++)


Open your IMVU cache folder
Code
import subprocess, os

if os.getenv('APPDATA') is not None:
   subprocess.Popen('explorer "' + os.getenv('APPDATA') + '\IMVU\HttpCache\"')


Basic cache cleaner
This is a basic cache cleaner, it goes through your cache folder deleting all of the files and folders.
Code
import os, shutil

cachePath = os.path.join(os.getenv('APPDATA') + '\\IMVU\\HttpCache\\')

if os.path.exists(cachePath):
   print cachePath
   for cacheFile in os.listdir(cachePath):
      cacheFilePath = os.path.join(cachePath, cacheFile)
      try:
         if os.path.isfile(cacheFilePath):
            os.unlink(cacheFilePath)
         elif os.path.isdir(cacheFilePath): shutil.rmtree(cacheFilePath)
      except Exception as e:
         print(e)
else:
   print 'IMVU Cache Folder Not Found'

raw_input()


Basic cache cleaner v2
This is another basic cache cleaner. Except instead of going through the cache folders and files it just deletes the entire cache folder at once and then replaces it with an empty folder
Code
import os, shutil

cachePath = os.path.join(os.getenv('APPDATA') + '\\IMVU\\HttpCache\\')

if os.path.exists(cachePath):
   print cachePath
   try:
      if os.path.isdir(cachePath):
         shutil.rmtree(cachePath)
         os.makedirs(cachePath)
   except Exception as e:
      print(e)
else:
   print 'IMVU Cache Folder Not Found'

raw_input()
Posted 6 years ago
imvu lags for me from this
Posted 2 years ago
I coded this in delphi cause from explorer it took ages and even trying to de-install imvu client takes centuries.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT