Jump to content

Welcome, Guest!

Be a part of CinemaVision today! Once registered and logged in, you will have access to public chat and your own private messenger, you can view and contribute guides, collaborate on the forums, review downloads, give reputation to your fellow members, contribute content and so much more. Registering is quick and completely free, so what are you waiting for?
   Sign In    Sign Up

Become a RedCarpet Club Member Today!

   Join Now
  • 0
ambro93

open python files automatically

Question

Hello everyone

I created a python script for communication with a crestron home automation processor and if started with python luncher it works perfectly.

from cinema vision I tried to run it both as python: /// as well as as command: /// but it does not work

the Python visualization test: ///script.py is OK but does not run the file when it launches it ...


the test with the command: //script.py returns an os error

the system is running on a macbook pro

the lunch files and the script are in the same directory


what am I doing wrong? I would simply use a correct string to launch a file


P.S. attached the image of the error

thank you so much
Ambrosini Andrea

Screenshot 2017-10-23 14.09.06.png

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
14 hours ago, ambro93 said:

Hello everyone

I created a python script for communication with a crestron home automation processor and if started with python luncher it works perfectly.

from cinema vision I tried to run it both as python: /// as well as as command: /// but it does not work

the Python visualization test: ///script.py is OK but does not run the file when it launches it ...


the test with the command: //script.py returns an os error

the system is running on a macbook pro

the lunch files and the script are in the same directory


what am I doing wrong? I would simply use a correct string to launch a file


P.S. attached the image of the error

thank you so much
Ambrosini Andrea

Screenshot 2017-10-23 14.09.06.png

Hey there! From what I can tell, that's not a problem with your script, but rather an issue with permissions from your OS. Make sure that the scripts are in a directory that everyone can execute from, and that nothing is blocking python scripts from running at the OS level. I'm not sure if there are security settings on a Mac that prevent Python scripts from running or being called like that, but maybe this documentation will help.

Share this post


Link to post
Share on other sites
  • 0

Thank you very much for your answer

this morning I tried to solve that mistake positively, or at least I was hoping


I solved the error [permission denied] error 13 using the command from the terminal: sudo chmod 777 python "python" is the folder created in the main user


then I had an error 8 [Exec format error] and I solved adding the formula to the script: #! / usr / bin / env python


now .... throwing the test or the automation from cinemavision does not give me any errors but does not launch the script and does not do any action ... I do not know where the error is now


* lunch file: lunch.cvaction

command: //script.py or test with python: //script.py


script.py: is a simple launch of the message in tcp


#! / usr / bin / env python
import socket
import sys


def get_constants (prefix):
    "" "Create a dictionary mapping socket module
    constants to their names.
    "" "
    return {
        getattr (socket, n): n
        for n in dir (socket)
        if n.startswith (prefix)
    }


families = get_constants ('AF_')
types = get_constants ('SOCK_')
protocols = get_constants ('IPPROTO_')

# Create a TCP / IP socket
sock = socket.create_connection (('192.168.178.80', 49152))

print ('Family:', families [sock.family])
print ('Type:', types [sock.type])
print ('Protocol:', protocols [sock.proto])
print ()

try:

    # Send data
    message = b'ciao '
    print ('sending {! r}'. format (message))
    sock.sendall (message)

finally:
    print ('closing socket')
    sock.close ()

Share this post


Link to post
Share on other sites
  • 0

now I tried to run the script in the sequence but with the unusual command:

module: //script.py

despite an error executing the script by launching the message I want ... however, the operation works only once, both in test and in sequence ... I also tried to create multiple launch files and scripts with different names but the result is the same ... only executes the first script in sequence and then nothing

I'm sure the command module is wrong to start the script but it nevertheless gave life signs hahahxD

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines and Terms of Use.