Comments (13)
You can just connect to the ESP board before the test and establish the connection manually, then leave the REPL without resetting the board. The connection will stay up as long as you don't reset the board.
The way I do it, I have this module (or a similar version) copied to the board and also a simple JSON configuration file for it in the format show below. Then I just use from netconfig import connect; connect('netconfig.json')
to fire up the connection. You can put that line in boot.py
or, run it manually via the REPL or just insert that line at the top of test/esp/test_ftplib.py
.
{
"ssid": "My WLAN",
"password": "XXXXXXXX",
"timeout": 8
}
from micropython-ftplib.
The code in the current master branch was never tested with the esp32
port. If it works at all, you should use the version of ftplib.py
in the esp8266
directory.
You can also try the new version (with provisional TLS support) in the feature/ftp-over-tls branch.
Here's how I tested this successfully on an ESP32-WROOM dev board:
First shell session (needs pyftpdlib Python package installed):
cd test
./pyftpdlib-server.py -p 2121
Second shell session (connect ESP32 board via USB):
for py in ftplib ftplibtls ftpadvanced; do
mpy-cross esp/${py}.py
rshell -p /dev/ttyUSB0 cp esp/${py}.mpy /pyboard
done
cd test
# assumes WiFi connection is already established
pyboard --device /dev/ttyUSB0 esp/test_ftplib.py
from micropython-ftplib.
Thanks for your response.
I tried using ftplib.py
file in the esp8266
directory but got the error below. I assume this version won't be compatible with my board.
Traceback (most recent call last):
File "<stdin>", line 44, in <module>
File "ftplib.py", line 220, in connect
File "ftplib.py", line 89, in __getattr__
AttributeError: 'socket' object has no attribute 'makefile'
I'll try the new version. Just a question, where should I put the wifi connection code? should I add it to the test_ftplib.py
file or boot.py
?
from micropython-ftplib.
@valenzmanu: How did the feature/ftp-over-tls
branch work out for you?
from micropython-ftplib.
@SpotlightKid sorry for the delay. I tried the feature/ftp-over-tls branch, but got this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "test_ftplib.py", line 5, in <module>
File "ftplib.py", line 160, in __init__
File "ftplib.py", line 220, in connect
File "ftplib.py", line 89, in __getattr__
AttributeError: 'socket' object has no attribute 'makefile'
from micropython-ftplib.
You seem to have an older version of micropython on your ESP32. In newer versions,, usocket.socket
object should have a makefile method:
Are you able to try with a newer firmware version? Preferably a daily build from here:
https://www.micropython.org/download/esp32/
Nevertheless, I should add a workaround for a missing makefile
method like I did in other places of the file. I think the ESP8266 port still needs that. These inconsistencies between the ports can get quite annoying sometimes.
from micropython-ftplib.
Since I'm using this board and not a standalone ESP32, I don't think I can use that build (but not sure). I'm using the v0.5.0 of this micropython port
from micropython-ftplib.
I just pushed a small fix that should allow esp/ftplib.py
to be used with firmware versions where socket.socket.makefile
is not supported.
Obviously I can't test this on your custom board / firmware, so please try it out and let me know, if that works for you.
from micropython-ftplib.
Thanks!
I was able to login:
./pyftpdlib-server.py -p 2121
[I 2020-06-25 14:56:22] concurrency model: async
[I 2020-06-25 14:56:22] masquerade (NAT) address: None
[I 2020-06-25 14:56:22] passive ports: None
[I 2020-06-25 14:56:22] >>> starting FTP server on 0.0.0.0:2121, pid=2963 <<<
[I 2020-06-25 14:56:49] 192.168.0.138:56442-[] FTP session opened (connect)
[I 2020-06-25 14:56:53] 192.168.0.138:56442-[joedoe] USER 'joedoe' logged in.
However, I got an error in this line files = ftp.nlst()
when executing test_ftplib.py
:
File "ftpadvanced.py", line 18, in nlst
File "ftplib.py", line 506, in retrlines
File "ftplib.py", line 434, in ntransfercmd
File "ftplib.py", line 420, in ntransfercmd
File "ftplib.py", line 292, in sendcmd
File "ftplib.py", line 257, in getresp
File "ftplib.py", line 243, in getmultiline
File "ftplib.py", line 235, in getline
EOFError:
MicroPython v0.5.0-95-g05c4e70 on 2020-06-05; Sipeed_M1 with kendryte-k210
Type "help()" for more information.
>>>
from micropython-ftplib.
This indicates that the connection was closed while the client waited for a response to the NLST command. Though it is curious that the server output does not show anything about this. It's hard to say what caused this. I'm a unsure now how to help you further without access to the same firmware or board as you're using.
from micropython-ftplib.
I see, I'll try to debug it. Ultimately what I need is just to upload a .jpg
file, I don't really need the ability to list all the files in the FTP server. I would like to try to upload a file, if it works, would be more than enough for my application.
I saw the test_upload.py
and ftpupload.py
files outside the esp
directory. How can I upload a file using a simple FTP connection? (Not over TLS), should I use the upload
function?
from micropython-ftplib.
should I use the upload function?
Yes. Just make sure that you install / import the right ftplib.py
version.
from micropython-ftplib.
Closing this due to no further feedback. Please feel free to re-open the issue if you have more information.
from micropython-ftplib.
Related Issues (15)
- Cannot import on esp8266 HOT 2
- error when get file sizes HOT 2
- ftp download success, but I dont known where is the file HOT 2
- Trouble installing this on rpi pico 2 w HOT 5
- issues on RPi Pico W HOT 5
- files larger than 5kb cause esp32 to freeze HOT 9
- I can't connect to the ftp server (ESP32-WROOM-32). HOT 4
- Problem with ftp.example.py test HOT 9
- unable to connect to ftp server HOT 5
- FTP_TLS error "extra keyword arguments given" on Pico W (RP2) port HOT 14
- Usage on ESP32 / Error: Could not connect to... HOT 6
- test_ftplib_cmdline.py confuses : of password for port # HOT 1
- ESP32 can't connect to any server HOT 7
- FTPS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micropython-ftplib.