Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 28th, 2012, 04:02 AM
domsfreekin16 domsfreekin16 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 14 domsfreekin16 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 47 sec
Reputation Power: 0
Smile UNC file execution

Hi All

Im totally new to python and im going crazy.

I am trying to launch a batch file from the network (UNC path), but it doesnt seem to execute this batch file as this ia one batch that sets the environment for the following batches.

Kindly help me in this regard.

Im using the command

os.system("\\\\servername\\folder\\env.bat")

Reply With Quote
  #2  
Old November 28th, 2012, 10:29 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,458 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 4 Days 6 h 26 m 43 sec
Reputation Power: 403
Please show the command that works as you'd enter it to the DOS prompt. Please show the error messages. Thanks.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old November 28th, 2012, 09:23 PM
domsfreekin16 domsfreekin16 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 14 domsfreekin16 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 47 sec
Reputation Power: 0
Hi

I executed the script by running the cmd python main.py.

The script main.py consists of just 3 lines of code

impot os

os.system("\\\\servername\\dir\\file1.bat")
os.system("\\\\servername\\dir\\file2.bat")

Without executing these 2 batch files I cannot proceed to the rest of the coding part.

The file1.bat is the one that sets an environment for the file2.bat to work.

So I do not get any error message with file1.bat but the error i get is file2.bat is not recognized as an internal or external command.

Thanks for the reply.

Reply With Quote
  #4  
Old November 28th, 2012, 09:25 PM
domsfreekin16 domsfreekin16 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 14 domsfreekin16 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 47 sec
Reputation Power: 0
Hi

I executed the script by running the cmd "python main.py."

The script main.py consists of just 3 lines of code

impot os

os.system("\\\\servername\\dir\\file1.bat")
os.system("\\\\servername\\dir\\file2.bat")

Without executing these 2 batch files I cannot proceed to the rest of the coding part.

The file1.bat is the one that sets an environment for the file2.bat to work.

I do not get any error message with file1.bat but the error i get is file2.bat is not recognized as an internal or external command.

So I'm guessing that the execution of file1.bat has failed.


Thanks for the reply.

Reply With Quote
  #5  
Old November 28th, 2012, 09:34 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,458 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 4 Days 6 h 26 m 43 sec
Reputation Power: 403
I apologize for my unclear question.

I meant, what is the command line you use to run file1.bat . Certainly it's not

A:> \\servername\dir\file1.bat

Does file1.bat need execute permission? I haven't written a .bat file in at least 3 years.

Reply With Quote
  #6  
Old November 28th, 2012, 09:41 PM
domsfreekin16 domsfreekin16 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 14 domsfreekin16 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 47 sec
Reputation Power: 0
It is by default

c:\users\dj:> \\servername\dir\file1.bat


I do have execute permission to run the batch files because i did try and execute the file1.bat and file2.bat manually and it works fine.

I also did try and map the network path to z:\file1.bat and try the command

os.system("Z:\\file1.bat")

But still no luck.

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > UNC file execution

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap