Re: [Tutor] python programmin problem

2016-07-25 Thread monik...@netzero.net
Thank you all for your answers. I do not have a teacher or any body else who 
could guide me. I have taken all python classes offered in my area and many on 
line.
The question is one of questions asked by interviews for a qa position that 
also does some automation with python. Im just trying to learn so that I could 
get a job. Nobody offers manual qa jobs anymore so I am working on updating my 
skills.

-- Original Message --
From: Alan Gauld via Tutor 
To: tutor@python.org
Subject: Re: [Tutor] python programmin problem
Date: Mon, 25 Jul 2016 00:21:10 +0100

On 24/07/16 20:58, Danny Yoo wrote:

> Please: I strongly encourage you to talk with your professor or study
> group: it really does sound like this is the first time you've seen these
> kinds of concepts.  

I agree with Danny, you should talk to your teacher.
I suspect the teacher may have set the problem without appreciating
the full extent of the complexity involved. It certainly doesn't
seem like you are properly equipped to solve it. Maybe he/she can
provide a simpler subset of problem.

Of course this assumes you have a teacher to ask? Your original
post doesn't state where you found the problem, it may be you
just picked it up on a web site or book  and have unwittingly
bitten off more than you are ready to chew just now?

It also depends a bit on whether the intent is to learn about
Python programming or about algorithms. If its the latter then
you might just want to ask on a different (math based) forum.
But if its Python you are interested in then find an easier
problem for now. Otherwise you will lose sight of the Python
problem in trying to solve the math one.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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



Affordable Wireless Plans
Set up is easy. Get online in minutes.
Starting at only $9.95 per month! 
www.netzero.net?refcd=nzmem0216
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2016-07-25 Thread Ramanathan Muthaiah
Hi Dilip,

This error has nothing to do with Python or it's versions.
OS does not have the support for these unicode characters. You need to fix
that.


> filename = "මේක තියෙන්නේ සිංහලෙන්.txt"
> Why can't I get Python to print the name out?
>
> filename =  "මේක තියෙන්නේ සිංහලෙන්.txt"
> Unsupported characters in input
>

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


Re: [Tutor] (no subject)

2016-07-25 Thread Steven D'Aprano
On Fri, Jul 22, 2016 at 01:08:02PM +0530, DiliupG wrote:
> I am using Python 2.7.12 on Windows 10

Two errors:

- first error is that Unicode strings in Python 2 need to be written as 
unicode objects, with a "u" prefix in the delimiter:

# ASCII byte string:
"Hello World"

# Unicode string:

u"මේක ත"

ASCII strings "..." cannot give you the right results except by 
accident. You must use unicode strings u"..."

- Second possible problem: using Windows, which may not support the 
characters you are trying to use. I don't know -- try it and see. If it 
still doesn't work, then blame Windows. I know that Linux and Mac OS X 
both use UTF-8 for filenames, and so support all of Unicode. But 
Windows, I'm not sure. It might be localised to only use Latin-1 
(Western European) or similar.


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


Re: [Tutor] (no subject)

2016-07-25 Thread eryk sun
On Fri, Jul 22, 2016 at 7:38 AM, DiliupG  wrote:
> I am using Python 2.7.12 on Windows 10
>
> filename = u"මේක තියෙන්නේ සිංහලෙන්.txt"
> Unsupported characters in input

That error message is from IDLE. I'm not an expert with IDLE, so I
don't know what the following hack potentially breaks, but it does
allow entering the above Unicode filename in the interactive
interpreter.

Edit "Python27\Lib\idlelib\IOBinding.py". Look for the following
section on line 34:

if sys.platform == 'win32':
# On Windows, we could use "mbcs". However, to give the user
# a portable encoding name, we need to find the code page
try:
encoding = locale.getdefaultlocale()[1]
codecs.lookup(encoding)
except LookupError:
pass

Replace the encoding value with "utf-8" as follows:

# encoding = locale.getdefaultlocale()[1]
encoding = "utf-8"

When you restart IDLE, you should see that sys.stdin.encoding is now "utf-8".

IOBinding.encoding is used by ModifiedInterpreter.runsource in
PyShell.py. When the encoding is UTF-8, it passes the Unicode source
string directly to InteractiveInterpreter.runsource, where it gets
compiled using the built-in compile() function.

