Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Steven D'Aprano
On Thursday 28 July 2016 12:39, Larry Martell wrote: > I have an object of type Target: > > (Pdb) type(target) > > > And I pickle it like this: > > (Pdb) type(pickle.dumps(target)) > > > And then it looks like this: > > (Pdb) pickle.dumps(target) > "ccopy_reg\n_reconstructor\np0\n(cworkite

Re: Behavior of tempfile temp files when scripts killed, interpreter crashes, server crashes?

2016-07-27 Thread eryk sun
On Wed, Jul 27, 2016 at 1:58 PM, Malcolm Greene wrote: > Can someone share their OS specific experience in working with tempfile > generated temp files under these conditions? > > 1. Script killed by another process > 2. Interpreter crashes > 3. Server crashes (sudden loss of power) > 4. Other app

Python text file fetch specific part of line

2016-07-27 Thread Arshpreet Singh
I am writing Imdb scrapper, and getting available list of titles from IMDB website which provide txt file in very raw format, Here is the one part of file(http://pastebin.com/fpMgBAjc) as the file provides tags like Distribution Votes,Rank,Title I want to parse title names, I tried with readlin

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Larry Martell
On Wed, Jul 27, 2016 at 10:39 PM, Larry Martell wrote: > On Wed, Jul 27, 2016 at 7:45 PM, Jason Benjamin wrote: >> Look at this: https://wiki.python.org/moin/UsingPickle >> It uses *pickle.dump* not *pickle.dumps* > > Yes that uses a file. I do not want to use a file. I want to pass the > object

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Larry Martell
On Wed, Jul 27, 2016 at 7:45 PM, Jason Benjamin wrote: > Look at this: https://wiki.python.org/moin/UsingPickle > It uses *pickle.dump* not *pickle.dumps* Yes that uses a file. I do not want to use a file. I want to pass the object as a string. > If you still don't get it send me the code for th

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread huey . y . jiang
On Wednesday, July 27, 2016 at 4:18:29 PM UTC-4, huey.y...@gmail.com wrote: > Hi Folks, > > It is common to put a BUTTON on a canvas by the means of coding. However, in > my application, I need to draw a circle on canvas, and then make this circle > to work as if it is a button. When the circle

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread Rick Johnson
On Wednesday, July 27, 2016 at 7:15:20 PM UTC-5, MRAB wrote: > On 2016-07-28 00:13, huey.y.ji...@gmail.com wrote: > > On Wednesday, July 27, 2016 at 4:18:29 PM UTC-4, huey.y...@gmail.com wrote: > >> Hi Folks, > >> > >> It is common to put a BUTTON on a canvas by the means of coding. However, > >>

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread MRAB
On 2016-07-28 00:13, huey.y.ji...@gmail.com wrote: On Wednesday, July 27, 2016 at 4:18:29 PM UTC-4, huey.y...@gmail.com wrote: Hi Folks, It is common to put a BUTTON on a canvas by the means of coding. However, in my application, I need to draw a circle on canvas, and then make this circle to

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Larry Martell
On Wed, Jul 27, 2016 at 6:54 PM, Jason Benjamin wrote: > If it has and 's' on the end it will only work on strings. *dumps* refers > to a string too. Yes, I know. I have an object, which I pickle with dumps, which turns it into a string. Then I try to unpickle it with loads and I get that error.

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread huey . y . jiang
On Wednesday, July 27, 2016 at 4:18:29 PM UTC-4, huey.y...@gmail.com wrote: > Hi Folks, > > It is common to put a BUTTON on a canvas by the means of coding. However, in > my application, I need to draw a circle on canvas, and then make this circle > to work as if it is a button. When the circle

ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Larry Martell
On Wednesday, July 27, 2016, Jason Benjamin > wrote: > On Wed, 27 Jul 2016 17:25:43 -0400, Larry Martell wrote: > > > When I try and unpickle an object with pickle.loads it fails with: > > > > ImportError: Import by filename is not supported when unpickleing > > > > I've never used pickle before.

Re: ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Jason Benjamin
On Wed, 27 Jul 2016 17:25:43 -0400, Larry Martell wrote: > When I try and unpickle an object with pickle.loads it fails with: > > ImportError: Import by filename is not supported when unpickleing > > I've never used pickle before. Why do I get this and how can I fix it? Try using *pickle.load*

Re: Is it possible to draw a BUTTON?

2016-07-27 Thread Jason Benjamin
On Wed, 27 Jul 2016 13:18:16 -0700, huey.y.jiang wrote: > Hi Folks, > > It is common to put a BUTTON on a canvas by the means of coding. > However, in my application, I need to draw a circle on canvas, and then > make this circle to work as if it is a button. When the circle is > clicked, it trig

Re: pyinstaller

2016-07-27 Thread Larry Martell
On Wed, Jul 27, 2016 at 9:12 AM, Vlastimil Brom wrote: > 2016-07-27 3:15 GMT+02:00 Larry Martell : >> On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown wrote: >>> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs >>> and see if I can help if you have not solved it already. >>> >>

ImportError: Import by filename is not supported when unpickleing

2016-07-27 Thread Larry Martell
When I try and unpickle an object with pickle.loads it fails with: ImportError: Import by filename is not supported when unpickleing I've never used pickle before. Why do I get this and how can I fix it? -- https://mail.python.org/mailman/listinfo/python-list

Is it possible to draw a BUTTON?

2016-07-27 Thread huey . y . jiang
Hi Folks, It is common to put a BUTTON on a canvas by the means of coding. However, in my application, I need to draw a circle on canvas, and then make this circle to work as if it is a button. When the circle is clicked, it triggers a new image to be displayed. Somebody can help? Thanks! -- h

Re: python and open office

2016-07-27 Thread Leonid Shanin
I use LibreOffice. Yes, it looks like I have to switch to Python 3 in this case. I'll try v.3 then Thank you Leonid > On 27-07-2016, at 21:01, Terry Reedy wrote: > > On 7/27/2016 12:37 PM, Chris Kaynor wrote: >> def __init__(self, name: str): >> >> That "name: str" syntax is called function a

Re: working with OpenOffice Calc

2016-07-27 Thread Terry Reedy
On 7/27/2016 1:54 PM, id23...@gmail.com wrote: I am looking for a library that will allow me to work with Calc documents from Python. But so far I was not able to build properly working environment for that. You posted this same question 1 1/2 hours before under a different name. Please don'

Re: python and open office

2016-07-27 Thread Terry Reedy
On 7/27/2016 12:37 PM, Chris Kaynor wrote: def __init__(self, name: str): That "name: str" syntax is called function annotations, and was added in Python 3, and you are trying to use the module in Python 2.7. There may be another variation of the module compatible with Python 2, or you'll need

working with OpenOffice Calc

2016-07-27 Thread id23...@gmail.com
I am looking for a library that will allow me to work with Calc documents from Python. But so far I was not able to build properly working environment for that. Here is what I already tried. Installed uno and unotools for Python 2.7, but importing unotools gives an error: UNO tools are installed:

Re: logging: getLogger() or getLogger(__name__)?

2016-07-27 Thread Laurent Pointal
Malcolm Greene wrote: > I've read that best practice for logging is to place the following line > at the top of all modules: > > logger = getLogger(__name__) > > I'm curious why the following technique wouldn't be a better choice: > > logger = getLogger() > > Are there scenarios that favor

Re: python and open office

2016-07-27 Thread Chris Kaynor
def __init__(self, name: str): That "name: str" syntax is called function annotations, and was added in Python 3, and you are trying to use the module in Python 2.7. There may be another variation of the module compatible with Python 2, or you'll need to upgrade your Python to a version of Python

python and open office

2016-07-27 Thread Crane Ugly
I try to create some scripts that will help me to open and manipulate OpenOffice documents. Calc in particular. But I have some problems finding right packages or libraries that offer such interface. So far I was trying uno and unotools but the first step is to import them failed. Here is the ou

TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-27 Thread Antoon Pardon
I am rewriting a program so it can work in python3. I am making progress, but now I stumble on the exception mentioned in the subject. The code still works in python2. What I'm doing is to write the results to temporary file that needs to be sorted afterwards. For as far as I understand after don

Behavior of tempfile temp files when scripts killed, interpreter crashes, server crashes?

2016-07-27 Thread Malcolm Greene
Can someone share their OS specific experience in working with tempfile generated temp files under these conditions? 1. Script killed by another process 2. Interpreter crashes 3. Server crashes (sudden loss of power) 4. Other application termination conditions ??? I'm curious which scenarios re

Re: pyinstaller

2016-07-27 Thread Vlastimil Brom
2016-07-27 3:15 GMT+02:00 Larry Martell : > On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown wrote: >> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs >> and see if I can help if you have not solved it already. >> >> What is the issue you are having? > > If I import the request

Re: Python environment on mac

2016-07-27 Thread Crane Ugly
Yep, I agree. virtualenv is the best way to go so far. It solves my wishes to use python completely without root access too. Thank's a lot. Leonid -- https://mail.python.org/mailman/listinfo/python-list

Re: reshape with xyz ordering

2016-07-27 Thread Heli
Thanks for your replies. Let me explain my problem a little bit more. I have the following data which i read from a file using numpy.loadtxt and then i sort it using np.lexsort: x=f[:,0] # XColumn y=f[:,1] # YColumn z=f[:,2] # ZColumn val=f[:,3] # Val Column xcoord=np.sort(np.unique(f[:,0])) # X

logging: getLogger() or getLogger(__name__)?

2016-07-27 Thread Malcolm Greene
I've read that best practice for logging is to place the following line at the top of all modules: logger = getLogger(__name__) I'm curious why the following technique wouldn't be a better choice: logger = getLogger() Are there scenarios that favor one style over another? Thank you, Malco

Re: pyinstaller

2016-07-27 Thread Larry Martell
On Wed, Jul 27, 2016 at 2:23 AM, Christian Gollwitzer wrote: > Am 27.07.16 um 03:15 schrieb Larry Martell: >> >> On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown wrote: >>> >>> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs >>> and see if I can help if you have not solved it

Two constructive reviewers sought

2016-07-27 Thread David Shi via Python-list
To promote the use of Python and formalise Python approach, I decided to publish a paper. I used geodata as a showcase. Geodata lies in the heart of geographical information science.  The management and processing of such data is of great importance. I got an email from International Journal of

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 ta

Re: making executables smaller

2016-07-27 Thread Steven D'Aprano
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.

Re: Python Print Error

2016-07-27 Thread Steven D'Aprano
On Wednesday 27 July 2016 13:45, Cai Gengyang wrote: > How to debug this error message ? Start by reading the message: invalid literal for int() with base 10: '' Now try to experiment at the interactive interpreter: int('45') # works int('xyz') # ValueError: invalid literal for int() with ba

Re: making executables smaller

2016-07-27 Thread Thomas 'PointedEars' Lahn
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, im