Home/Support/Support Forum/not able to upload a file.py
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

not able to upload a file.py

0 votes
Hello,

I'm having some difficulties to upload a python file to the digi W31-l21a
in the browser i have application>python>python files and then "Module search path:" where i put the path for the file "home/nathanforce/workspace/Digi/hello.py"

but when i hit "apply" (there's no upload) he tells me it's "Configuration successfully applied"
then i ssh to the digi and enter "python hello.py" and i get the error :
'import site' failed; use -v for traceback
'import site' failed; use -v for traceback
python: can't open file 'hello.py': [Errno 13] ERROR

how can i know if the file is really loaded ? or is it another probleme ?

thanks in advance.
asked Sep 29, 2016 in Python by digifo New to the Community (2 points)
edited Sep 29, 2016 by digifo

Please log in or register to answer this question.

3 Answers

0 votes
 
Best answer
HI

The python search path is the list of ZIP files that hold any custom librarys.

you will have to transfer the file via FTP,SFTP to the router.

if you want the python to run on reboot you have to add the command

cmd 0 autocmd "python file.py"

but runnign from the command line / serial /telnet /ssh should work for testing and you should see any errors

the transport products do not support normal directry structures and only the USER folder.

regards

James
answered Oct 3, 2016 by James.Wilson Veteran of the Digi Community (1,225 points)
selected Oct 3, 2016 by digifo
Hi James, thanks for your answer it really helped me.

but does it mean there's only the root directory and user directory on the routeur or am i getting it wrong?
if so upgrading the firmware would delete the uploaded lib ?

regards
If you do an upgrade of the router the only files are over writen are the image / sbios / python.zip /wizards.zip

if you use flashwriter to cary out an upgrade of the firmware this erases the flash and all files on the router are wiped

the User folder is there to install user related files and will not corrupt the flash where the system files are stored

regards

James
Ok so no normal directories just the user folder and the "root" if i can call i like that.

Thank you very much
0 votes
after upload the file u need to selection action

if suppose you selected as after reboot the program will run on your device after rebooting only
answered Sep 29, 2016 by csreddy Seasoned Professional (194 points)
well first thanks for your answer
I rebooted the w31 and still get the same error "can't open file 'hello.py': [Errno 13] ERROR"
i think that it's trying to execute it directly from my pc and not uploading it.

am i doing it wrong to upload the file ?

i went to "Appication>Python>python files" and put the link to my python file in the "Module search path".
0 votes
hi
you can try same thing with Digi esp for python v2.3 tool
once. in esp for python example is also available for testing
answered Oct 1, 2016 by csreddy Seasoned Professional (194 points)
...