Re: python server socket file transfer

2018-01-10 Thread bingbong3334
On Wednesday, January 10, 2018 at 9:07:33 AM UTC+2, dieter wrote:
> [email protected] writes:
> > how much client can i handel whit this code what the amount of client that 
> > i can handel
> > the size of the file is 716 kb
> > ...
> > self.sock.send(l)
> 
> Please read the documentation for *send* in the "socket" module:
> it tells you that "send" (in contrast to "sendall") is *not* guarantied
> to send the complete *l* (there is no guarantee how much is sent);
> the return value of "send" tells you how many bytes have been sent.


bro i dont ask about if it works or not or what you say is not right i ask how 
much he can handel...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyplot: change the number of x labels (from 6)

2018-01-10 Thread Thomas Jollans
On 2018-01-10 05:22, Paulo da Silva wrote:
> Hi all.
> 
> I want to have dates as major ticks labels of X axis.
> This fragment of code works fine except that I need more dates to appear
> instead the 6 I am getting. The number of dates in dtsd is for ex. 262.
> 
> Thanks for any help.
> 
> BTW, I got most of this code from some site on the internet.
> 
> ...
> fig=plt.figure(figsize=(12,9))
> gs=gridspec.GridSpec(2,1,height_ratios=[4,1])
> ...
> ax0=plt.subplot(gs[0])
> ...
> plt.xlim(-0.1,dts[-1]+0.1)
> dtsd=pd.to_datetime(ds.getIndexes())
> def format_date(x,__pos=None):
>   thisind=np.clip(int(x+0.5),0,dtslen-1)
>   return dtsd[thisind].strftime('%Y-%m-%d')
> ax0.xaxis.set_major_formatter(ticker.FuncFormatter(format_date))
> fig.autofmt_xdate()
> ...
> 


It's a bit hard to tell without a working example, but I think you'll
want to set a tick locator, e.g. something like
ax0.xaxis.set_major_locator(matplotlib.ticker.MultipleLocator(1))

Read this: https://matplotlib.org/api/ticker_api.html

The old-fashioned way would be to set to tick locations manually with
https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.set_xticks.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tips or strategies to understanding how CPython works under the hood

2018-01-10 Thread Robin Becker

http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html
--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


Re: Tips or strategies to understanding how CPython works under the hood

2018-01-10 Thread bartc

On 09/01/2018 20:12, Alain Ketterlin wrote:

ElChino  writes:


Chris Angelico wrote:


CPython is a stack-based interpreter, which means it loads values onto
an (invisible) internal stack, processes values at the top of the
stack, and removes them when it's done.


Is this similar to how Lua operates too?


No. Lua uses a register-based (virtual) machine. See

https://www.lua.org/doc/jucs05.pdf


"Registers are kept in the run-time stack ... an array".

So it sounds like a stack is still used, but instructions directly 
access specific slots on the stack, within a particular register window.


It means there need be fewer instructions to implement some code, but 
each has more operands.


Also interesting is that the comparison operators include only EQ, LT 
and LE. There is no NE, so no issues such as those discussed recently.




I think Lua was the first language in widespread use to move to a
register-based machine.


I believe stack-based byte-code, which is very easy to generate, can be 
transformed to some 'register'-based version, if performance is the 
motivation.


(But I'm not convinced that register-based is necessarily faster. Lua is 
quite fast, especially LuaJIT, but the language is also smaller and 
simpler.)


--
bartc
--
https://mail.python.org/mailman/listinfo/python-list


Simple graphic library for beginners

2018-01-10 Thread Jan Erik Moström
I'm looking for a really easy to use graphic library. The target users 
are teachers who have never programmed before and is taking a first (and 
possible last) programming course.


I would like to have the ability to draw lines, circles, etc. Nothing 
fancy, as little window management as possible (possible buttons), 
perhaps simple events like button presses or clicks on canvas - think: 
making simple diagrams or simple figures. Cross-platform



Yes, I know about tkinter.

Yes, I know about various block languages like Scratch but they are not 
relevant in this case.


