Re: ModuleNotFoundError

2022-06-17 Thread z . szenderak
Thank you for your email. C:\Users\zszen>python.exe Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print(sys.version) Traceback (most recent call last): File "", line 1,

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
On Monday, January 11, 2021 at 2:07:03 PM UTC, Chris Angelico wrote: > On Tue, Jan 12, 2021 at 1:01 AM pascal z via Python-list > wrote: > > > > On Monday, January 11, 2021 at 1:45:31 PM UTC, Greg Ewing wrote: > > > On 12/01/21 1:12 am, pascal z wrote: > >

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
On Monday, January 11, 2021 at 1:45:31 PM UTC, Greg Ewing wrote: > On 12/01/21 1:12 am, pascal z wrote: > > As alternative, I pasted it into github and pasted it back into this page, > > it's ok when pasting but when posting it fails keeping spaces... > The indentation i

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
On Monday, January 11, 2021 at 12:00:28 PM UTC, Loris Bennett wrote: > pascal z writes: > > > tab to space on linux is not something easy to do > > I would argue that you are mistaken, although that depends somewhat on > your definition of 'easy'. > >

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
== "csv": fx_writeCSV(file_paths) elif tycsv == "txt": # APPEL FONCTION ECRIT STR TO CSV fx_writeCSV_str(csv_txt) print("job basic listing ok") ### ADVANCED LISTING elif argz == 2: print("advan

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
, vfile_name, f_size, f_size/1024, f_size/1048576,f_size/1073741824, "file\n") # APPEL FONCTION ECRIT ARRAY TO CSV if tycsv == "csv": fx_writeCSV(file_paths) elif tycsv == "txt": # APPEL FONCTION ECRIT STR TO CSV

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
, vfile_name, f_size, f_size/1024, f_size/1048576,f_size/1073741824, "file\n") # APPEL FONCTION ECRIT ARRAY TO CSV if tycsv == "csv": fx_writeCSV(file_paths) elif tycsv == "txt": # APPEL FONCTION ECRIT STR TO CSV

Re: learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
And something important to this app, is about listing files, how to avoid listing small application files parts .ini and binary files so if it's an application it would tell the size of of the folder of this application and not list the content or make it optionnal? -- https://mail.python.org/m

Re: learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
any way to attach a file because I loose indentation? -- https://mail.python.org/mailman/listinfo/python-list

learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
, vfile_name, f_size, f_size/1024, f_size/1048576,f_size/1073741824, "file\n") # APPEL FONCTION ECRIT ARRAY TO CSV if tycsv == "csv": fx_writeCSV(file_paths) elif tycsv == "txt": # APPEL FONCTION ECRIT STR TO CSV

Re: python show folder files and not subfolder files

