What’s the working directory when using IDLE?

You can easily check that yourself using os.getcwd: >>> import os >>> os.getcwd() ‘C:\\Program Files\\Python33’ That’s on my Windows machine, so it’s probably the installation directory of Python itself. You can change that directory at runtime using os.chdir: >>> os.chdir(‘C:\\Users\\poke\\Desktop\\’) >>> os.getcwd() ‘C:\\Users\\poke\\Desktop’ >>> with open(‘someFile.txt’, ‘w+’) as f: f.write(‘This should be at C:\\Users\\poke\\Desktop\\someFile.txt now.’) … Read more

Pasting multiple lines into IDLE

Probably not the most beautiful procedure, but this works: cmds=””‘ paste your commands, followed by ”’: a = 1 b = 2 c = 3 ”’ Then exec(cmds) will execute them. Or more directly, exec(”’ then paste your commands, followed by ”’): a = 1 b = 2 c = 3 ”’) It’s just a … Read more

When running a python script in IDLE, is there a way to pass in command line arguments (args)?

It doesn’t seem like IDLE provides a way to do this through the GUI, but you could do something like: idle.py -r scriptname.py arg1 arg2 arg3 You can also set sys.argv manually, like: try: __file__ except: sys.argv = [sys.argv[0], ‘argument1’, ‘argument2’, ‘argument2’] (Credit http://wayneandlayne.com/2009/04/14/using-command-line-arguments-in-python-in-idle/)

Terminating idle mysql connections

Manual cleanup: You can KILL the processid. mysql> show full processlist; +———+————+——————-+——+———+——-+——-+———————–+ | Id | User | Host | db | Command | Time | State | Info | +———+————+——————-+——+———+——-+——-+———————–+ | 1193777 | TestUser12 | 192.168.1.11:3775 | www | Sleep | 25946 | | NULL | +———+————+——————-+——+———+——-+——-+———————–+ mysql> kill 1193777; But: the php application might … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)