RSS category feeds

RSS site feeds

More

Script Collection

This is an example collection of Python Scripts for Windows. Most of them show, how to automate Windows Applications with COM. For the most scripts you need a Python distribution and the Pywin32 module, which is included in ActivePython.

If you want to post a script, article or news please use this link Post a Python script. Hint: For sytax highlighting place your code between the tags <pre> and </pre>

This section as RSS feed.



Python and domino PDF Print E-mail
A tutorial to automate Lotus Notes with Python and an Android app. It describes the user registration process.
Last Updated ( Saturday, 16 July 2016 )
 
Rise of Python and PythonWeek PDF Print E-mail
ImageFor companies and people all over the world web development & design choices have become even more essential over the last few years, and you, as a web developer, have to make a few important decisions that can affect your entire career as well. You need to ask yourself questions such as: Are Emerging Economies taking a growing slice of the web job pie? Should you join a start-up, or go into an enterprise company? How valuable is being a Full-stack Developer? Is Angular 2.0 going to take over the world of web development? Is mobile going to change the way web developers work permanently? What's the hottest upcoming trend in Web Development?
Last Updated ( Saturday, 16 July 2016 )
 
Determine top level script name and directory in Python PDF Print E-mail

This script provides the name and directory of the top level Python script.

Why is this useful?

Sometimes you need information stored in the main script's directory (configuration data, graphics, parameters, etc.)

Why this approach?

The simpler ways of doing this all fail in one or the other situation:
  • Variable "__file__" contains the source name but it is not available when being invoked by execfile or when compiled.
  • Variable "sys.argv[0]" does not work when we are being invoked by execfile.
  • Variable "sys.executable" only works in the compiled case. It does provide directory information and the executable's name, but not the name of the Python source that was used to create it.

ScriptInfo tries to always provide the correct information. It has been tested with Python 2.7.9 / Win7 and py2exe, cx_freeze, PyInstaller, IDLE, IPython (sh) / (Qt), python interpreter.

Sample usage:
 
import scriptinfo as si
 
script_name = si.scriptinfo["name"]      # will contain <toplevel>.py / <toplevel>.exe
script_dir  = si.scriptinfo["dir"]       # will contain directory where <toplevel>.py / <toplevel>.exe sits
script_src  = si.scriptinfo["source"]    # will contain <toplevel>.py
"source" and "name" are identical when running interpreted.
"source" contains the Python name of the script that was compiled yielding the executable - but only in cases py2exe and cx_freeze. "source" has no meaningful information in PyInstaller compilations.
Last Updated ( Monday, 19 January 2015 )
 
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 1 - 3 of 109

Feedback

Advertisement

Comments

  • I have run your code on my own machine, but I just got the last paragraph of the... More...
  • Hello Gabriel, It seem that the linked site moved to github.com/.../weboutlook (... More...
  • There is no script to download, could you provide the right link More...
  • Interesting but doesn't really help me. I do not see what the 'xxxxx' in the Ses... More...
  • You can see more python editor comparison: sparkledge.com/.../ (http://sparkledg... More...

Login Form






Lost Password?

My prefered Python IDE

My prefered Python editor is Pyscripter from MMExperts. It is not only an editor. Pyscripter is a full Python IDE including (remote) debugging, a class browser, and all other nice helpers which a full featured IDE needs.

Do you have a script for me ?

Do you have an interesting Python script which does some really cool thing on Windows ? Please post them to this site. It`s very simple - simply copy&paste it to this form. No login is requiered.

Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.

My prefered web framework

My prefered web framework for developing web applications is Django. Django calls itself The web framework for perfectionists with deadlines. It is a really fast, scalable and (thanks Python) the sexiest web framework of the world.