Any suggestions?

= jem
--
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Larry Martell
On Wed, Jan 10, 2018 at 7:42 AM Jan Erik Moström 
wrote:

> I'm looking for a really easy to use graphic library. The target users
> are teachers who have never programmed before and is taking a first (and
> possible last) programming course.
>
> I would like to have the ability to draw lines, circles, etc. Nothing
> fancy, as little window management as possible (possible buttons),
> perhaps simple events like button presses or clicks on canvas - think:
> making simple diagrams or simple figures. Cross-platform
>
>
> Yes, I know about tkinter.
>
> Yes, I know about various block languages like Scratch but they are not
> relevant in this case.
>
> Any suggestions?
>

I really like plotly.

>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Thomas Jollans
On 2018-01-10 13:40, Jan Erik Moström wrote:
> I'm looking for a really easy to use graphic library. The target users
> are teachers who have never programmed before and is taking a first (and
> possible last) programming course.
> 
> I would like to have the ability to draw lines, circles, etc. Nothing
> fancy, as little window management as possible (possible buttons),
> perhaps simple events like button presses or clicks on canvas - think:
> making simple diagrams or simple figures. Cross-platform
> 
> 
> Yes, I know about tkinter.
> 
> Yes, I know about various block languages like Scratch but they are not
> relevant in this case.
> 
> Any suggestions?

It depends on what you're planning to do; "simple graphics library" and
"making [...] figures" are two requirements that don't necessarily fit
together perfectly.

Perhaps turtle (https://docs.python.org/3/library/turtle.html) would
suit your needs?

If that's not what you're looking for, just pick any popular library
that does the specific things you want to use in your lesson, and teach
only the relevant bits. If you want (scientific) graphs and figures, go
matplotlib. It's not the nicest library, but it's powerful and
well-represented on stack overflow. If you want buttons and stuff, go
for PyQt or Tkinter. Both are messy and complicated, and Tkinter looks
terrible by default, but that's just the way it is.


-- Thomas
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread breamoreboy
On Wednesday, January 10, 2018 at 12:42:07 PM UTC, Jan Erik Moström wrote:
> I'm looking for a really easy to use graphic library. The target users 
> are teachers who have never programmed before and is taking a first (and 
> possible last) programming course.
> 
> I would like to have the ability to draw lines, circles, etc. Nothing 
> fancy, as little window management as possible (possible buttons), 
> perhaps simple events like button presses or clicks on canvas - think: 
> making simple diagrams or simple figures. Cross-platform
> 
> 
> Yes, I know about tkinter.
> 
> Yes, I know about various block languages like Scratch but they are not 
> relevant in this case.
> 
> Any suggestions?
> 
> = jem

Take a look at https://python-sfml.org/, https://www.ogre3d.org/about or 
mcsp.wartburg.edu/zelle/python/graphics.py

--
Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Arthur Endlein Correia
Tkinter can look nice and not terribly hard to use, as I found out in this
tutorial:
http://www.tkdocs.com/tutorial/onepage.html
Having said that, nowadays I pretty much always use PyQt (or Pyside)
together with qtdesigner to build GUI applications.




---
Arthur Endlein Correia
[email protected]
[email protected]
55 11 968 606 174
IGc, USP

On Wed, Jan 10, 2018 at 12:08 PM,  wrote:

> On Wednesday, January 10, 2018 at 12:42:07 PM UTC, Jan Erik Moström wrote:
> > I'm looking for a really easy to use graphic library. The target users
> > are teachers who have never programmed before and is taking a first (and
> > possible last) programming course.
> >
> > I would like to have the ability to draw lines, circles, etc. Nothing
> > fancy, as little window management as possible (possible buttons),
> > perhaps simple events like button presses or clicks on canvas - think:
> > making simple diagrams or simple figures. Cross-platform
> >
> >
> > Yes, I know about tkinter.
> >
> > Yes, I know about various block languages like Scratch but they are not
> > relevant in this case.
> >
> > Any suggestions?
> >
> > = jem
>
> Take a look at https://python-sfml.org/, https://www.ogre3d.org/about or
> mcsp.wartburg.edu/zelle/python/graphics.py
>
> --
> Kindest regards.
>
> Mark Lawrence.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Antoon Pardon
On 10-01-18 13:40, Jan Erik Moström wrote:
> I'm looking for a really easy to use graphic library. The target users
> are teachers who have never programmed before and is taking a first
> (and possible last) programming course.
>
> I would like to have the ability to draw lines, circles, etc. Nothing
> fancy, as little window management as possible (possible buttons),
> perhaps simple events like button presses or clicks on canvas - think:
> making simple diagrams or simple figures. Cross-platform
>
>
> Yes, I know about tkinter.
>
> Yes, I know about various block languages like Scratch but they are
> not relevant in this case.
>
> Any suggestions?
>
> = jem

cairo?

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread bartc

On 10/01/2018 14:55, Antoon Pardon wrote:

On 10-01-18 13:40, Jan Erik Moström wrote:

I'm looking for a really easy to use graphic library. The target users
are teachers who have never programmed before and is taking a first
(and possible last) programming course.

I would like to have the ability to draw lines, circles, etc. Nothing
fancy, as little window management as possible (possible buttons),
perhaps simple events like button presses or clicks on canvas - think:
making simple diagrams or simple figures. Cross-platform


Yes, I know about tkinter.

Yes, I know about various block languages like Scratch but they are
not relevant in this case.

Any suggestions?

= jem


cairo?


Isn't that output only? (And not necessarily to a screen, but to an 
image or PDF for example.)


So that no interaction is possible.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread oliver
Pyqt without hesitation.

   - I've used it in full-fledged desktop app (120k LOC) and it's just
   awesome, so well documented, versatile, and you can learn gradually
   (starting with their simpler tablewidget then later move to their
   tableview/model for added flexibility).
   - Qt is moving so fast into iot and automotive and is so popular on
   desktops, that it's a skill that gets noticed on resumes or in interviews
   (i'm talking from first hand experience).
   - It is available in multiple languages like Java, Go and C#, although I
   have not used those wrappers (the PyQt wrapper is based on sip, whereas
   these other ones are not, so I have no idea about stability etc).
   - the community is huge, there are powerful tools like pytest.qt plugin
   for unit testing GUI, pycharm IDE integrates with it.
   - there is dual license based on LGPL and commercial, with reasonable
   costs, perfect for learning/startup then eventually (if that's the goal
   medium or long term) distribute/sell.

Oliver

On Wed, 10 Jan 2018 at 10:46 bartc  wrote:

> On 10/01/2018 14:55, Antoon Pardon wrote:
> > On 10-01-18 13:40, Jan Erik Moström wrote:
> >> I'm looking for a really easy to use graphic library. The target users
> >> are teachers who have never programmed before and is taking a first
> >> (and possible last) programming course.
> >>
> >> I would like to have the ability to draw lines, circles, etc. Nothing
> >> fancy, as little window management as possible (possible buttons),
> >> perhaps simple events like button presses or clicks on canvas - think:
> >> making simple diagrams or simple figures. Cross-platform
> >>
> >>
> >> Yes, I know about tkinter.
> >>
> >> Yes, I know about various block languages like Scratch but they are
> >> not relevant in this case.
> >>
> >> Any suggestions?
> >>
> >> = jem
> >
> > cairo?
>
> Isn't that output only? (And not necessarily to a screen, but to an
> image or PDF for example.)
>
> So that no interaction is possible.
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
Oliver
My StackOverflow contributions
My CodeProject articles
My Github projects
My SourceForget.net projects
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Michael Torrie
On 01/10/2018 09:16 AM, oliver wrote:
> Pyqt without hesitation.

Except that people are forgetting the OP is not asking about a GUI
library. The subject line reads "Simple graphic[s] library for
beginners."  He just wants a simple graphics drawing library for
beginners.  Create a canvas of a certain size, draw lines, circles, and
other primitives to it.

PyQt can do all these things, but it's overkill for what the OP requires.

Personally I recommend he look at PyGame, or SDL with PySDL2.  Both of
these libraries are designed to do what the OP is asking.  I recently
needed to do some very simple line drawing to visualize a GPS path, and
I found PyGame worked rather well, and was nearly as simple as the old
QuickBasic graphics routines.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Igor Korot
 Hi,
wxPython/Phoenix.
It can do everything you need and more


And it will look exactly as any other application on the system...

Thank you.


On Wed, Jan 10, 2018 at 11:04 AM, Michael Torrie  wrote:
> On 01/10/2018 09:16 AM, oliver wrote:
>> Pyqt without hesitation.
>
> Except that people are forgetting the OP is not asking about a GUI
> library. The subject line reads "Simple graphic[s] library for
> beginners."  He just wants a simple graphics drawing library for
> beginners.  Create a canvas of a certain size, draw lines, circles, and
> other primitives to it.
>
> PyQt can do all these things, but it's overkill for what the OP requires.
>
> Personally I recommend he look at PyGame, or SDL with PySDL2.  Both of
> these libraries are designed to do what the OP is asking.  I recently
> needed to do some very simple line drawing to visualize a GPS path, and
> I found PyGame worked rather well, and was nearly as simple as the old
> QuickBasic graphics routines.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Michael Torrie
On 01/10/2018 10:22 AM, Igor Korot wrote:
>  Hi,
> wxPython/Phoenix.
> It can do everything you need and more

But the OP isn't looking for a full-blown GUI toolkit.  I went back and
re-read his post to be sure I wasn't misunderstanding.  Therefore I
don't think the suggestion to use wxPython or PyQt is that helpful.

Do you have any other suggestions?

Even Cairo is pretty complicated (requiring pens and contexts) for what
he's asking for.

Personally I don't think it gets much easier or simpler than this sort
of thing:
https://github.com/Mekire/pygame-samples
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Arthur Endlein Correia
Yes, considering the OP request, pygame would be better, or one of Mark's
suggestions:
mcsp.wartburg.edu/zelle/python/graphics.py
Seems really easy to use.



---
Arthur Endlein Correia
[email protected]
[email protected]
55 11 968 606 174
IGc, USP

On Wed, Jan 10, 2018 at 3:36 PM, Michael Torrie  wrote:

> On 01/10/2018 10:22 AM, Igor Korot wrote:
> >  Hi,
> > wxPython/Phoenix.
> > It can do everything you need and more
>
> But the OP isn't looking for a full-blown GUI toolkit.  I went back and
> re-read his post to be sure I wasn't misunderstanding.  Therefore I
> don't think the suggestion to use wxPython or PyQt is that helpful.
>
> Do you have any other suggestions?
>
> Even Cairo is pretty complicated (requiring pens and contexts) for what
> he's asking for.
>
> Personally I don't think it gets much easier or simpler than this sort
> of thing:
> https://github.com/Mekire/pygame-samples
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pyplot: change the number of x labels (from 6)

2018-01-10 Thread Paulo da Silva

Às 09:17 de 10-01-2018, Thomas Jollans escreveu:

On 2018-01-10 05:22, Paulo da Silva wrote:

Hi all.


...



It's a bit hard to tell without a working example, but I think you'll
want to set a tick locator, e.g. something like
ax0.xaxis.set_major_locator(matplotlib.ticker.MultipleLocator(1))


Basically I have a list of hundred of dates (one per point) and I want 
few of them, to fill the X axis. This should be simple!
The code I have (too complex for the task, btw), from the internet, does 
exactly that, including presenting them 45º oriented, but only presents 
5 or 6 dates. I want more, perhaps 12.




Read this: https://matplotlib.org/api/ticker_api.html

The old-fashioned way would be to set to tick locations manually with
https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.set_xticks.html


Yes, I need to look at this ...

Thank you.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Igor Korot
 Hi, Michael,

