IronPython and usb device on CentOS

General support questions
Post Reply
Prospect
Posts: 2
Joined: 2021/02/09 11:23:37

IronPython and usb device on CentOS

Post by Prospect » 2021/04/15 09:48:20

I have trouble with using usb device in linux centos 7 with aspnet core 3.1 and IronPython. I have:

a. Python script, which work fine, when i execute it by root.

Code: Select all

#!/usr/bin/python

import sys
sys.path.append("/usr/lib64/python2.7/")
import os
import time

class sender:
    def send(self, device,  message):
        fd = os.open(device, os.O_RDWR)
        print(device)
        print(length)
        print(message)
        print(fd)
        time.sleep(1)
        os.write(fd, "AT+CMGF=0\r\n")
        time.sleep(1)    
        os.write(fd, "AT+CMGS=" + length + "\r\n")
        time.sleep(1)
        os.write(fd, message + "\032\r\n")
        os.close(fd)
def main(argv):
    print("here")
    senderInstance = sender()
    senderInstance.send(argv[1], argv[2], argv[3])
    return 0

if __name__ == '__main__': main(sys.argv)
b. asp net core application with iron python, which execute script:

#!/usr/bin/python

import sys
sys.path.append("/usr/lib64/python2.7/")
import os
import time

class sender:
    def send(self,device,length,message):
        print("start")
        print(device)
        print(length)
        print(message)
        fd = os.open(device, os.O_RDWR)
        print(fd)
        time.sleep(1)
        os.write(fd, "AT+CMGF=0\r\n")
        time.sleep(1)
        os.write(fd, "AT+CMGS=" + length + "\r\n")
        time.sleep(1)
        os.write(fd, message + "\032\r\n")
        os.close(fd)
        print("stop")
When i execute first script, i got sms When i execute second script via asp net core application, i can see in journalctl those prints, but no sms.

This is ps aux output:
YourTexasBenefits
ps aux | grep service
apache 2618 1.0 4.2 3008012 79932 ? SLsl 13:38 0:01 /usr/bin/dotnet /opt/service/Service.dll
So, i added apache user to dialout group, but it didn't work. What am i doing wrong?

Thank you.
Last edited by Prospect on 2021/04/16 12:17:05, edited 2 times in total.

BShT
Posts: 415
Joined: 2019/10/09 12:31:40

Re: IronPython and usb device on CentOS

Post by BShT » 2021/04/15 16:45:16

Centos 8 came with python3

python --version
Python 3.6.8

User avatar
TrevorH
Forum Moderator
Posts: 30670
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: IronPython and usb device on CentOS

Post by TrevorH » 2021/04/15 17:45:08

Moved to the CentOS 7 forum since the OP clearly states that they are running 7 not 8.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - General Support”