Note that IDLE uses the Tk GUI toolkit, which -- at least with Python
Tkinter on Windows -- is limited to the first 65,536 Unicode
characters, i.e the Basic Multilingual Plane. The BMP includes
Sinhalese, so your filename string is fine.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2016-07-25 Thread eryk sun
On Mon, Jul 25, 2016 at 10:28 AM, Steven D'Aprano  wrote:
> I know that Linux and Mac OS X both use UTF-8 for filenames, and so support 
> all
> of Unicode. But Windows, I'm not sure. It might be localised to only use 
> Latin-1
> (Western European) or similar.

Windows filesystems (e.g. NTFS, ReFS, UDF, exFAT, FAT32) use Unicode
[1], i.e. UTF-16, as does the Windows wide-character API. Using 16-bit
wchar_t strings is a problem for C standard functions such as fopen,
which require 8-bit null-terminated strings, so the Windows C runtime
also supports wide-character alternatives such as _wfopen.

Python's os and io functions use Windows wide-character APIs for
unicode arguments, even in 2.x. Unfortunately some 2.x modules such as
subprocess use only the 8-bit API (e.g. 2.x Popen calls CreateProcessA
instead of CreateProcessW).

[1]: https://msdn.microsoft.com/en-us/library/ee681827#limits
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] installing openpyxl, problem still n o t solved

2016-07-25 Thread marcus lütolf
Dear Experts, 

I was too optimistic. Module ‚jdcal‘ ist indeed installed.
However, I get another trace back concerning ‚et_xmlfile‘ even after I
downloaded and saved it the same way as I did with ‚jdcal‘.

Since I haven’t got any responses to my previous calls for help – my problem
might be too unimportant - I just try it another time:

Why got ‚jdcal‘ accepted and ‘et_xmlfile’ not ?
I must say I unzipped both files directly in
C:\Users\marcus\AppData\local\Programs\Python\Python35\Lib\site-packages.

The command  >pip install was rejected as SyntaxError : invalid syntax.
Thanks for any kind of help, Marcus.

 

 

>>> import openpyxl

Traceback (most recent call last):

  File "", line 1, in 

import openpyxl

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\__init__.py", line 29, in 

from openpyxl.workbook import Workbook

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\workbook\__init__.py", line 5, in 

from .workbook import Workbook

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\workbook\workbook.py", line 8, in 

from openpyxl.worksheet import Worksheet

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\worksheet\__init__.py", line 4, in 

from .worksheet import Worksheet

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\worksheet\worksheet.py", line 34, in 

from openpyxl.cell import Cell

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\cell\__init__.py", line 4, in 

from .cell import Cell, WriteOnlyCell

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\cell\cell.py", line 44, in 

from openpyxl.styles import numbers, is_date_format

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\styles\__init__.py", line 5, in 

from .alignment import Alignment

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\styles\alignment.py", line 6, in 

from openpyxl.descriptors import Bool, MinMax, Min, Alias, NoneSet

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\descriptors\__init__.py", line 5, in 

from .sequence import Sequence

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\descriptors\sequence.py", line 5, in 

from openpyxl.xml.functions import Element

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\xml\functions.py", line 51, in 

from et_xmlfile import xmlfile

ImportError: No module named 'et_xmlfile'

>>> 

 

 

 

 

 

Dear Experts, problem solved, don’t bother, Marcus.

….

 

Dear Experts,

following instructions in a youtube video I thought I finally succeded to
install openpyxl.
However I got the traceback below:

>>> import openpyxl

Traceback (most recent call last):

  File "", line 1, in 

import openpyxl

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\__init__.py", line 29, in 

from openpyxl.workbook import Workbook

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\workbook\__init__.py", line 5, in 

from .workbook import Workbook

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\workbook\workbook.py", line 8, in 

from openpyxl.worksheet import Worksheet

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\worksheet\__init__.py", line 4, in 

from .worksheet import Worksheet

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\worksheet\worksheet.py", line 34, in 

from openpyxl.cell import Cell

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\cell\__init__.py", line 4, in 

from .cell import Cell, WriteOnlyCell

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\cell\cell.py", line 30, in 

from openpyxl.utils.datetime  import (

  File
"C:\Users\marcus\AppData\Local\Programs\Python\Python35\lib\site-packages\op
enpyxl\utils\datetime.py", line 13, in 

from jdcal import (

ImportError: No module named 'jdcal'

 

How do I get ‚jdcal‘ ?
Tanks everybody for help, Marcus.

……..

 

dear Experts,


could someone please tell me what exactly I have to type in my a) Python 35
– command line or 

b) desktopcomputer ( W10, 64bit)-command line in ordert to install openpyxl
which I downloaded in