On Wed, Jan 10, 2018 at 11:36 AM, Michael Torrie  wrote:
> On 01/10/2018 10:22 AM, Igor Korot wrote:
>>  Hi,
>> wxPython/Phoenix.
>> It can do everything you need and more
>
> But the OP isn't looking for a full-blown GUI toolkit.  I went back and
> re-read his post to be sure I wasn't misunderstanding.  Therefore I
> don't think the suggestion to use wxPython or PyQt is that helpful.

Completely agree.
However people started throwing PyQt for some unknown reason, so I had to
respond. ;-)

Thank you.

>
> Do you have any other suggestions?
>
> Even Cairo is pretty complicated (requiring pens and contexts) for what
> he's asking for.
>
> Personally I don't think it gets much easier or simpler than this sort
> of thing:
> https://github.com/Mekire/pygame-samples
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread bartc

On 10/01/2018 17:36, Michael Torrie wrote:

On 01/10/2018 10:22 AM, Igor Korot wrote:

  Hi,
wxPython/Phoenix.
It can do everything you need and more


But the OP isn't looking for a full-blown GUI toolkit.  I went back and
re-read his post to be sure I wasn't misunderstanding.  Therefore I
don't think the suggestion to use wxPython or PyQt is that helpful.

Do you have any other suggestions?

Even Cairo is pretty complicated (requiring pens and contexts) for what
he's asking for.

Personally I don't think it gets much easier or simpler than this sort
of thing:
https://github.com/Mekire/pygame-samples


I couldn't see anything obviously simple there. A lot seems to do with 
interaction which is always much more complicated than just drawing stuff.


'Turtle' will do it (assuming there's a way of drawing things without 
having to watch an actual turtle symbol crawling around the screen).



One simple library of my own (not for Python) would use one function 
call to create a window, and another to draw an element (say, a box) 
within that window. (Plus a third to keep it on the screen otherwise it 
will disappear when the program terminates.)


The only way to get it simpler than that is where the display window is 
always present (like some old Basics).



--
bartc
--
https://mail.python.org/mailman/listinfo/python-list


Simple graphic library for beginners

2018-01-10 Thread Mikhail V
> > But the OP isn't looking for a full-blown GUI toolkit.  I went back and
> > re-read his post to be sure I wasn't misunderstanding.  Therefore I
> > don't think the suggestion to use wxPython or PyQt is that helpful.
> >
> > Do you have any other suggestions?
> >
> > Even Cairo is pretty complicated (requiring pens and contexts) for what
> > he's asking for.
> >
> > Personally I don't think it gets much easier or simpler than this sort
> > of thing:
> > https://github.com/Mekire/pygame-samples
>
> I couldn't see anything obviously simple there. A lot seems to do with
> interaction which is always much more complicated than just drawing stuff.
>
> 'Turtle' will do it (assuming there's a way of drawing things without
> having to watch an actual turtle symbol crawling around the screen).
>

That's right. Cairo, IIRC is mainly used as a rasterizer backend, so it
is not what OP wants.

Pygame is a SDL wrapper (a low-level lib), and NOT a wrapper for
GUI widgets. Almost everything must be made from ground up -
keyborad/mouse input, buttons (OP told about buttons).

So there not even such thing as "button" there - Pygame has nothing
of that high-level concept by default, so it will require an 3d party
module that implements those.

But, for *programming* classes, I personally would still recommend Pygame.

As for something quick and simple, Turtle seems to be good.

BTW - openCV is an excellent lib for drawing and image manipulation.
It has tons of ready-to-use functions and can show things up in a
window without additional coding.
But again: if you want *buttons*, then you are merely speaking about
a framework, not a lib. IOW if you drop the beloved by
people "buttons" idea, then you have much more good options.

PyQT is probably overkill, but it has a tool for GUI construction (qtdesigner)
and it makes it child-easy to draw a window with buttons, and some
canvas object, and then auto-creates pieces of code with objects and
interaction slots. So PyQT is imo better option for noobs than Pygame.
So here you have buttons and lots of OOP bloat as a consequence.



Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tips or strategies to understanding how CPython works under the hood (Posting On Python-List Prohibited)

