Run python script remotely using screen - python-2.7

I am using intel upboard as remote machine and MacBook (using Ubuntu Linux) as my local machine.
I have python script A.py on local machine which has some variables (lets say a and b). I want to pass the values of the variables to remote file lets say B.py which is on the remote machine (intel upboard).
Can anyone please tell me how to do it?
I am using the following line of code to accomplish this, but its neither carrying the values of the variables neither its doing anything after getting into upboard.
File A.py on MacBook contains the following line of code
os.system('screen /dev/ttyUSB0 baudrate\'python B.py {} {}\''.format(x,y))

Related

OpenOCD how to flash local file to remote target?

(Using STM32F767 microcontroller)
I have a remote debugging environment setup on a RPI using OpenOCD. I can connect to it just fine using GDB.
However since I am writing a bootloader I need to flash the firmware to a specific offset in flash memory. E.g bootloader starts at 0x800000 and firmware should start at 0x8010000 for example so the offset would be (0x10000).
This works fine locally using: mon flash write_bank 0 main.bin 0x10000
But since I don't have the main.bin in the RPI, is there a way I could use OpenOCD or GDB to specify my local file instead and that would be sent over the remote connection?
Note that I would not like to setup a FTP and thus am looking for an alternate solution.
Best regards
gdb should supports sending files to remote via the 'remote put '. But, when I try this in gdb, I get the response "Remote I/O error: Function not implemented". Seems like OpenOCD does not support this
Use "file" to select the file and then "load" will send the file across to the device.

Cannot require luacom library in lua script

I am new to Lua programming language. I installed Lua for Windows v5.1.5-52. I want to use luacom library to run shell script. Here is my code,
local luacom = require('luacom');
local shell = luacom.CreateObject("WScript.Shell")
shell:Run ('echo 123', 0)
which throws the following error:
lua: COM exception:(.\src\library\tLuaCOM.cpp,398):The system cannot
find the file specified.
I looked for tLuaCOM.cpp file, but could not find it, not even folder src. Though I found luacom.dll in clibs folder.
Is there any workaround with this problem?
tLuaCOM.cpp is a luacom source file, so it's probably not on your PC, except you've build it yourself.
The error comes from one of the calls - either CreateObject() or Run.
The Run Method (Windows Script Host) helps says that it starts processes:
The Run method starts a program running in a new Windows process.
but echo is a shell command, not an executable, so you have to start an instance of the Windows command interpreter and pass your command like:
shell:Run('cmd /c "echo 123"')

Run a C++ executable in Matlab from SSH server

I'm trying to run an executable, generated from C++ code, in Matlab.
To do this I use the command
system('unset LD_LIBRARY_PATH; /home/Documents/ServerFolder/ExecutableFiles/program_23 argument');
where program_23 is the executable generated by the C++ code.
When I do that in Ubuntu, it works perfectly fine.
The problem arise when I do that from a SSH server (i.d. calling Matlab from a server, but running the exact same script that works in Ubuntu).
In particular, if I add
[status,cmdout] = system('unset LD_LIBRARY_PATH; /home/Documents/ServerFolder/ExecutableFiles/program_23 argument');
I can see that status is different from 0, meaning a failure of the system command.
Does anyone have any idea on how to make this work?
Thank you

Python subprocess is unstable on Windows 10?

p = subprocess.Popen([executable_file])
This is only code that I am using to run the python subprocess. However, it has unknown issue that cause my program cannot open the executable file as expected.
executable_file is one file link (PATH) that locate executable program.
Ex. C:\Users\SharkIng\Dev\WhatEverSystem\Builds\Windows\program-123456789-123456789.exe
The python subprocess.Popen should run the program. However, sometime it works and sometime it is not (I did not change any code between this two situation)
OS: Windows 10
Python: 2.7.*
Error: [Error 2] The system cannot find the file specified
BUT: It is working if you manually run subprocess.Popen([executable_file_path_string]) (with same file and path) it work.
WHY this happen?? Is that because some problem with Windows Python? or it is because my setting mess me up?
UPDATE: It is not some reason such as NOT FULL PATH. I can have it working with exact same code. If I ran same code in a python shell, by typing each line of code. It works. But if I put exact same code in a .py file and run it with python file.py, it showing the error
UPDATE 2: Another team member have same error with Windows 7 and Python 2.7.* This code used to work this morning. AGAIN I didn't change anything. That is way I am asking if it is unstable.
There is no problem with subprocess. If you want to run a specified executable, you need to give the full path to that file. The most likely reason you're seeing variable behavior is that sometimes you're in the directory with the .exe, and other times you're not.

using gdb debug ath5k driver over serial cable

I set up following this guide: http://www.linuxforu.com/2011/03/kgdb-with-virtualbox-debug-live-kernel/
but instead of using the virtual machine, I use 2 real machine:
- one is debugger
- second one is target (with equipped wireless card running ath5k driver)
On the debugger machine, I successfully come into
$gdb
(gdb)target remote /dev/ttyS0
step. Then I use command (gdb)add-symbol-file but there is no /lib/modules/3.9.0/kernel/drivers/net/wireless/ath/ath5k/ath5k.ko
Are there any wrong in this methodology?
I want to debug the ath5k module so do I need to #gdb vmlinux in the fist place?