Earlier quoted context omitted.
Do you have an example snippet you could share?
You just start an http server with python3 -m http.server 8080 and then access the server on the receiving device through its IP address. It’ll show a basic directory listing, and you can download from there.
CLI tools hidden in the Python standard library
61–70 of 160 posts
Re: CLI tools hidden in the Python standard library
#62Earlier quoted context omitted.
There's no magic, only layers. `python -m pdb ` runs pdb with the rest of the arguments. pdb handles the second `-m`. If you have a fancy IDE feature, open a new python file, type "import pdb", use go to definition on pdb to jump to that file in the standard library, and read its main function - it handles -m explicitly :)
Speaking of pdb.. maybe someone knows why pdb has some issues with scope in its REPL that are resolved in VSCode's debugger and PyCharm? Multiline statements are not accepted, nor things like if/for Even list comprehensions and lambda expressions have trouble loading local variables defined via the REPL Are there workarounds? It would reduce the need for using IDEs. People who have experience with Julia and Matlab ar…
Since I still enjoy a cmdline debugger more than a graphical one, I use ipdb, which doesn't suffer from the multiline limitation.
However, scoping issues with lambda and comprehension are actually a Python problem, not a pdb problem.
Re: CLI tools hidden in the Python standard library
#63Earlier quoted context omitted.
It seems like the discussion of whether to document it died in April of 2003: https://mail.python.org/pipermail/python-dev/2003-April/0350... Bummer, it's a cool feature, but I don't feel safe relying on undocumented features.
Especially now that they are on a crusade against their own stdlib. They regret including most modules… it seems they regret making python altogether instead of sticking with C? :D
I also find it odd. Python would probably be a little known language without the huge batteries included by default. It's invaluable when you're working in a environment where you can't fully control what is installed, what is the case of most people at work. I believe this crusade endangers the language long-term.
Re: CLI tools hidden in the Python standard library
#64Earlier quoted context omitted.
Same here, it's also by far the most convenient way I've found to share files between devices on my network.
Wait, how does that work? As far as I can see from the documentation, it can only serve on localhost, which to my understanding is only accessible from the single device it was launched on.
Not near a PC now.
Re: CLI tools hidden in the Python standard library
#65Earlier quoted context omitted.
Same here, it's also by far the most convenient way I've found to share files between devices on my network.
Wait, how does that work? As far as I can see from the documentation, it can only serve on localhost, which to my understanding is only accessible from the single device it was launched on.
Re: CLI tools hidden in the Python standard library
#66Earlier quoted context omitted.
It seems like the discussion of whether to document it died in April of 2003: https://mail.python.org/pipermail/python-dev/2003-April/0350... Bummer, it's a cool feature, but I don't feel safe relying on undocumented features.
Especially now that they are on a crusade against their own stdlib. They regret including most modules… it seems they regret making python altogether instead of sticking with C? :D
There is some discussion about the rationale at https://peps.python.org/pep-0594/#rationale
Re: CLI tools hidden in the Python standard library
#67I use http.server all the time, particularly as modern browsers disable a bunch of functionality if you open file URLs. Had no idea there was so much other stuff here!
Re: CLI tools hidden in the Python standard library
#68 grep -v 'test/' | grep -v 'tests/' | grep -v idlelib | grep -v turtledemo
Becomes: grep -ve 'test/' -e 'tests/' -e idlelib -e turtledemoRe: CLI tools hidden in the Python standard library
#69Earlier quoted context omitted.
Same here, it's also by far the most convenient way I've found to share files between devices on my network.
Wait, how does that work? As far as I can see from the documentation, it can only serve on localhost, which to my understanding is only accessible from the single device it was launched on.
Re: CLI tools hidden in the Python standard library
#70Earlier quoted context omitted.
Wait, how does that work? As far as I can see from the documentation, it can only serve on localhost, which to my understanding is only accessible from the single device it was launched on.
If you serve on localhost you can usually access from other devices by using the "servers" ip address. So if your desktop where you're running the server has ip 192.168.1.10 then you can go to http://192.168.1.10 in the browser of another device on the same network.