Making a Python program into an executable file
Dear Python team, I am trying to find out how to make my Python programs into executable files (.exe, I presume) using Pyinstaller. I searched on line for how to do this (the document I came across is headed Data to Fish), and it seemed that Step 1 was to download the most recent version of Python and click the Add Python to Path option. I tried to do this, but was given the option to Upgrade Python, and once I did this the Add Python to Path option seemed not to be available. Can you advise me what to do? Best wishes, Brian -- https://mail.python.org/mailman/listinfo/python-list
Re: What to do to correct the error written below:
On Mon, 11 Apr 2022 00:14:49 -0700 (PDT), NArshad wrote: [snip] > books = list(models.Book.objects.filter(isbn=i.isbn)) > students = list(models.Student.objects.filter(user=i.student_id)) > i=0 > for l in books: > > t=(students[i].user,students[i].user_id,books[i].name,books[i].isbn,issuedBooks[0].issued_date,issuedBooks[0].expiry_date,fine) > i=i+1 > details.append(t) [snip] Is this homework? In this newsgroup, by custom, homework problems should be announced as such, since the best answer to a homework question is different from the best answer to a real-life problem. Back to the problem: By looping over elements in "books" and incrementing counter i, which is used as an index both for "books" and for "students", you will produce an error whenever the number of books exceeds the number of students. Is there some reason to assume that the number of books cannot exceed the number of students? -- To email me, substitute nowhere->runbox, invalid->com. -- https://mail.python.org/mailman/listinfo/python-list
Re: What to do to correct the error written below:
On 11 Apr 2022 14:28:51 GMT, Peter Pearson declaimed the following: >Is this homework? In this newsgroup, by custom, homework problems >should be announced as such, since the best answer to a homework >question is different from the best answer to a real-life problem. > It's a return to a long cryptic thread from January... <199c23c7-de58-44ae-a216-760c8f36c5...@googlegroups.com> "What to write or search on github to get the code for what is written below:" It is nice to see that the insistence on using Excel for the data storage seems to have been dropped (at least, the code shown appears to be something like SQLAlchemy), but the OP really should spend a few weeks studying database normalization and use of foreign keys -- concepts which, properly applied, means there is no need for these confusing hand-tracked indices. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: What to do to correct the error written below:
On Mon, 11 Apr 2022 00:14:49 -0700 (PDT), NArshad declaimed the following: >for i in issuedBooks: Loop control variable is "i"... >i=0 Control variable "i" has been overwritten so any use of "i" following this is suspicious >for l in books: Inner-loop control variable is "l" -- and does not seem to be used for anything following... > > t=(students[i].user,students[i].user_id,books[i].name,books[i].isbn,issuedBooks[0].issued_date,issuedBooks[0].expiry_date,fine) >i=i+1 -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Making a Python program into an executable file
On 4/11/22 10:13, Brian Wagstaff via Python-list wrote: > Dear Python team, > I am trying to find out how to make my Python programs into executable files > (.exe, I presume) using Pyinstaller. I searched on line for how to do this > (the document I came across is headed Data to Fish), and it seemed that Step > 1 was to download the most recent version of Python and click the Add Python > to Path option. I tried to do this, but was given the option to Upgrade > Python, and once I did this the Add Python to Path option seemed not to be > available. Can you advise me what to do? > Best wishes, > Brian Presuming this is Windows because it sounds like it (hint: it's useful to say), you can rerun the installer from the Apps & Features applet by clicking on Python and then selecting Modify (the option actually says "Add Python to environment variables"). How to make an "executable" depends on whether you require to include a copy of Python with that, or not. There are a larger number of approaches for the latter than the former. zipapps come close for the latter, if you get your entry point set up right; there's some logic described there for building an exe as well, but it's a little tricky to get right. There's a project called Shiv (search pypi.org to find this one) that attempts to simplify that. An approach that doesn't get mentioned often (and with which I have no experience): https://bazel.build/docs/windows#python You might also want to look into BeeWare if you want to make a self-contained app your of your program. Nice work happening in that project. -- https://mail.python.org/mailman/listinfo/python-list
Re: Comparing sequences with range objects
Op 11/04/2022 om 02:01 schreef duncan smith: On 10/04/2022 21:20, Antoon Pardon wrote: Op 9/04/2022 om 02:01 schreef duncan smith: On 08/04/2022 22:08, Antoon Pardon wrote: Well my first thought is that a bitset makes it less obvious to calulate the size of the set or to iterate over its elements. But it is an idea worth exploring. def popcount(n): """ Returns the number of set bits in n """ cnt = 0 while n: n &= n - 1 cnt += 1 return cnt and not tested, def iterinds(n): """ Returns a generator of the indices of the set bits of n """ i = 0 while n: if n & 1: yield i n = n >> 1 i += 1 Sure but these seem rather naive implementation with a time complexity of O(n) where n is the maximum number of possible elements. Using these would turn my O(n) algorithm in a O(n^2) algorithm. I thought your main concern was memory. Of course, dependent on various factors, you might be able to do much better than the above. But I don't know what your O(n) algorithm is, how using a bitset would make it O(n^2), or if the O(n^2) algorithm would actually be slower for typical n. The overall thing sounds broadly like some of the blocking and clustering methods I've come across in record linkage. Using bitsets would make change my algorithm from O(n) into O(n^2) because the bitset operations are O(n) instead of O(1). If I have a 2 people a bitset will take a vector of about 300, 64bit words. With 4 people the bitset will take a vector of about 600. So doubling the population will also double the time for the bitset operations, meaning doubling the population will increase execution time four times. -- https://mail.python.org/mailman/listinfo/python-list
Re: Comparing sequences with range objects
Op 11/04/2022 om 02:31 schreef Dan Stromberg: It sounds a little like you're looking for interval arithmetic. Maybe https://pypi.org/project/python-intervals/1.5.3/ ? Not completely but it suggested an idea to explore. -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list