Re: making executables smaller

2016-07-27 Thread Daniel Bradburn
A couple of things you can try:

* Generate a directory rather than onefile, on the directory you can apply du
-hs * | sort -h -r (or treesize if you are using windows
https://www.jam-software.com/treesize_free) to see which folders / files
are taking up a lot of space. Then once you see what is taking up a lot of
space you can try and figure out why it is being included, maybe you have a
load of unused imports? With pyinstaller you can explicitly exclude modules
you know you won't need with --exclude-module once you've optimised the
directory build you can of course switch back to onefile

* If all else fails you can use upx to compress your binary files (dlls +
exe) which can help reduce the overall size:
https://pythonhosted.org/PyInstaller/usage.html#using-upx

Hope this helps.


2016-07-27 10:20 GMT+02:00 Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info>:

> On Wednesday 27 July 2016 14:52, Thomas 'PointedEars' Lahn wrote:
>
> > Carter Temm wrote:
> >
> >> I’m writing a couple different projects at the moment, and when I
> compile
> >> it into a single executable using pyinstaller, it becomes extremely
> large.
> >> I’m guessing this is because of the modules used. Because I’m not that
> >> skilled at python, I put stuff like for example, import sys. I imagine
> the
> >> final project could be made smaller by specifying from something import
> >> something_else. but the thing is, I don’t know what smaller I could
> import
> >> with these set of modules. Is there a program that could tell me this.
> >
> > I recommend to comment out all “import” statements (for later reference)
> and
> > then use a Python editor like PyDev to generate step by step “from …
> import
> > …” statements for all used symbols that are not yet defined.
>
> What benefit do you think you will gain from changing (let's say):
>
> import collections
> x = collections.deque(foo)
>
> to:
>
> from collections import deque
> x = deque(foo)
>
>
> as far as executable size goes? Do you think that by using
> from...import... the
> module, and all of its dependencies, won't need to be included?
>
> Or are you just trying to save a handful of bytes ("collections.deque" in
> UTF-8
> is 17 bytes, compared to "deque" is just 5 bytes)?
>
>
> Since the OP is talking about saving space, how much space do you expect
> to be
> able to save using this technique?
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gevent

2016-05-16 Thread Daniel Bradburn
Hi Larry,

I'm afraid I don't have any experience using gevent with wsgi, perhaps you
could try posting directly on the Google group
https://groups.google.com/forum/#!forum/gevent

On Mon, 16 May 2016, 20:28 Larry Martell, <larry.mart...@gmail.com> wrote:

> I don't see it either. I posted it twice - May 3 and May 14. I did it
> from email - does that group not accept email postings? I didn't get a
> bounce though.
>
> Here is my post:
>
> I have a python server that has this in the main:
>
> from gevent import pywsgi
>
> try:
> httpd = pywsgi.WSGIServer(('0.0.0.0', 8000), app)
> httpd.serve_forever()
> except KeyboardInterrupt:
> pass
>
> Recently we began getting HTTPError: 504 Server Error: Gateway
> Time-out on requests to the server. Looking in the logs I saw this:
>
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line
> 508, in handle_one_response
> self.run_application()
>   File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line
> 495, in run_application
> self.process_result()
>   File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line
> 486, in process_result
> self.write(data)
>   File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line
> 380, in write
> self._write_with_headers(data)
>   File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line
> 400, in _write_with_headers
> self._sendall(towrite)
>   File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line
> 355, in _sendall
> self.socket.sendall(data)
>   File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line
> 460, in sendall
> data_sent += self.send(_get_memory(data, data_sent), flags)
>   File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line
> 437, in send
> return sock.send(data, flags)
> error: [Errno 32] Broken pipe
> {'GATEWAY_INTERFACE': 'CGI/1.1',
>  'HTTP_ACCEPT': '*/*',
>  'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
>  'HTTP_CONNECTION': 'close',
>  'HTTP_HOST': 'foo.bar.com',
>  'HTTP_USER_AGENT': 'python-requests/2.9.1',
>  'HTTP_X_FORWARDED_FOR': '192.168.10.5',
>  'HTTP_X_REAL_IP': '192.168.10.5',
>  'PATH_INFO': '/readings',
>  'QUERY_STRING': 'target=2225217193085335062=HM',
>  'REMOTE_ADDR': '172.17.42.1',
>  'REMOTE_PORT': '41708',
>  'REQUEST_METHOD': 'GET',
>  'SCRIPT_NAME': '',
>  'SERVER_NAME': 'fdffcd119506',
>  'SERVER_PORT': '8000',
>  'SERVER_PROTOCOL': 'HTTP/1.0',
>  'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7',
>  'wsgi.errors': ', mode 'w' at 0x7f4c299bc1e0>,
>  'wsgi.input': ,
>  'wsgi.multiprocess': False,
>  'wsgi.multithread': False,
>  'wsgi.run_once': False,
>  'wsgi.url_scheme': 'http',
>  'wsgi.version': (1, 0)} failed with error
>
> Once this occurs it seems that no further requests are served. I
> googled this and found many places where people said this was
> happening, and many places where people explained why it was
> happening, but no place did I find a way to fix or workaround this.
>
> Does anyone know how to get it to continue processing after this occurs?
>
> On Mon, May 16, 2016 at 2:15 PM, Daniel Bradburn <moags...@gmail.com>
> wrote:
> > Hi Larry
> >
> > When did you post the query to the gevent list? I don't see it on
> > gev...@googlegroups.com
> >
> > My perception is that gevent is fairly widely used although I don't have
> any
> > stats, see for example http://www.gevent.org/success.html. Personally
> it is
> > my go to library whenever I need async networking in python.
> >
> > What was the question you wanted answering?
> >
> > On 16 May 2016 7:39 p.m., "Larry Martell" <larry.mart...@gmail.com>
> wrote:
> >>
> >> Does anyone here use gevent? I posted a question on the gevent mailing
> >> list, here, and on SO and did not get any replies on any of them. I
> >> have a client that is using it - I had never heard of it before, and
> >> now I am wondering how big the user base and community is.
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Downloading Python

2015-10-06 Thread Daniel Bradburn
Hi Sharon,

Here are the links for the Python 3.4.2 downloads:

https://www.python.org/downloads/release/python-342/#download

Regards


2015-10-06 6:49 GMT+02:00 Sharon MOrine :

> Hello:
> Can you please tell me how to download python 3.4.2 (or .3)?   I am new to
> programming and the website is confusing and my eyesight isn't that great.
> Thanks!
> --
> https://mail.python.org/mailman/listinfo/python-announce-list
>
> Support the Python Software Foundation:
> http://www.python.org/psf/donations/
>
-- 
https://mail.python.org/mailman/listinfo/python-list