[Tutor] A question about daunting KeyError

2019-07-24 Thread TAISHI KAWAMURA
Hi tutors on Tutor,

I'm Taishi from Japan working in a data analytics team.

Currently, I'm trying to analyse purchase data of a fashion brand.
However, mysterious KeyErrors started occurring continuously when I was coding, 
and I haven't been able to get that fixed.

Although I asked this question on Stack Over Flow and another platform, I 
haven't got any solution.

I'm suspecting that Anaconda might keep raising the error, or simply there are 
bugs in the codes.
However, I can't be sure what the real cause is.

Do you think you can help me out?
If yes, please give me some assistance.

Regards,
Taishi Kawamura
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A question about daunting KeyError

2019-07-24 Thread David L Neil

On 24/07/19 3:21 PM, TAISHI KAWAMURA wrote:

Hi tutors on Tutor,

I'm Taishi from Japan working in a data analytics team.

Currently, I'm trying to analyse purchase data of a fashion brand.
However, mysterious KeyErrors started occurring continuously when I was coding, 
and I haven't been able to get that fixed.

Although I asked this question on Stack Over Flow and another platform, I 
haven't got any solution.

I'm suspecting that Anaconda might keep raising the error, or simply there are 
bugs in the codes.
However, I can't be sure what the real cause is.

Do you think you can help me out?
If yes, please give me some assistance.



People here are happy to help, but you'll need to show us the relevant 
code and perhaps some data if that's possibly the source of the problem.


--
Regards =dn
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] A question about daunting KeyError

2019-07-24 Thread Steven D'Aprano
Hi Taishi, and welcome.

On Wed, Jul 24, 2019 at 03:21:03AM +, TAISHI KAWAMURA wrote:

[...]
> I'm suspecting that Anaconda might keep raising the error, or simply 
> there are bugs in the codes. However, I can't be sure what the real 
> cause is.

Almost certainly it will be a bug in your code, or unexpected values in 
your data. It is possible that it is a bug in Anaconda, but not very 
likely.

Start by removing Anaconda from the problem: what happens if you run 
your code using the plain Python interpreter, without Anaconda involved? 
>From the operating system command line, run something like this:

# Windows CMD.EXE
py path/to/myscript.py

# Linux or Mac OS shell
python path/to/myscript.py


Of course the example command you run will depend on the version of 
Python you are using, and the name and path to your script.

If the error goes away without Anaconda involved, then it is *possible* 
that it is a bug in Anaconda. But I expect the error will remain.

Then show us the full traceback of the error. Copy and paste the FULL 
exception message, starting with the line "Traceback" and ending with 
the KeyError and error message, something like this but probably longer:

Traceback (most recent call last):
  File "", line 1, in 
KeyError: (1, 2, 3)


Once you know the line where the error is occurring, you could introduce 
some debugging code:

try:
result = data[key]
except KeyError:
log(data)
log(key)
raise


or use the debugger to investigate why the key is missing.

You should also read this:

http://sscce.org/


It is written for Java programmers, but it applies to Python too.




-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] python idle file couldn't start

2019-07-24 Thread siva
I have tried to start python through idle .but the software didn’t start.it 
displays “subprocess error”.tell me some solution.
Thank you. 

Sent from Mail for Windows 10

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python idle file couldn't start

2019-07-24 Thread Flynn, Stephen (Life & Pensions)
What (precisely) did you type to "start python through idle"? Don't guess - cut 
and pasted EXACTLY what you type and what you see on screen.

S.

-Original Message-
From: Tutor  On Behalf Of 
siva
Sent: 24 July 2019 08:57
To: tutor@python.org
Subject: [Tutor] python idle file couldn't start

I have tried to start python through idle .but the software didn’t start.it 
displays “subprocess error”.tell me some solution.
Thank you. 

Sent from Mail for Windows 10

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


This message has been scanned by Capita systems, but if you believe it to be 
spam, please send it to s...@forcepoint.com.

Messages sent to s...@forcepoint.com are queued for email analysis by 
Forcepoint Threat Lab.


This email is security checked and subject to the disclaimer on web-page: 
http://www.capita.co.uk/email-disclaimer.aspx
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] __weakref__ question

2019-07-24 Thread Sarah Hembree
Can anyone provide some simple example/s or two or three of using weakref?
I'm baffled and not seeing any documentation that is meaningful. My
interest is to minimize memory usage (generally speaking, overall) and am
wondering if this might help.

--- We not only inherit the Earth from our Ancestors, we borrow it from our
Children. Aspire to grace.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor