Tips for learing phyton scripting

suresh created the topic: Tips for learing phyton scripting

Hi everyone.

Can any one suggest project for becoming the best in python scripting.

Any project where we actually use python scripting in build and release engineering side.

– venki

rajeshkumar replied the topic: Tips for learing phyton scripting

Best would be to start with some basic book. then you may want to move it to advance book. i have few good ppt for python basics, just remind me later in this week, i will share with you.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajeshkumar replied the topic: Tips for learing phyton scripting

Also, you may want to refer my earlier ebooks upload as here… community.scmgalaxy.com/pg/search/?q=python
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Run a .bat file using python code

rajeshkumar created the topic: Run a .bat file using python code

from subprocess import Popen
p = Popen(“batch.bat”, cwd=r”C:\Path\to\batchfolder”)
stdout, stderr = p.communicate()
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Perforce Python Script Collection.

rajeshkumar created the topic: Perforce Python Script Collection.

Implement a script that will do following:

1. Read config file. This file will contain following settings:
a. For mail delivery (SMTP)
b. For access to perforce server
2. Get from perforce a list of changes made since last script run time and get all updated files
3. Invoke script that will ‘build’ the changes – it will be located in the working folder of the
script(build.bat/build.sh). Script itself should come from perforce as well during step 2.
4. If running of build script is successful, add/update contents of folder named ‘bin’ in the perforce
repository (it is expected that build script will put there a product of its work)
5. In case of error of invocation, send out an email with the list of changes retrieved in p.2 and all outputs of
build script (both stdout/stderr), in which case contents of ‘bin’ folder should not be updated to perforce

Solution
Script details:
master.py – This file is the main file which should be excuted to get the all desired output as per the task
build.bat – This is a Build file which will be executing during compilation phase in master.py. config.ini: Following key should be modified as the environment specification

Sender
Receivers
Message
Host
p4port
p4user
p4client
p4passwd
Scenario to create fail Build:
Remove comment line from “REM mkdir raj” in build.bat

How to use?
Change the config.ini file appropriately and fire master.py script. If you find any issues, please follow the log error message accordingly.

File is as attached

File Attachment:
File Name: build.bat.txt
File Size:0 KB

File Attachment:
File Name: config.ini.txt
File Size:0 KB

File Attachment:
File Name: Index.txt
File Size:0 KB

File Attachment:
File Name: master.txt
File Size:4 KB
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :