Problem upgrading pip and installing pygame

2022-01-31 Thread ojomooluwatolami675


Good morning, Python. I am having trouble installing pygame. it keeps saying to 
upgrade my pip version which I have done several times. then when I tried 
importing python to see if it has worked, in the ide it says the module does 
not exist or something along that line. what do I do please? Thanks.

Sent from my iPhone
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to write or search on github to get the code for what is written below:

2022-01-31 Thread NArshad
What about CGI?
Do you know any Library Management System based on CGI just like the one on 
Django?

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to write or search on github to get the code for what is written below:

2022-01-31 Thread Chris Angelico
On Tue, 1 Feb 2022 at 02:38, NArshad  wrote:
>
> What about CGI?
> Do you know any Library Management System based on CGI just like the one on 
> Django?
>

Have you done any research, or are you just picking up a new acronym
to see if you can suck some more volunteer time out of this list?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem upgrading pip and installing pygame

2022-01-31 Thread Dennis Lee Bieber
On Mon, 31 Jan 2022 14:18:47 +, ojomooluwatolami...@gmail.com declaimed
the following:

>
>Good morning, Python. I am having trouble installing pygame. it keeps saying 
>to upgrade my pip version which I have done several times. then when I tried 
>importing python to see if it has worked, in the ide it says the module does 
>not exist or something along that line. what do I do please? Thanks.

Where to begin... "importing python" is never done -- python is the
language and its interpreter/compiler.

Which "ide"?

Show us the EXACT operations you are performing and the results... [NOT
SCREEN CAPTURES -- this forum strips non-text attachments; select the TEXT
and cut&paste that]


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What to write or search on github to get the code for what is written below:

2022-01-31 Thread Dennis Lee Bieber
On Mon, 31 Jan 2022 01:32:15 -0800 (PST), NArshad 
declaimed the following:

>What about CGI?
>Do you know any Library Management System based on CGI just like the one on 
>Django?

Pure CGI is 30 year old technology...
https://en.wikipedia.org/wiki/Common_Gateway_Interface

To use it will require a properly configured web-server and lots of
individual script files. For a monolithic Python application you may want
to study https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface (which
will still require a properly configured web-server).

https://docs.python.org/3/library/cgi.html

You'll still have write the HTML for the pages to be displayed
(possibly via template engines as used by Django, Flask, Pylons, Zope), and
maybe CSS (pure HTML just describes /what/ to render, leaving it up to the
browser to do that rendering -- CSS adds lots of overhead to control how
the rendering is done).





You have now spent a MONTH asking people to provide you with pre-built
solutions to a problem description that is so vaguely specified that no one
here would even consider a solution on that model. You have been provided
links to possible approaches and technologies which might be used by you to
write code for your requirements. 

In this month you have never shown us actual sample data (export your
spreadsheet as CSV so you can paste text into a post). You have shown us
less than 10 lines of code (which, again, can not be evaluated as they were
incomplete and you provided no data against which to run them). You grab at
any acronym mentioned in replies as if it will magically create your
solution but don't seem to spend time learning about those technologies to
understand what they do (CGI is a method by which a web page can send data
to a web server, and the web server then starts a program passing the data
on to the program... THAT IS ALL IT DOES -- you still have to create the
HTML forms AND the scripts that process the data).

Your original post(s) stated you were under a time crunch and didn't
have time to write everything... But you seem to have lots of time to keep
asking others to find a solution for you to copy. A rank beginner in
Python* should have been able to write minimal code to access the data,
even if the user interface is just a text console:

ENTER USERNAME> 
ENTER TITLE OF INTEREST> ...
# copies are available for /title/
RESERVE COPY (Y/N)> ...


After all this time, my recommendation is that you go to whoever gave
you this assignment and flat out tell them you are unable to provide the
solution and need to be replaced.

It's that, or do a massive editing session to produce a few hundred
lines of code that at least attempts to solve part of your assignment and
hope for an extension on the due date. You have a number of things to
consider:
User Interface:
1   text console (maybe with use of curses to create forms)
2   local GUI app (Tkinter, GTK, or wX libraries)
3   web-based app (HTML, web-framework, web-server config)
Data Storage:
1   your insistence on an Excel spreadsheet
(the most complex solution as it does not handle
concurrent access -- so you need some means of 
locking it to only one user for the entire time of a
session)
2   relational database
(one time import, and need to provide functions to allow
for complete management of the data, not just one
"reserve" function. option for on-demand export for
post-process reporting)
User Management:
you need some means to control who can perform operations
on the data -- this could be additional tables in a database.





*
{Given the first edition O'Reilly Python book, and an Amiga port of Python
1.x -- it took me a week to produce a rudimentary SMTP sending daemon using
my ISP SMTPd for relay... I had to do this as the first SMTP sending
program I'd obtained often hung up trying to send mails (this was back in
the day when it was common to send mail directly to the destination host;
but it didn't do MX lookup; some addresses didn't run receiving SMTPd); the
second program did relay via ISP but never processed CC: or BCC: addresses,
only TO: addresses. Oh, this was also back in the days when mail clients
only handled local mailboxes, and did not send/receive messages -- one had
to invoke scripts to queue outgoing messages for sending, and others to
fetch from POP3 servers. I'll admit I couldn't do that now -- the need for
SSL/TLS protocols complicates things.}





-- 

Re: Problem upgrading pip and installing pygame

2022-01-31 Thread Mats Wichmann
On 1/31/22 07:18, ojomooluwatolami...@gmail.com wrote:
> 
> Good morning, Python. I am having trouble installing pygame. it keeps saying 
> to upgrade my pip version which I have done several times. then when I tried 
> importing python to see if it has worked, in the ide it says the module does 
> not exist or something along that line. what do I do please? Thanks.
> 
> Sent from my iPhone


When Python can't find modules it's *always* a path problem - the
install went somewhere on the system, but not to the places the Python
you are using is looking in.

One suggestion that usually helps is to use pip as a module, then it
will match exactly the Python used, because you're actually using that
Python.  So for example, if the way you invoke Python is through the
Windows Python launcher "py", then use this line:

py -m pip install --upgrade pip pygame


should put things in the right place.

adjust according to your situation, which we can't guess at.



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: http.client and dns lookups

2022-01-31 Thread Dieter Maurer
Michael Welle wrote at 2022-1-30 09:18 +0100:
> ...
 The machine this is running on regularly switches
>its network configuration without restarting the Python application. Now
>it turns out that the application is still using an old, outdated dns
>server after such a network configuration switch.

It is unlikely that Python performs the host -> IP address translation
itself. Almost surely, the translation is delegated to functions
of the underlying C runtime library, e.g. "gethostbyname".
-- 
https://mail.python.org/mailman/listinfo/python-list


Segfault after deepcopy in a C extension

2022-01-31 Thread Marco Sulla
Well, this is more or less what I'm trying to do.

I have an immutable object. I would have copy.deepcopy() will return the
object itself if it's hashable. If not, it must return a deepcopy of it.

So I tried to implement a __deepcopy__ for the object. It segfaults if the
object is not hashable. And I don't understand why. gdb gives me an
incomprehensible backtrace. So I tried the old "print at each line", but
the segfault does not happen in the function. It happens when I quit REPL
or if I try to see the deepcopy.

What can I do to further debug it?

If someone is interested, this is the code:

PyObject* frozendict_deepcopy(PyObject* self, PyObject* memo) {
if (PyAnyFrozenDict_CheckExact(self)) {
frozendict_hash(self);

if (PyErr_Occurred()) {
PyErr_Clear();
}
else {
Py_INCREF(self);
return self;
}
}

if (! PyAnyFrozenDict_Check(self)) {
Py_RETURN_NOTIMPLEMENTED;
}

PyObject* d = PyDict_New();

if (d == NULL) {
return NULL;
}

PyObject* copy_module_name = NULL;
PyObject* copy_module = NULL;
PyObject* deepcopy_fun = NULL;
PyObject* args = NULL;
PyObject* res = NULL;

if (PyDict_Merge(d, self, 1)) {
goto end;
}
copy_module_name = PyUnicode_FromString("copy");

if (copy_module_name == NULL) {
goto end;
}

copy_module = PyImport_Import(copy_module_name);

if (copy_module == NULL) {
goto end;
}

deepcopy_fun = PyObject_GetAttrString(copy_module, "deepcopy");

if (deepcopy_fun == NULL) {
goto end;
}

args = PyTuple_New(2);

if (args == NULL) {
goto end;
}

PyTuple_SET_ITEM(args, 0, d);
PyTuple_SET_ITEM(args, 1, memo);

res = PyObject_CallObject(deepcopy_fun, args);

end:
Py_XDECREF(args);
Py_XDECREF(deepcopy_fun);
Py_XDECREF(copy_module);
Py_XDECREF(copy_module_name);
Py_DECREF(d);

return res;
}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Segfault after deepcopy in a C extension

2022-01-31 Thread Chris Angelico
On Tue, 1 Feb 2022 at 08:54, Marco Sulla  wrote:
> PyObject* d = PyDict_New();
> args = PyTuple_New(2);
> PyTuple_SET_ITEM(args, 0, d);
> PyTuple_SET_ITEM(args, 1, memo);
> Py_DECREF(d);
>

https://docs.python.org/3/c-api/tuple.html#c.PyTuple_SET_ITEM

SET_ITEM steals a reference, so you'll need to not also decref the
dict yourself.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Segfault after deepcopy in a C extension

2022-01-31 Thread Marco Sulla
and I had to Py_INCREF(memo)! Thank you A LOT!

On Mon, 31 Jan 2022 at 23:01, Chris Angelico  wrote:

> On Tue, 1 Feb 2022 at 08:54, Marco Sulla 
> wrote:
> > PyObject* d = PyDict_New();
> > args = PyTuple_New(2);
> > PyTuple_SET_ITEM(args, 0, d);
> > PyTuple_SET_ITEM(args, 1, memo);
> > Py_DECREF(d);
> >
>
> https://docs.python.org/3/c-api/tuple.html#c.PyTuple_SET_ITEM
>
> SET_ITEM steals a reference, so you'll need to not also decref the
> dict yourself.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list