oop issue

2022-05-23 Thread Tola Oj
i just finished learning oop as a beginner and trying to practice with it but i ran into this typeerror issue, help please. Traceback (most recent call last): File "c:\Users\ojomo\OneDrive\Desktop\myexcel\oop_learn.py\myExperiment.py\mainMain.py", line 36, in

oop issue

2022-05-23 Thread Tola Oj
i am trying to print this code but it keeps giving me this typeerror, please help. the csv file format i am trying to change into a list is in a different module. class invest_crypto: crypto_current_rate = 0.05 client_list = [] def __init__(self, name, surname, amount_Deposited,

upgrade pip

2022-04-22 Thread Tola Oj
im trying to upgrade my pip so i can install openpyxl. i though i had successfully upgraded pip, and then I was trying to install openpyxl, but I was getting this: C:\Users\ojomo>"C:\Program Files\Python310\python.exe" -m pip install --upgrade Traceback (most recent call last): File "C:\Program

struggle to upgrade pip on visual studio code

2022-04-22 Thread Tola Oj
hello, i successfully installed openpyxl but it is saying this about my pip: WARNING: You are using pip version 22.0.2; however, version 22.0.4 is available.You should consider upgrading via the 'C:\Program Files\Python310\python.exe -m pip install --upgrade pip' command. And then when I try to

code issue

2022-04-21 Thread Tola Oj
given a number n, for each integer i in the range from 1 to n inclusive, print one value per line as follows: . if i is a multiple of both 3 but not 5, print fizz. .if i is a multiple of 5 but not 3, print buzz .if i is not a multiple of 3 or 5, print the value of i. the above is the question.

code confusion

2022-04-15 Thread Tola Oj
i = int(input()) lis = list(map(int,input().strip().split()))[:i] z = max(lis) while max(lis) == z: lis.remove(max(lis)) print (max(lis)) this is an answer to a question from the discussion chat in hackerrank. i didn't know the answer so i found an answer that fitted well to the question,

Idle no longer works

2012-08-11 Thread Opap-OJ
I can no longer open the Idle IDE for Python on Windows 7. For 3-5 years I used Idle for all my python work. But in January this happens: When I right click on a python file and choose open with Idle nothing happens. If I double-click on the file itself, it briefly opens an MS-DOS looking

Re: C Callback Function using ctypes

2011-03-26 Thread OJ
On 26 March 2011 12:55, OJ olej...@gmail.com wrote: 1. Use c_char_p instead of POINTER(c_char). 2. Use msg.value to obtain a Python string from the pointer. If I change to c_char_p, my program segfaults. If I use msg.value, I get this error message: Traceback (most recent call last

C Callback Function using ctypes

2011-03-25 Thread OJ
Hi I am opening a shared library which has defined the following callback prototype: extern void DebugMessage(int level, const char *message, ...); My implementation in Python looks like this: DEBUGFUNC = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.POINTER(ctypes.c_char)) def DebugMessage(lvl,

passing c_void_p to an library(.so) to c function

2011-03-25 Thread OJ
Hi I am trying to implement a python frontend for a c library. I can open the library successfully and call functions using ctypes. My challenge now is that this library are using plugins, which is also libraries (.so on linux). The library function for adding these plugins expects a viod * to

Re: Difference between type and class

2008-07-31 Thread oj
On Jul 31, 11:37 am, Nikolaus Rath [EMAIL PROTECTED] wrote: So why does Python distinguish between e.g. the type 'int' and the class 'myclass'? Why can't I say that 'int' is a class and 'myclass' is a type? I might be wrong here, but I think the point is that there is no distinction. A class

Re: Calling external program from within python

2008-07-25 Thread oj
On Jul 25, 3:44 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Because usually if a program *prompts* the user to enter input (and that was what I read from the OP's post), one has to deal with pseudo terminals, not with stdin/out. How does the program writing some text before taking input

Re: trying to match a string

2008-07-21 Thread oj
On Jul 19, 3:04 am, Andrew Freeman [EMAIL PROTECTED] wrote: let me revise it please: To show if valid: if re.search(r'^[LRM]*$', 'LM'):     print 'Valid' Fine, this works, although match instead of search blah blah blah as has already been mentioned. I still think searching for one invalid

Re: trying to match a string

2008-07-21 Thread oj
On Jul 21, 11:04 am, Fredrik Lundh [EMAIL PROTECTED] wrote: The drawback is that it's a lot easier to mess up the edge cases if you do that (as this thread has shown).  The small speedup you get in typical cases is quickly offset by extra debugging/testing time (or, for that matter, arguing

Re: trying to match a string

2008-07-18 Thread oj
On Jul 18, 11:33 am, [EMAIL PROTECTED] wrote: Hi, Hi, I am taking a string as an input from the user and it should only contain the chars:L , M or R I tried the folllowing in kodos but they are still not perfect: [^A-K,^N-Q,^S-Z,^0-9] [L][M][R] [LRM]?L?[LRM]? etc but they do not

Re: trying to match a string

2008-07-18 Thread oj
On Jul 18, 12:10 pm, John Machin [EMAIL PROTECTED] wrote: On Jul 18, 9:05 pm, oj [EMAIL PROTECTED] wrote: On Jul 18, 11:33 am, [EMAIL PROTECTED] wrote: Hi, Hi, I am taking a string as an input from the user and it should only contain the chars:L , M or R I tried

Re: trying to match a string

2008-07-18 Thread oj
Why not just use * instead of + like: if re.search(r'^[^LRM]*$', var): # note: ^ outside [] is start of string; $ means end of string    print Invalid This will *only* print invalid when there is a character other than L, R, or M or a empty string. Sorry, forget the beginning and

Re: Do we have perl's Data::Dumper equivalent in Python??

2008-07-14 Thread oj
On Jul 14, 11:41 am, srinivasan srinivas [EMAIL PROTECTED] wrote: Thanks, Srini       Bollywood, fun, friendship, sports and more. You name it, we have it onhttp://in.promos.yahoo.com/groups/bestofyahoo/ You might have more luck asking for help if you explained what Perl's Data::Dumper

Re: caseless dict - questions

2008-07-08 Thread oj
On Jul 5, 1:57 am, Phoe6 [EMAIL PROTECTED] wrote: I have a requirement for using caseless dict. I searched the web for many different implementations and found one snippet which was implemented in minimal and useful way. # import UserDict class CaseInsensitiveDict(dict,

Re: Email Validation with domain

2008-07-02 Thread oj
On Jul 2, 12:41 pm, Sallu [EMAIL PROTECTED] wrote: Hi All,   import re msg=raw_input('Enter the email : ') def validateEmail(email):         #if re.match(^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9] {1,3})(\\]?)$, email) != None:         if re.match(^([EMAIL

Re: n00bie wants advice.

2008-07-02 Thread oj
On Jul 2, 7:25 am, [EMAIL PROTECTED] wrote: This simple script writes html color codes that can be viewed in a browser.  I used short form hex codes (fff or 000, etc) and my list has only six hex numbers otherwise the results get rather large. I invite criticism as to whether my code is

Re: simple UnZip

2008-07-02 Thread oj
On Jul 2, 2:39 pm, noydb [EMAIL PROTECTED] wrote: Can someone help me with this script, which I found posted elsewhere? I'm trying to figure out what is going on here so that I can alter it for my needs, but the lack of descriptive names is making it difficult.  And, the script doesn't quite

recursive import

2008-07-01 Thread oj
Hi, I'm just toying around with some ideas at the moment. Is there an easy and safe way to recursivly import all modules under a particular namespace? Say, I had modules: foo foo.bar foo.bar.baz foo.baz bar bar.baz I want to import all the modules in the foo namespace, so the first four

Using eggs

2008-01-11 Thread oj
Hi all! As is about to become apparent, I really don't know what I'm doing when it comes to using eggs. I'm writing some software that is going to be deployed on a machine as a number of eggs. Which is all well and good. These eggs all end up depending on each other; modules in egg A want to

Re: Magic function

2008-01-11 Thread oj
On Jan 11, 4:29 pm, [EMAIL PROTECTED] wrote: Hi all, I'm part of a small team writing a Python package for a scientific computing project. The idea is to make it easy to use for relatively inexperienced programmers. As part of that aim, we're using what we're calling 'magic functions', and

Re: Is Python really a scripting language?

2007-12-12 Thread oj
On Dec 12, 4:34 am, Terry Reedy [EMAIL PROTECTED] wrote: Ron Provost [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] But here's my problem, most of my coworkers, when they see my apps and learn that they are written in Python ask questions like, Why would you write that in a

Re: sqlite or xml

2007-12-07 Thread oj
On Dec 6, 8:21 pm, Kelie [EMAIL PROTECTED] wrote: Hello group, If I need store and use a couple thousand of people's contact info: first name, last name, phone, fax, email, address, etc. I'm thinking of using either sqlite or xml. Which one is better? My understanding is if there is large

Re: logging and propagation

2007-11-22 Thread oj
On Nov 22, 5:44 am, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 21, 11:38 am, oj [EMAIL PROTECTED] wrote: Hi, I want to setuploggingwith two loggers: The child logger is used when something different needs to be done with the log record, and the log record will propagate

Re: Problems with if/elif statement syntax

2007-11-22 Thread oj
On Nov 22, 11:09 am, Neil Webster [EMAIL PROTECTED] wrote: Hi all, I'm sure I'm doing something wrong but after lots of searching and reading I can't work it out and was wondering if anybody can help? I've got the following block of code: if a = 20 and a 100: if c

Re: how terminate console(not Ctrl-C)

2007-11-22 Thread oj
On Nov 22, 3:58 am, NoName [EMAIL PROTECTED] wrote: Is it possible to interrupt loop (program) by pressing Q key like Ctrl- C? how can i hook user's keypress while program running? thnx There's a quite complicated example here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/203830

Re: foldr function in Python

2007-11-22 Thread oj
On Nov 22, 3:02 pm, Ant [EMAIL PROTECTED] wrote: Hi all, I've just been reading with interest this article:http://caos.di.uminho.pt/~ulisses/blog/2007/11/20/foldr-the-magic-fun... It's a useful function that (with a more intuitive name) could prove a compelling addition to the itertools

logging and propagation

2007-11-21 Thread oj
Hi, I want to setup logging with two loggers: The child logger is used when something different needs to be done with the log record, and the log record will propagate and be logged by the root logger as usual. However, there are certain times when I don't want a log record to propagate from

Re: logging and propagation

2007-11-21 Thread oj
On Nov 21, 11:48 am, Paul Rudin [EMAIL PROTECTED] wrote: oj [EMAIL PROTECTED] writes: Hi, I want to setup logging with two loggers: The child logger is used when something different needs to be done with the log record, and the log record will propagate and be logged by the root

Re: logging.SocketHandler connections

2007-11-21 Thread oj
On Nov 20, 8:32 pm, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 20, 1:47 pm, oj [EMAIL PROTECTED] wrote: On Nov 20, 12:26 pm, Vinay Sajip [EMAIL PROTECTED] wrote: Can you confirm that if you add the while loop back in, all messages are seen by the server? It worked for me. Yes

Re: logging.SocketHandler connections

2007-11-20 Thread oj
On Nov 19, 5:30 pm, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 19, 10:27 am, oj [EMAIL PROTECTED] wrote: On Nov 16, 2:31 pm, Vinay Sajip [EMAIL PROTECTED] wrote: Here is the server code. Pretty much directly copied from the example, aside from not having the the handler loop forever

Re: logging.SocketHandler connections

2007-11-20 Thread oj
On Nov 20, 12:26 pm, Vinay Sajip [EMAIL PROTECTED] wrote: Can you confirm that if you add the while loop back in, all messages are seen by the server? It worked for me. Yes, it works in that case. This was meant to be implied by my earlier messages, but on reflection, isn't obvious. As I said

Re: logging.SocketHandler connections

2007-11-19 Thread oj
On Nov 16, 2:31 pm, Vinay Sajip [EMAIL PROTECTED] wrote: On Nov 15, 3:23 pm, oj [EMAIL PROTECTED] wrote: However, initially, I had tried it with a server that closed the connection after receiving each record, and the SocketHandler doesn't seem to behave as advertised. My test script

logging.SocketHandler connections

2007-11-15 Thread oj
Hi folks, I'm writing some fairly simple logging code that makes use of the SocketHandler. The example server code works fine, as expected. (http:// docs.python.org/lib/network-logging.html) However, initially, I had tried it with a server that closed the connection after receiving each record,