Hudson not able to run python with os.system(cmd) in Win 2003 Server

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Hudson not able to run python with os.system(cmd) in Win 2003 Server

kiangoh
Note: I posted my question on the wrong mailing list: hudson issues.  Re-post it to the right one.

Hi,

I have a python script which is triggered by Hudson, and the script will then call another python script. It has been working well in my Win 2008 Server environment. However, when I set up the same environment in Win 2003, I notice that after the first script been triggered by hudson, the second script never been triggered by the first script. The problem is seen in 2 of my Win 2003 servers. I am using os.system(command) in my code.

Same python versions used in 3 servers: Python 2.3.5 (#62, Feb 8 2005, 16:23:02)
Same Hudson versions used in all 3 servers: Hudson ver. 1.346

I've the simplified version of my python script below. I was hoping somebody might have idea what is missing here.

Thanks,
Kian


test.py
=====
import os
print 'kk testing here in test.py'
os.system('echo echo here')


DOS Output (Expected)
==========
E:\Automation\bin>python test.py
kk testing here in test.py
echo here



Hudson Output from Win2008 Server (Expected)
===============================
Started by user anonymous
[workspace] $ cmd /c call C:\Users\relqc\AppData\Local\Temp\hudson1297633292840159415.bat

D:\Automation\bin\hudson\jobs\test\workspace>D:\Automation\bin\test.py
echo here
kk testing here in test.py


D:\Automation\bin\hudson\jobs\test\workspace>exit 0
Finished: SUCCESS


Hudson Output from Win2003 Server (Unexpected - missing "echo here")
==============================
Started by user gohk
[workspace] $ cmd /c call C:\DOCUME~1\relqc\LOCALS~1\Temp\hudson2087230603324335703.bat

E:\Automation\bin\hudson\jobs\test\workspace>E:\Automation\bin\test.py
kk testing here in test.py

E:\Automation\bin\hudson\jobs\test\workspace>exit 0
Finished: SUCCESS
Reply | Threaded
Open this post in threaded view
|

Re: Hudson not able to run python with os.system(cmd) in Win 2003 Server

Kohsuke Kawaguchi
Administrator
I don't think Hudson could magically change the behavior of Python ---
I suspect it's the environment that you run Hudson in that's affecting
your Python behavior.

What is the return value from os.system? Also, "echo" is an internal
command in cmd.exe, AFAIK. Don't you need to run it like "cmd.exe /c
echo abc"?

2010/2/26 kiangoh <[hidden email]>:

>
> Note: I posted my question on the wrong mailing list: hudson issues.  Re-post
> it to the right one.
>
> Hi,
>
> I have a python script which is triggered by Hudson, and the script will
> then call another python script. It has been working well in my Win 2008
> Server environment. However, when I set up the same environment in Win 2003,
> I notice that after the first script been triggered by hudson, the second
> script never been triggered by the first script. The problem is seen in 2 of
> my Win 2003 servers. I am using os.system(command) in my code.
>
> Same python versions used in 3 servers: Python 2.3.5 (#62, Feb 8 2005,
> 16:23:02)
> Same Hudson versions used in all 3 servers: Hudson ver. 1.346
>
> I've the simplified version of my python script below. I was hoping somebody
> might have idea what is missing here.
>
> Thanks,
> Kian
>
>
> test.py
> =====
> import os
> print 'kk testing here in test.py'
> os.system('echo echo here')
>
>
> DOS Output (Expected)
> ==========
> E:\Automation\bin>python test.py
> kk testing here in test.py
> echo here
>
>
> Hudson Output from Win2008 Server (Expected)
> ===============================
> Started by user anonymous
> [workspace] $ cmd /c call
> C:\Users\relqc\AppData\Local\Temp\hudson1297633292840159415.bat
>
> D:\Automation\bin\hudson\jobs\test\workspace>D:\Automation\bin\test.py
> echo here
> kk testing here in test.py
>
> D:\Automation\bin\hudson\jobs\test\workspace>exit 0
> Finished: SUCCESS
>
>
> Hudson Output from Win2003 Server (Unexpected - missing "echo here")
> ==============================
> Started by user gohk
> [workspace] $ cmd /c call
> C:\DOCUME~1\relqc\LOCALS~1\Temp\hudson2087230603324335703.bat
>
> E:\Automation\bin\hudson\jobs\test\workspace>E:\Automation\bin\test.py
> kk testing here in test.py
>
> E:\Automation\bin\hudson\jobs\test\workspace>exit 0
> Finished: SUCCESS
> --
> View this message in context: http://n4.nabble.com/Hudson-not-able-to-run-python-with-os-system-cmd-in-Win-2003-Server-tp1570672p1570672.html
> Sent from the Hudson users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
Kohsuke Kawaguchi

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hudson not able to run python with os.system(cmd) in Win 2003 Server

kiangoh
In reply to this post by kiangoh
Kohsuke,

Thanks for the reply.  The return value from the os.system call is 0 in both OS.

I modified my example code a bit to directly call the second script, it seems that the os.system call from the first script (from hudson) doesn't do anything in my Win 2003 environment.  Everything is working in my Win 2008 environment.  I can reproduce the same behaviour in my second Win 2003 server.

test.py
=====
import os
print 'kk testing here in test1.py'
returnVal = os.system('python D:\\test2.py')

print 'Return Value is', returnVal


test2.py
=====
print '   Hello from test2.py'


DOS Output (Expected)
==========
D:\Automation\bin>test.py
kk testing here in test1.py
   Hello from test2.py
Return Value is 0



Hudson Output from Win2008 Server (Expected)
===============================
Started by user anonymous
[workspace] $ cmd /c call C:\Users\relqc\AppData\Local\Temp\hudson1661328978520813001.bat

D:\Automation\bin\hudson\jobs\test\workspace>D:\Automation\bin\test.py
   Hello from test2.py
kk testing here in test1.py
Return Value is 0


D:\Automation\bin\hudson\jobs\test\workspace>exit 0
Finished: SUCCESS

Hudson Output from Win2003 Server (Unexpected - missing "Hello from test2.py")
==============================

Started by user gohk
[workspace] $ cmd /c call C:\DOCUME~1\relqc\LOCALS~1\Temp\hudson681685792397906794.bat

E:\Automation\bin\hudson\jobs\test\workspace>E:\Automation\bin\test.py
kk testing here in test1.py
Return Value is 0


E:\Automation\bin\hudson\jobs\test\workspace>exit 0
Finished: SUCCESS




====================================


 Feb 25, 2010; 03:21pm Hudson not able to run python with os.system(cmd) in Win 2003 Server   Reply Threaded More  Reply to author
Ban this user
Unban this user
Edit post
Delete post
Remove topic from forum
Don't allow replies (lock)
Allow replies (unlock)
Move topic to...
Print post
Permalink
 
   
 
 


This message was accepted by the issues@hudson.dev.java.net mailing list.
Hi,

I have a python script which is triggered by Hudson, and the script will then call another python script. It has been working well in my Win 2008 Server environment. However, when I set up the same environment in Win 2003, I notice that after the first script been triggered by hudson, the second script never been triggered by the first script. The problem is seen in 2 of my Win 2003 servers. I am using os.system(command) in my code.

Same python versions used in 3 servers: Python 2.3.5 (#62, Feb 8 2005, 16:23:02)
Same Hudson versions used in all 3 servers: Hudson ver. 1.346

I've the simplified version of my python script below. I was hoping somebody might have idea what is missing here.

Thanks,
Kian


test.py
=====
import os
print 'kk testing here in test.py'
os.system('echo echo here')


DOS Output (Expected)
==========
E:\Automation\bin>python test.py
kk testing here in test.py
echo here


Hudson Output from Win2008 Server (Expected)
===============================
Started by user anonymous
[workspace] $ cmd /c call C:\Users\relqc\AppData\Local\Temp\hudson1297633292840159415.bat

D:\Automation\bin\hudson\jobs\test\workspace>D:\Automation\bin\test.py
echo here
kk testing here in test.py

D:\Automation\bin\hudson\jobs\test\workspace>exit 0
Finished: SUCCESS


Hudson Output from Win2003 Server (Unexpected - missing "echo here")
==============================

Started by user gohk
[workspace] $ cmd /c call C:\DOCUME~1\relqc\LOCALS~1\Temp\hudson681685792397906794.bat

E:\Automation\bin\hudson\jobs\test\workspace>E:\Automation\bin\test.py
kk testing here in test1.py
Return Value is 0

E:\Automation\bin\hudson\jobs\test\workspace>exit 0
Finished: SUCCESS

Reply | Threaded
Open this post in threaded view
|

Out of Office AutoReply: Hudson not able to run python with os.system(cmd) in Win 2003 Server

pcampbell
Out of Office AutoReply: Hudson not able to run python with os.system(cmd) in Win 2003 Server

I am out of the office Monday, March 1 through Friday, March 5 and am unable to respond to your email.  I will return on Monday, March 8.

If you need immediate assistance for Hudson issues, contact Jason Collins, otherwise please contact Juan Nunez.