2018-01-10 Thread bartc

On 10/01/2018 23:31, Lawrence D’Oliveiro wrote:

On Thursday, January 11, 2018 at 1:08:25 AM UTC+13, bartc wrote:


But I'm not convinced that register-based is necessarily faster.


Not if your code is dominated by memory accesses, as a dynamic language is 
likely to be. But ask the people who design machine architectures, and who 
write compilers for them for languages like C--they’ll tell you it makes a 
helluva difference.



I'm not sure what you mean here. The subject is byte-code interpreters 
not statically compiled languages running native code, which are 
obviously better off using real hardware registers.


The 'registers' in this example - for actual byte-code execution not 
what happens in pypy and LuaJIT - don't appear to be actual hardware 
registers. They can't be when an implementation is 100% high level code.


They are just a different scheme to address instruction operands stored 
in memory, which can offer some advantages, with a few downsides.



(I've been writing byte-code interpreters for stack-based VMs for years. 
I've never had much luck moving away from that model.


At the moment they generally run the same algorithms a bit faster than 
register-based Lua, but can also be trivially accelerated to be several 
times faster, while still executing sequential byte-code.


Not as fast as LuaJIT, but what goes on in that is beyond the methods 
discussed here for CPython and such.)



--
bartc
--
https://mail.python.org/mailman/listinfo/python-list


Pandas printing in jupyter

2018-01-10 Thread Rustom Mody
If I make a data-frame in pandas in jupyter notebook it prints very nicely
ie it looks quite like a spreadsheet

How does it do it?
Who does it?

The data-frame does not seem to have str/repr methods…
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple graphic library for beginners

2018-01-10 Thread Michael Torrie
On 01/10/2018 01:13 PM, bartc wrote:
> I couldn't see anything obviously simple there. A lot seems to do with 
> interaction which is always much more complicated than just drawing stuff.

Yes the link didn't have the simple examples I hoped for.  How's this:
-
import pygame
import time

pygame.init()
screen = pygame.display.set_mode((1024, 768) )
red = (255,0,0)
green = (0,255,0)

screen.fill( (255,255,255) )
pygame.draw.lines(screen, red, False, ((0,0),(100,100)))
pygame.draw.lines(screen, green, False, ((0,100),(100,0)))
pygame.display.update()

time.sleep(5)
pygame.quit()
--

PyGame has other primitives like circles, ellipses, etc.  Much like the
old BASIC graphics primitives.

> 'Turtle' will do it (assuming there's a way of drawing things without 
> having to watch an actual turtle symbol crawling around the screen).

Yes I think it can.

> One simple library of my own (not for Python) would use one function 
> call to create a window, and another to draw an element (say, a box) 
> within that window. (Plus a third to keep it on the screen otherwise it 
> will disappear when the program terminates.)

Are you thinking of sprites?

> The only way to get it simpler than that is where the display window is 
> always present (like some old Basics).

This is sort of similar to PyGame's concepts.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python server socket file transfer

2018-01-10 Thread dieter
[email protected] writes:

> On Wednesday, January 10, 2018 at 9:07:33 AM UTC+2, dieter wrote:
>> [email protected] writes:
>> > how much client can i handel whit this code what the amount of client that 
>> > i can handel
>> > the size of the file is 716 kb
>> > ...
>> > self.sock.send(l)
>> 
>> Please read the documentation for *send* in the "socket" module:
>> it tells you that "send" (in contrast to "sendall") is *not* guarantied
>> to send the complete *l* (there is no guarantee how much is sent);
>> the return value of "send" tells you how many bytes have been sent.
>
>
> bro i dont ask about if it works or not or what you say is not right i ask 
> how much he can handel...

This depends on implementation details of your network package (and maybe
other even less stable things). Thus, there is no reliable anwser
to your question.

And you do not need an anwser: use "sendall" or look on the "send"
return value to learn how much has been transmitted (and use subsequent
"send"'s to transmit the rest).


-- 
https://mail.python.org/mailman/listinfo/python-list