2020-10-04 Thread pascal z via Python-list
On Thursday, September 24, 2020 at 4:37:07 PM UTC+2, Terry Reedy wrote: > On 9/23/2020 7:24 PM, pascal z via Python-list wrote: > > Please advise if the following is ok (i don't think it is) > > > > #!/usr/bin/env python3 > > # -*- coding: utf-8 -*- > >

Re: python if and same instruction line not working

2020-10-04 Thread pascal z via Python-list
On Tuesday, September 29, 2020 at 5:28:22 PM UTC+2, MRAB wrote: > On 2020-09-29 15:42, pascal z via Python-list wrote: > > I need to change the script commented out to the one not commented out. Why? > > > > # for x in sorted (fr, key=str.lower): > > # t

python if and same instruction line not working

2020-09-29 Thread pascal z via Python-list
I need to change the script commented out to the one not commented out. Why? # for x in sorted (fr, key=str.lower): # tmpstr = x.rpartition(';')[2] # if x != csv_contents and tmpstr == "folder\n": # csv_contentsB += x # elif x != csv_contents and tmpstr == "

Re: python show folder files and not subfolder files

2020-09-23 Thread pascal z via Python-list
ok, i came up with if os.path.isfile(path) following path = os.path.join(Lpath, f) and it seems to be ok, no dupplicates or wrong sizes... thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: python show folder files and not subfolder files

2020-09-23 Thread pascal z via Python-list
Please advise if the following is ok (i don't think it is) #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os csv_contents = "" output_file = '/home/user/Documents/csv/output3csv.csv' Lpath = '/home/user/Documents/' csv_contents = "FOLDER PATH;Size in Byte;Size in Kb;Size in Mb;Size in Gb

python show .

2020-09-23 Thread pascal z via Python-list
Hello, I'm working on a script where I want to loop into folders somehow recursively to get information but I want to limit the infos for the files on a certain level of folders for example: /home/user/Documents/folder1 /home/user/Documents/folder2 /home/user/Documents/folder3/folder1/file1 /hom

python oop learning communication between function inside a class

2020-09-17 Thread pascal z via Python-list
Hello, I would like to know how possible it is to call a member function from a class and pass it a variable Example: class Application(tk.Frame): """docstring for .""" def __init__(self, parent): super(Application, self).__init__(parent) self.parent = parent par

Re: A small quiz

2020-01-23 Thread Z
what is PLR? -- https://mail.python.org/mailman/listinfo/python-list

Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Andrew Z
Look into https://repl.it On Wed, Nov 20, 2019, 15:43 Göktuğ Kayaalp wrote: > > Andrew Z wrote: > > Goktug, > > Im not clear what is the objective of the lecture? I understand it is > an > > intro, but what are you trying to achieve? > > Basically I ne

Re: Recommendations for intro to python+programming lecture to Humanities MA students

2019-11-20 Thread Andrew Z
Goktug, Im not clear what is the objective of the lecture? I understand it is an intro, but what are you trying to achieve? I didnt read all the details, but maybe you can look into creating a docker/virtual box image with everything preinstalled. Good luck. On Wed, Nov 20, 2019, 11:54 Göktuğ K

Re: Blasphemy

2019-10-24 Thread Andrew Z
Space. On Thu, Oct 24, 2019, 18:53 Marek Mosiewicz wrote: > What about, if Python would have optional end keyword. In fact most of > blocks have starting : sign. What if you would have also keyword to > optionaly mark end of block. > > That would be big win for IDEs to format code and ensure tha

Re: Books for Python 3.7

2019-07-16 Thread Andrew Z
> intrigued to hear from you, should you... > > > Last comment (to OP): you should be aware of the Python version > 'covered'. Am not convinced that v3.7 is that important - to a beginner. > Thus, maybe accept v3.5+, and make a practice of reviewing the Python > docs -

Re: Books for Python 3.7

2019-07-15 Thread Andrew Z
Gys - hats off. Basically what Dennis is saying- you dont need a book "about python ". Tutorials and general search online will get you further and faster than any book. Blah-blah about myself: my bookshelf has 2 technical books, just because i got them to prepare for certifications. For my tradi

Re: Books for Python 3.7

2019-07-12 Thread Andrew Z
8nterval and start/stop countdown. I have 0 knowledge in android and kotlin. So for me to get to voice recognition part i need to learn basics of the android and kotlin. On Fri, Jul 12, 2019, 15:35 RIchy M wrote: > On Friday, July 12, 2019 at 2:45:48 PM UTC-4, Andrew Z wrote: > > Richy,

Re: Books for Python 3.7

2019-07-12 Thread Andrew Z
Richy, What specific part you consider hard? If i may suggest, get a (pet) project as you read it. On Fri, Jul 12, 2019, 13:46 RIchy M wrote: > On Friday, July 12, 2019 at 1:00:01 PM UTC-4, MRAB wrote: > > On 2019-07-12 16:40, Terry Reedy wrote: > > > On 7/12/2019 11:27 AM, Richard Mok wrote:

Pandas- yahoo finance

2019-06-04 Thread Andrew Z
Hello, Do i get it right that yahoo finance is no longer available as a data source for pandas? -- https://mail.python.org/mailman/listinfo/python-list

Re: Why Python has no equivalent of JDBC of Java?

2019-05-20 Thread Andrew Z
PM, Andrew Z wrote: > > What does 249 specification mention about drivers? > > Nothing that I can see. > > But it stands to reason that at some point the Python code is going to > have to interface with the SQL database server's API. And when the > database in question is

Re: Why Python has no equivalent of JDBC of Java?

2019-05-20 Thread Andrew Z
What does 249 specification mention about drivers? On Mon, May 20, 2019, 17:39 Marco Sulla via Python-list < python-list@python.org> wrote: > On Mon, 20 May 2019 at 17:32, Thomas Jollans wrote: > > > Python has a the "Python Database API" (DB API 2.0) > > https://www.python.org/dev/peps/pep-0249

Re: Why Python has no equivalent of JDBC of Java?

2019-05-19 Thread Andrew Z
The pg python lib requires https://www.postgresql.org/docs/current/libpq.html pip pulls it as a part of the lib install, whereas in oracle case you install the driver yourself first.(suize matters) //for some reason i thought the driver libs come as part of cx . But it was a year ago and my memory

Re: Why Python has no equivalent of JDBC of Java?

2019-05-19 Thread Andrew Z
Marco, You clearly know more about python/java universe than i do. But im infinitely thankful to cx team for putting out the package. Feature and performance wise , even with non supported oracle timesten, it was fantastic. Id always go after "native" vs jdbc. But i understand that most of apps

Re: Python resources recommendations

2019-03-09 Thread Andrew Z
I would think that your experience with other languages would guide you on the route of learning another tool.. On Sat, Mar 9, 2019, 13:01 Arup Rakshit wrote: > Hello Python, > > This is my first time in this mailing list. I am a Ruby/JS developer by > day. I have decided to learn Python now thi

Re: Hands-On Quantum Computing with Python

2019-01-05 Thread Andrew Z
Good for you. On Sat, Jan 5, 2019, 06:25 Bhagvan Kommadi I am coauthoring a packt book : Hands-On Quantum Computing with Python. > The book will be published around Aug 2019 > > > > The book will introduce quantum computing and a comprehensive overview of > the quantum programming languages curre

Re: Good editor for python

2018-11-11 Thread Andrew Z
e snippet and "```{r}" ... "```" for an R code snippet. Or I > > just use the Idle editor that comes with Python. > > > > > >Someone suggested that Apache Zeppelin and / or BeakerX might be > > able to do this also, but I've not tried o

Re: Good editor for python

2018-11-11 Thread Andrew Z
If you do scripts - emacs/vi is the way to go. If you need something more (like creating libraries, classes) go with pycharm. It is a professionally made IDE. Over past 2 years ive been trying to "downgrade" myself to something with less belts and whistles, but come back to it all the time. On

Re: Cloud platform with GPU

2018-11-10 Thread Andrew Z
Denis, ..none of them was very satisfactory. Sharing your requirements will be a good first step for getting good answers. On Sat, Nov 10, 2018, 02:26 denis meng Good day all, > > I am looking for a good cloud platform to do all my python development for > machine learning with GPU availability,

Re: Keys in dict and keys not in dict

2018-03-19 Thread Andrew Z
Beautiful. Thank you Chris, Ben, Peter and Inada. On Mar 19, 2018 3:14 AM, "INADA Naoki" wrote: > > expected = {"foo", "bar", "spam"} > > missing = expected - set(json.keys()) > > > > dict.keys() returns set-like object. > So `missing = expected - json.keys()` works fine, and it's more e

Keys in dict and keys not in dict

2018-03-18 Thread Andrew Z
hello, i'd like to check if a function parameter (json) has all the keys I expect it to have and if it doesn't - point out the one that is missing. What's the good way of doing that? "good way" - something concise... i'd like to avoid using : if key in json: #pass else print(" Oops, i

A better solution

2018-03-16 Thread Andrew Z
Hello, im not entirely happy with my solution and would love to hear your suggestions on how to improve the solution. I simplified the task while keeping the code working. Task: financial accounts are described by XML documents. I want to architecture the code to be easily extendible ( easy to

Re: Flask: request vs Request

2018-03-12 Thread Andrew Z
Thank you Christopher. On Mar 12, 2018 09:10, "Christopher Mullins" wrote: > Could you please give some context when you reply, TIA >> > > Whoops, thanks for the reminder Mark. > > So what for the Request is used for then? > > > In general when you see that something in Python starts with a cap

Re: Flask: request vs Request

2018-03-11 Thread Andrew Z
after reading the docs and stackoverflow i got some rudimentary understanding of Request vs request. i still don't understand why i PyCharm won't show properties, but it is tool centric question that hardly belongs to this group. On Sun, Mar 11, 2018 at 10:02 AM, Andrew Z wrote: &g

Re: Flask: request vs Request

2018-03-11 Thread Andrew Z
Sorry guys. i realized i was "mumbling" . What is the difference between Request and request? - RTFM , Andrew Questions: a. when do i use Request? b. why can't I see any properties of the request? For example, in Michael's tutorial, there

Re: Flask: request vs Request

2018-03-10 Thread Andrew Z
that's right there is no Request used. So what for the Request is used for then? Here it is explained that request is for current request... that's kinda of clears the air a bit. but where do i find it's m

Flask: request vs Request

2018-03-10 Thread Andrew Z
hello, i'm playing with Michael Grinberg's "Restful API with python and flask" tutorial . And i'm very much confused whats the difference between request and Request. the "request" is introduced @ the point he

Re: LXML: can't register namespace

2018-03-09 Thread Andrew Z
nel wrote: > > > >> Andrew Z schrieb am 07.03.2018 um 05:03: > >>> Hello, > >>> with 3.6 and latest greatest lxml: > >>> > >>> from lxml import etree > >>> > >>> tree = etree.parse('Sample.xml') >

Re: LXML: can't register namespace

2018-03-07 Thread Andrew Z
the namespace URI will be removed. On Wed, Mar 7, 2018 at 8:55 AM, Andrew Z wrote: > Yes, if i give it any non empty tag - all goes well. > > All im trying to do is to extract a namespace ( i try to keep simple here. > Just first one for now) and register it so i can save

Re: LXML: can't register namespace

2018-03-07 Thread Andrew Z
> wrote: > On Tue, 06 Mar 2018 23:03:15 -0500, Andrew Z wrote: > > > Hello, > > with 3.6 and latest greatest lxml: > > > > from lxml import etree > > > > tree = etree.parse('Sample.xml') > > etree.register_namespace('','htt

LXML: can't register namespace

2018-03-06 Thread Andrew Z
Hello, with 3.6 and latest greatest lxml: from lxml import etree tree = etree.parse('Sample.xml') etree.register_namespace('','http://www.example.com') causes: Traceback (most recent call last): File "/home/az/Work/flask/tutorial_1/src/xml_oper.py", line 16, in etree.register_namespace('

Re: python to C code generator

2018-01-23 Thread Andrew Z
Id go this way too. Basic C is straightforward. I usually consider learning a new "thing " if the time to support potwntially combersome solution using existing methods justifies the effort. On Jan 23, 2018 09:01, "Ned Batchelder" wrote: > On 1/23/18 8:48 AM, kushal bhattacharya wrote: > >> On

Re: we want python software

2017-12-06 Thread Andrew Z
Can we mark the entire thread "spam", please? On Dec 6, 2017 17:55, "Gregory Ewing" wrote: > Rick Johnson wrote: > > DOLT: "Programming is easy! Once you learn the langauge, >> it's just a matter of fill-in-the-blanks." >> > > To be fair to this person, for someone who has a natural > a

Re: Politeness (was: we want python software)

2017-12-06 Thread Andrew Z
Looks like the longest thread for past 2 months. Should we push it to be the longest for 2017? :) On Dec 6, 2017 15:34, "Ian Kelly" wrote: > On Wed, Dec 6, 2017 at 10:56 AM, Gene Heskett > wrote: > > On Wednesday 06 December 2017 12:14:32 Ian Kelly wrote: > > > >> On Wed, Dec 6, 2017 at 9:42

Re: Pros and cons of Python sources?

2017-11-27 Thread Andrew Z
Martin, Im Late to the party, but my (newbish) .02 I learned hard way not to mix rpm and pip (im on fedora). Yes, pip ...-user is what i use now exclusively. I doubt you can _easily_ clean everything up..especially considering that a few linux core utils depend on python nowadays. Maybe you ca

Re: Increasing the diversity of people who write Python (was: Benefits of unicode identifiers)

2017-11-24 Thread Andrew Z
Thank you Rick for well thought out argument. On Nov 24, 2017 12:44, "Rick Johnson" wrote: > On Thursday, November 23, 2017 at 9:57:12 PM UTC-6, Ben Finney wrote: > [...] > > This is a necessary consequence of increasing the diversity > > of people able to program in Python: people will expres

Re: Increasing the diversity of people who write Python (was: Benefits of unicode identifiers)

2017-11-23 Thread Andrew Z
I have hard time seeing the benefits of this "necessity" , just unreasonable overcomplications for the name of "diversity". On Nov 23, 2017 22:57, "Ben Finney" wrote: > Ian Kelly writes: > > > On Thu, Nov 23, 2017 at 1:04 PM, Karsten Hilbert > > wrote: > > > Using function arguments writte

Re: Time travel - how to simplify?

2017-11-18 Thread Andrew Z
27;K', 6 : 'M', 7 : 'N', 8 : 'Q', 9 : 'U', 10: 'V', 11: 'X', 12: 'Z' } endDate = datetime.date.today() startDate = en

Re: for/ if against dict - one liner

2017-11-18 Thread Andrew Z
thon.org> wrote: > On Tue, 14 Nov 2017 00:44:18 -0500, Andrew Z wrote: > > > Hello, > > i wonder how do i get the "for" and "if" to work against a dictionary > > in > > one line? > > > > basically i want to "squeeze":

Time travel - how to simplify?

2017-11-13 Thread Andrew Z
27;K', 6 : 'M', 7 : 'N', 8 : 'Q', 9 : 'U', 10: 'V', 11: 'X', 12: 'Z' } where key is a month. Now i want to get cert

Re: Time travel - how to simplify?

2017-11-13 Thread Andrew Z
My implied solution is incorrect. I should start with using the date type and, for example, dateutil package for date manipulation and building the dictionary of needed dates/months. And only after that, map against the fut_suffix. On Tue, Nov 14, 2017 at 12:56 AM, Andrew Z wrote: > w

for/ if against dict - one liner

2017-11-13 Thread Andrew Z
Hello, i wonder how do i get the "for" and "if" to work against a dictionary in one line? basically i want to "squeeze": dct= [ 1 : "one", 2:"two", 3:"three"] for k, val in dct: if k >= 2: # do magnificent things Thank you AZ -- https://mail.python.org/mailman/listinfo/python-list

Re: matplot plot hangs

2017-11-04 Thread Andrew Z
Tim, it won't even advance to that line. On Thu, Nov 2, 2017 at 8:28 AM, Tim Williams wrote: > On Wednesday, November 1, 2017 at 6:30:27 PM UTC-4, Andrew Z wrote: > > nope. it doesnt: > > > > I added print-s after each line and that produced: > > [az@hp

Re: matplot plot hangs

2017-11-01 Thread Andrew Z
nope. it doesnt: I added print-s after each line and that produced: [az@hp src]$ cat ./main1.py import matplotlib.pyplot as plt print("imported") plt.plot([1,2,4,1]) print("plot is done") plt.show() print("show is done") [az@hp src]$ python3.5 ./main1.

Re: matplot plot hangs

2017-11-01 Thread Andrew Z
Wolfgang, I tried to ran from ide with no rwsults, so now im trying from a terminal in xwindow. The .plot is the last line in the script and it does hang trying to execute it. On Nov 1, 2017 05:44, "Wolfgang Maier" < wolfgang.ma...@biologie.uni-freiburg.de> wrote: On 01.11.2017

Re: matplot plot hangs

2017-10-31 Thread Andrew Z
Stefan, I intentionally tried to use the qt backend that i do not have. I wanted to check i the switch was working (or not). All i want at this point is to use (seemed to be default) tkagg. On Oct 31, 2017 20:15, "Stefan Ram" wrote: > Andrew Z writes: > >ImportError: *No

matplot plot hangs

2017-10-31 Thread Andrew Z
hello, learning python's plotting by using matplotlib with python35 on fedora 24 x86. Installed matplotlib into user's directory. tk, seemed to work - http://www.tkdocs.com/tutorial/install.html#installlinux - the window shows up just fine. but when trying to run the simple plot ( https://matplot

Re: Ide vs ide

2017-10-28 Thread Andrew Z
I like this trajectory of conversation. Can we re define "small tiny" as "scripts"? i can argue, based on my expirience with other languages, that there is no need for an "ide". The most ive ever needed is a text editor and a few plugins with "print". Moving to "average" size projects. What i fou

Ide vs ide

2017-10-27 Thread Andrew Z
Yeah, lets start the war! // joking! But if i think about it... there are tons articles and flame wars about "a vs b". And yet, what if the question should be different: If you were to create the "ide" for yourself (think lego) , what are the functions that you _use_ and like a lot? -- https://m

Re: How to plot

2017-10-27 Thread Andrew Z
Rrhank you Thomas. On Oct 27, 2017 04:23, "Thomas Jollans" wrote: > On 2017-10-27 07:18, Andrew Z wrote: > > Hello, > > i'd like to create a graph/plot based a DB table's data, but not sure > > where to start. I > > > > also would like to

How to plot

2017-10-26 Thread Andrew Z
Hello, i'd like to create a graph/plot based a DB table's data, but not sure where to start. I also would like to have the following functionality: a. i'd like to have it in the separate window ( xwindow to be precise). b. and i'd like to have the graph updating with every record added to the

Modern website

2017-10-22 Thread Andrew Z
I realize the following has little todo with python per se. But i hope to get a guidance on how these types of tasks are done nowadays. The task: Ive been asked to create an integration process. That is a few webpages with questioneer with the submission to a "mother" company using its API . Idea

Re: how to read in the newsreader

2017-10-15 Thread Andrew Z
hmm. i did do that. maybe just a delay. I'll see how it will go tomorrow then. Thank you gents. On Mon, Oct 16, 2017 at 12:30 AM, Chris Angelico wrote: > On Mon, Oct 16, 2017 at 3:19 PM, Andrew Z wrote: > > Michael, that's what i use too - gmail. But i get the dige

Re: how to read in the newsreader

2017-10-15 Thread Andrew Z
esn't seemed to filter anything in the comp group. But what you recommend is to access the group using regular email client and use it's spam filtering . Did i get that right ? On Mon, Oct 16, 2017 at 12:19 AM, Andrew Z wrote: > Michael, that's what i use too - gmail. But i

Re: how to read in the newsreader

2017-10-15 Thread Andrew Z
Michael, that's what i use too - gmail. But i get the digest only and can't really reply that way. i was hoping to get the mail.python.org list On Mon, Oct 16, 2017 at 12:00 AM, Michael Torrie wrote: > On 10/15/2017 08:50 PM, Andrew Z wrote: > > Gents, > > how

how to read in the newsreader

2017-10-15 Thread Andrew Z
Gents, how do i get this group in a newsreader? The digest i'm getting is not workable for me - i can't reply , can only read the replies from the members of the group. Or. maybe, it shouldn't be a news reader please advise.. P.S. Oh the comp.lang.python is a nightmare because of spam... --

Best practise for passing time as arguments

2017-10-14 Thread Andrew Z
Hello, I wonder what are the "best practises" for passing "time" parameters to functions? I noticed that sometimes i pass "time" as a str and then start "massaging" it into delta or i need this time format or that format. Thats quite annoying and inconsistent. I use word "time" as a general word f

Re: unorderable types: list() > int()

2017-10-13 Thread Andrew Z
The answer is: The dict returns list - my mistake obviously. I think list.pop(0) is better for sanity than list[0]: Pos= [k,v for ...].pop(0) On Oct 13, 2017 00:23, "Andrew Z" wrote: > Hello, > pos = {"CLown":10,"BArbie":20} > I want to return intege

unorderable types: list() > int()

2017-10-12 Thread Andrew Z
Hello, pos = {"CLown":10,"BArbie":20} I want to return integer (10) for the keyword that starts with "CL" cl_ = [v for k, v in pos.items() if k.startswith('CL')] cl_pos = cl_[0] if cl_pos > 0: blah.. There are 2 issues with the above: a. ugly - cl_pos = cl_ [0] . I was thinking something

Re: Logging from files doesn't work

2017-10-12 Thread Andrew Z
Cameron, Peter, Thank you. Your comments were spot on. Changing root logger got the logs spitting into the file. And i now can org these logs into one directory, instead of the current mess. Thank you! On Oct 11, 2017 23:41, "Cameron Simpson" wrote: > On 11Oct2017 22:27, An

Re: Logging from files doesn't work

2017-10-11 Thread Andrew Z
g is working perfectly well. This brings me to the question - what is wrong with me file naming/structure that confuses the logging module? I'm not sure i really want to have each little file in it's own directory too.. but i'm open for suggestions. On Wed, Oct 11, 2017 at 10:15 PM, Andre

Re: Logging from files doesn't work

2017-10-11 Thread Andrew Z
if i change print statements in both files to print out "__name__": __main__ test1.test On Wed, Oct 11, 2017 at 10:02 PM, Andrew Z wrote: > Hello, > > apparently my reading comprehension is nose diving these days. After > reading python cookbook and a few other tutoria

Logging from files doesn't work

2017-10-11 Thread Andrew Z
Hello, apparently my reading comprehension is nose diving these days. After reading python cookbook and a few other tutorials i still can't get a simple logging from a few files to work. I suspected my file organization - all files are in the same directory, causing problem. But it appears it is

Re: "comprehend" into a single value

2017-10-07 Thread Andrew Z
and how about adding "IF" into the mix ? as in : a=0 dict= {10: ['a',1,'c'], 20: ['d',2,'f']} for i in dict: p+= 10 if dict[i][1] in [1,2,3,4,5] else 0 can i "squish" "for" and "if" together ? or will it be

Re: "comprehend" into a single value

2017-10-07 Thread Andrew Z
>> Something like that? >> > Ah, but that's 2 lines. > > sum(val[1] for val in {10: ['a',1,'c'], 20: ['d',2,'f']}.values()) > > On Sat, Oct 7, 2017 at 11:07 PM, Andrew Z wrote: >> >> Hello, >>> i wonder

"comprehend" into a single value

2017-10-07 Thread Andrew Z
Hello, i wonder how can i accomplish the following as a one liner: dict= {10: ['a',1,'c'], 20: ['d',2,'f']} p = 0 for i in dict: p += dict[i][1] Thank you -- https://mail.python.org/mailman/listinfo/python-list

async. How to wait for async function to complete

2017-09-07 Thread Andrew Z
Hello, i need to wait for the callback function (contractDetailsEnd) to finish before i can continue with the logic ( in subscribe) further. For that i check the flag (ContractsUpdatedEnd) in the "while" loop. Here is the simplified code: import asyncio import ibapi from tws_async import TWSCl

Re: Python3 : import

2017-07-07 Thread Andrew Z
On Friday, July 7, 2017 at 4:16:38 PM UTC-4, Ian wrote: > On Fri, Jul 7, 2017 at 2:00 PM, Andrew Z wrote: > > [az@hp tst1]$ python3 ./uno.py > > Traceback (most recent call last): > > File "./uno.py", line 1, in > > from . import db > > Syste

Re: Python3 : import

2017-07-07 Thread Andrew Z
On Friday, July 7, 2017 at 4:00:51 PM UTC-4, Andrew Z wrote: > this has bee driving me nutz for the past few hours. > 2 modules are in the same directory. I want to be able to use them both: > > [code] > > [az@hp tst1]$ pwd > /home/az/Dropbox/work/Prjs/tst1 > > [az

Re: Python3 : import

2017-07-07 Thread Andrew Z
On Friday, July 7, 2017 at 4:00:51 PM UTC-4, Andrew Z wrote: > this has bee driving me nutz for the past few hours. > 2 modules are in the same directory. I want to be able to use them both: > > [code] > > [az@hp tst1]$ pwd > /home/az/Dropbox/work/Prjs/tst1 > > [az

Python3 : import

2017-07-07 Thread Andrew Z
this has bee driving me nutz for the past few hours. 2 modules are in the same directory. I want to be able to use them both: [code] [az@hp tst1]$ pwd /home/az/Dropbox/work/Prjs/tst1 [az@hp tst1]$ ls -l total 16 -rw-rw-r--. 1 az az 66 Jul 7 12:58 db.py -rw-rw-r--. 1 az az 182 Jul 7 15:54 uno.

Proper architecture

2017-07-02 Thread Andrew Z
Hello, I'd appreciate your suggestions for a better approach to the following task. I have 2 files ( 2 classes). One (ClassA) has all logic related to the main workflow of the program. Another (DB), I like to offload all operations with a DB ( sql3 in this case). I'm trying to pass the connect

math functions with non numeric args

2013-06-30 Thread Andrew Z
Hello, print max(-10, 10) 10 print max('-10', 10) -10 My guess max converts string to number bye decoding each of the characters to it's ASCII equivalent? Where can i read more on exactly how the situations like these are dealt with? Thank you AZ -- http://mail.python.org/mailman/listinfo/pyth

IndexError: pop index out of range

2013-05-14 Thread Andrew Z
hello, going fru some basic examples and can't figureout why the following errors out. Help is very much appreciated: def front_x(words): # +++your code here+++ print "words passed : ", words list_xx = [] list_temp = words[:] print "list_temp -", list_temp print "words -", w

pexpect on windows - child process of another child process - quick question

2013-03-09 Thread Z W
Hi All We have a windows application to install on console mode typing on cygwin shell "app.exe -i console" On Windows process window, we could see this kicks a process named ia which in turn kicks off ia_launcher to kick off another java.exe process. ie app.exe -- kick off --> ia --> kicks off -

Re: noob: print and file.read()

2012-12-03 Thread Andrew Z
Mrab, you nailed it. thank you very much! AZ -- http://mail.python.org/mailman/listinfo/python-list

noob: print and file.read()

2012-12-03 Thread Andrew Z
Hello, why the following code doesn't print the content of the file: #!/usr/bin/python from_file ="file.txt" in_file = open(from_file) str = in_file.read() print "Here should be the output from the file - ", in_file.read() print "Here should be the output from the STR- ", str in_file.close() Th

Re: Help: PYMALLOC_DBUG and PIL

2012-07-05 Thread tom z
Thanks Roman. of course, i use PYMALLOC_DEBUG with PYMALLOC. -- http://mail.python.org/mailman/listinfo/python-list

Help: PYMALLOC_DBUG and PIL

2012-07-04 Thread tom z
Hi~ all, I encounter a odd problem, when i compile Python with PYMALLOC_DEBUG, the PIL module can't work fine, it always make core-dump like this [Switching to Thread 182897301792 (LWP 16102)] 0x004df264 in PyObject_Malloc (nbytes=64) at Objects/obmalloc.c:804 804 if ((pool

Help: python unicode

2011-02-17 Thread tom z
Hi all~ My script can't work.I've changed my defaultencoding from 'ascii' to 'utf-8',but Python also raises a 'UnicodeEncodeError' error. the error likes this: >>> s=u'La Pe\xf1a' >>>print s UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 5: ... And in my script, the

Parsing error for ConfigParser

2010-09-23 Thread Andrew Z.
Is there a way to parse RealPlayer's realplayerrc in Python? I need to support Python 2.5 - 2.7 Example code import urllib2 import ConfigParser f = urllib2.urlopen('http://pastebin.com/download.php?i=N1AcUg3w') config = ConfigParser.RawConfigParser() config.readfp(f) Error Traceback (most rece

Re: Importing package on Windows XP

2010-04-22 Thread M.-H. Z
Problem solved! For those who wish to know, the actual problem was the following. In my project, I had a package called "parser". I works fine on Linux and Mac, but seems to conflict with other package on Windows. So the module I wanted to load was not found. I had to rename the package name... D'o

Re: Importing package on Windows XP

2010-04-22 Thread M.-H. Z
Dear Dave, You are absolutely right! I changed my code so many times that I got confused when writing the post. Actually, I tried "from mod import module1" and "import mod.module1". Of course, they led to the same error: the one that Peter pointed. Anyway, thanks a lot for your help! Matthias. (Yet

Re: Importing package on Windows XP

2010-04-22 Thread M.-H. Z
Darn! That was it! I was pretty stupid! I swear I will stop drinking vodka before 8am. However, it does not solve the problem on my main project (which was not this toy example of course), since the names were correct there. Keep on working. Thanks a lot, Peter, for reading my long post and helping

  1   2   >