C:\Users\marcus\Downloads on my computer. 
I have used all kinds of commands with ‚pip install‘ at the end, all
unsuccessful.

 

Thanks for help.

Marcus.

 



---
Diese E-Mail wurd

Re: [Tutor] installing openpyxl, problem still n o t solved

2016-07-25 Thread Alan Gauld via Tutor
On 25/07/16 19:59, marcus lütolf wrote:

> The command  >pip install was rejected as SyntaxError : invalid syntax.
> Thanks for any kind of help, Marcus.

If you get a syntax error that suggests you are running it
from the Python >>> prompt.
That's wrong. You should run pip from the command prompt
of your OS.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


Re: [Tutor] installing openpyxl, problem still n o t solved

2016-07-25 Thread Steven D'Aprano
Hello Marcus,

I'm afraid it is very difficult for me to understand your email. Your 
email contains weird control characters as shown here:

On Mon, Jul 25, 2016 at 08:59:50PM +0200, marcus lütolf wrote:
> Dear Experts, 
> 
> I was too optimistic. Module ‚jdcal‘ ist indeed installed.
> However, I get another trace back concerning ‚et_xmlfile‘ even after I
> downloaded and saved it the same way as I did with ‚jdcal‘.

I think the reason is that your email program is setting the wrong 
encoding: your email claims to be Latin-1 but obviously isn't.

I think this may be because you are using Microsoft Word as the email 
editor, and inserting "smart quotes", probably ‘’. Smart quotes are not 
part of Latin-1, but Outlook is (wrongly!) setting a header saying that 
it is using Latin-1.

You should be able to fix this by:

- turning of Smart Quotes and using ordinary '' or "" quotes instead of 
  curly quotes ‘’ or “”

- teaching Outlook to use UTF-8 instead of the cp1252 encoding

- or at least have Outlook say it is using cp1252 instead of wrongly 
  claiming to be using Latin-1

That will help us be able to read your emails.

Another problem is that I actually don't understand what you are saying. 
First you say that you were too optimistic, at the beginning of the 
email. Then in the middle of the email you say you have solved your 
problem, and we should not bother. Then at the beginning you say that 
you need help. None of these parts are quoted:

   > Quoted text

   Not quoted text


so it all looks like part of the same email, which is confusing: have 
you solved the problem? Not solved it?

If we understood your questions better, perhaps we could answer them.


> Since I haven’t got any responses to my previous calls for help – my problem
> might be too unimportant - I just try it another time:
> 
> Why got ‚jdcal‘ accepted and ‘et_xmlfile’ not ?
> I must say I unzipped both files directly in
> C:\Users\marcus\AppData\local\Programs\Python\Python35\Lib\site-packages.

Are you talking about this?

https://pypi.python.org/pypi/et_xmlfile

You should unzip it into your home directory, and then run the setup.py 
file in the top directory. I think the command will be:

python setup.py install

as administrator or root superuser. On Linux/Mac you may be able to use:

sudo python setup.py install


> The command  >pip install was rejected as SyntaxError : invalid syntax.
> Thanks for any kind of help, Marcus.


You need to run pip from the operating system's shell, not from inside 
Python. Python's default prompt is ">>>". Most shells use "$" or "%" as 
the prompt.



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


Re: [Tutor] (no subject)

2016-07-25 Thread eryk sun
On Tue, Jul 26, 2016 at 4:39 AM, DiliupG  wrote:
> I am reading in a list of file names with the following code.
>
> def get_filelist(self):
> ""
> app = QtGui.QApplication(sys.argv)
> a = QtGui.QFileDialog.getOpenFileNames()
>
> filelist = []
> if a:
> for name in a:
> a = unicode(name)
>
> filelist.append(a)
>
> return filelist
>
> mainprg.filelist = mainprg.get_filelist()
>
> filelist = mainprg.filelist
>
> for name in filelist:
> print name <  THIS IS WHERE THE PROBLEM IS

This is an output problem, which is unrelated to the IDLE input error
that you initially reported. But IDLE isn't (at least shouldn't be)
used for deployed applications. It's a development environment.

Generally if you're using Qt then you're not creating a console
application that prints to stdout, but instead the program outputs
text to a Qt widget such as a QTextEdit. That said, if you need to print
Unicode text to the Windows console, for whatever reason (maybe
debugging), then pip install and enable the win_unicode_console
module.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor