Odoo Help

0

Is it possible to call .bat files from a module?

By
Cole
on 8/25/15, 5:59 AM 680 views

Hello, I have a module that use a .exe application to generate some csv.

To call it I use subprocess, like this:

from subprocess import * 

def test(self, cr, uid, ids, context={}):

subproc = Popen([C:\gen.exe], stdout=PIPE, stderr=PIPE)
(out, err) = subproc.communicate()

return True

And it's working.

Now I'm trying to do the same thing with .bat files, but I can't make it work.

This code works in python:

import subprocess 
subprocess.Popen('C:\test.bat')

but once loaded in a module function, the bat file it's not executed.

Is there a way to execute batchs from odoo?

Any help is appreciated


EDIT:

The problem was the command "@echo off" in bat file at the start of the program.

Removing it, odoo can execute the file.



1

Axel Mendoza

--Axel Mendoza--
11073
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 8/25/15, 7:08 AM

you could find an answer here

http://stackoverflow.com/a/1818902 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 8/25/15, 5:59 AM
Seen: 680 times
Last updated: 8/31/15, 3:27 AM