[issue46703] boolean operation issue (True == False == False)
New submission from jung mo sohn : In python 3.6.8, 3.7.3, 3.7.4, 3.7.5, 3.7.12, 3.8.8 versions, the output is False as shown below. Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print(True == False == False) False However, in the openjdk1.8 version, the output is "true" as shown below. public class Test { public static void main(String[] args) throws Exception{ System.out.println(true == false == false); } } > java Test true In my opinion, "True" seems to be correct. -- components: Parser messages: 412961 nosy: jmsohn.x, lys.nikolaou, pablogsal priority: normal severity: normal status: open title: boolean operation issue (True == False == False) type: behavior versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46703> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38583] The activate script in Windows is not correct for venvs created in git-bash
Mo added the comment: I had also tested with pathlib and posixpath and come to the same conclusion. As suggested by you, I looked into `activate` determining path when run. I believe this should do the trick (My bashfoo isn't strong, this is mostly from https://stackoverflow.com/a/179231): pushd . > /dev/null SCRIPT_PATH="${BASH_SOURCE[0]}" if ([ -h "${SCRIPT_PATH}" ]); then while([ -h "${SCRIPT_PATH}" ]); do cd `dirname "$SCRIPT_PATH"`; SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done fi cd `dirname ${SCRIPT_PATH}` > /dev/null cd .. > /dev/null SCRIPT_PATH=`pwd`; popd > /dev/null VIRTUAL_ENV="$SCRIPT_PATH" -- ___ Python tracker <https://bugs.python.org/issue38583> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38583] The activate script in Windows is not correct for venvs created in git-bash
Mo added the comment: The issue comes as a result of abspath on line 59 of venv/__init__.py: env_dir = os.path.abspath(env_dir) This returns a Windows-style path, and os.path.abspath returning in this way is *probably* correct, as the OS is Windows, despite trying to forget that by using bash. It is still my view that the activate script is a bash script, and therefore should only contain paths in that style, but the simple solution to this issue is to change the double quotes around the definition of $VIRTUAL_ENV in the activate script to single quotes. It works. The output of "which python" is a bit odd, but this is clearly a quirk beyond Python's control. -- ___ Python tracker <https://bugs.python.org/issue38583> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38583] The activate script in Windows is not correct for venvs created in git-bash
New submission from Mo : When creating a virtual environment on Windows from git-bash (using python -m venv), VIRTUAL_ENV in the activate script is set using a windows style path (C:\some\path) instead of the bash style (/c/some/path). This means the system python and pip get used, despite the user thinking they are working in a venv after sourcing activate. As activate is a bash script, the paths in it should always be in the bash style, regardless of platform. This is described in a stack overflow issue here: https://stackoverflow.com/questions/57758841/windows-virtualenv-created-via-gitbash-using-system-python I have confirmed the behaviour in 3.7.3, 3.7.4, 3.7.5 and 3.8.0. -- components: Windows messages: 355333 nosy: Mo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: The activate script in Windows is not correct for venvs created in git-bash type: behavior versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue38583> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29191] liblzma is missing from pcbuild.sln
Mo Jia added the comment: I think let user add the liblzma project by hand is not good enough. While the build.bat don't have this problem. So they should work similar. -- nosy: +Mo.Jia versions: -Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29191> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29297] python3 open() does not check argument type before attempting to read() or write()
Mo Ali added the comment: Serhiy, I expected a type error or a filenotfound like you received, however mine doesn't return the same. It just hangs. I've attached a picture. Also, I meant this to be for 3.6 not 3.5. >>> test = False >>> with open(test) as f: ... fail = f.read() ... -- versions: +Python 3.6 -Python 3.5 Added file: http://bugs.python.org/file46315/Screen Shot 2017-01-17 at 10.09.35 AM.png ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29297> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29297] python3 open() does not check argument type before attempting to read() or write()
New submission from Mo Ali: Python3 open(), read(), or write()doesn't check argument type before action causing a hang. Would like to catch exceptions but not without an exception to return. See below. Python3.6: Python 3.6.0 (default, Dec 24 2016, 08:01:42) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> test = False >>> with open(str(test)) as f: ... fail = f.read() ... python2.7: ╰─λ python2 0 < 09:35:31 Python 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> test = False >>> with open(test) as f: ... fail = f.read() ... Traceback (most recent call last): File "", line 1, in TypeError: coercing to Unicode: need string or buffer, bool found -- messages: 285644 nosy: Mo Ali priority: normal severity: normal status: open title: python3 open() does not check argument type before attempting to read() or write() type: crash versions: Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29297> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21623] build ssl failed use vs2010 express
Mo Jia added the comment: @Roundup Robot . Clone the newest 3.4 tag. The unicode problem is ok now . @Zachary Ware , don't change anything after clone from the repo. What i do is just cd python src dir and runing : Tools\buildbot\build.bat . the openssl verison is 1.0.1g . Seem the external.bat don't build openssl . I see the readme The ssl.vcxproj sub-project simply invokes PCbuild/build_ssl.py, which locates and builds OpenSSL. Seem I don't need build the openssl by handle . After meet the error , I open the sln by vc2010 , and choose the ssl project build . Here is another error : 4 pymath.c 4 pytime.c 4 pystate.c 4 pystrcmp.c 4 pystrtod.c 4 dtoa.c 4 Python-ast.c 4 pythonrun.c 4 structmember.c 4 symtable.c 4 sysmodule.c 4 thread.c 4 traceback.c 4 Generating Code... 4 The syntax of the command is incorrect. 4 cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL -D_DEBUG -MDd ..\Modules\getbuildinfo.c -FoD:\Hg\Python\Python\PCbuild\Win32-temp-Debug\pythoncore\getbuildinfo.o -I..\Include -I..\PC 4 The syntax of the command is incorrect. 4 Creating library D:\Hg\Python\Python\PCbuild\python34_d.lib and object D:\Hg\Python\Python\PCbuild\python34_d.exp 4 pythoncore.vcxproj - D:\Hg\Python\Python\PCbuild\python34_d.dll 5-- Build started: Project: python, Configuration: Debug Win32 -- 5 python.c 5 python.vcxproj - D:\Hg\Python\Python\PCbuild\python_d.exe 6-- Build started: Project: ssl, Configuration: Debug Win32 -- 6 Found a working perl at 'D:\cygwin64\bin\perl.exe' 6 Executing ssl makefiles: nmake /nologo -f ms\nt.mak 6 The syntax of the command is incorrect. 6 Executing ms\nt.mak failed 6 1 6C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command cd D:\Hg\Python\Python\PCbuild\ 6C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: D:\Hg\Python\Python\PCbuild\python_d.exe build_ssl.py Release Win32 -a 6C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: exited with code 1. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21623 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21623] build ssl failed use vs2010 express
Mo Jia added the comment: Another error is . cd D:\Hg\Python\Python\PCbuild\ D:\Hg\Python\Python\PCbuild\python_d.exe build_ssl.py Release Win32 -a Found a working perl at 'C:\Perl\bin\perl.exe' Traceback (most recent call last): File build_ssl.py, line 253, in module main() File build_ssl.py, line 181, in main ssl_dir = get_ssl_dir() File build_ssl.py, line 70, in get_ssl_dir m = re.search('openssl-([^]+)', f.read()) UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command cd D:\Hg\Python\Python\PCbuild\ [D:\Hg\Python\Python\PCbuild\ssl. vcxproj] C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: D:\Hg\Python\Python\PCbuild\python_d.exe build_ssl.py Release Win32 -a [D:\Hg\ Python\Python\PCbuild\ssl.vcxproj] C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: exited with code 1. [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21623 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21623] build ssl failed use vs2010 express
New submission from Mo Jia: Here is the failed message . Project D:\Hg\Python\Python\PCbuild\_ssl.vcxproj (17) is building D:\Hg\Python\Python\PCbuild\ssl.vcxproj (18) on node 1 (default targets). Build: cd D:\Hg\Python\Python\PCbuild\ D:\Hg\Python\Python\PCbuild\python_d.exe build_ssl.py Release Win32 -a Found a working perl at 'C:\Perl\bin\perl.exe' Executing ssl makefiles: nmake /nologo -f ms\nt.mak Building OpenSSL copy .\crypto\buildinf.h tmp32\buildinf.h 1 file(s) copied. copy .\crypto\opensslconf.h inc32\openssl\opensslconf.h 1 file(s) copied. cl /Fotmp32\shatest.obj -Iinc32 -Itmp32 /MT /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_A SM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DOPENSSL_NO_IDEA -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_DYNA MIC_ENGINE /Zi /Fdtmp32/app -c .\crypto\sha\shatest.c shatest.c link /nologo /subsystem:console /opt:ref /debug /out:out32\shatest.exe @C:\Users\YANXIN~1\AppData\Local\Temp\nm306E.tmp libeay32.lib(b_print.obj) : error LNK2019: unresolved external symbol ___report_rangecheckfailure referenced in function _fmtfp [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] libeay32.lib(obj_dat.obj) : error LNK2001: unresolved external symbol ___report_rangecheckfailure [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] libeay32.lib(b_dump.obj) : error LNK2001: unresolved external symbol ___report_rangecheckfailure [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] libeay32.lib(pem_lib.obj) : error LNK2001: unresolved external symbol ___report_rangecheckfailure [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] out32\shatest.exe : fatal error LNK1120: 1 unresolved externals [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] NMAKE : fatal error U1077: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.EXE' : return code '0x460' [D:\Hg\Python\Python\PCbuild\ssl.vcxproj] Stop. Executing ms\nt.mak failed 2 -- components: Windows messages: 219482 nosy: Mo.Jia priority: normal severity: normal status: open title: build ssl failed use vs2010 express type: compile error versions: Python 3.4
looking for open source python project
looking for a python project (preferably something a bit small) that is looking for contributors. the small bit is because i've never worked in a team before and haven't really read source code that's 1000s of lines long, so i'm not too sure i can keep up. my python fu is decent (i think), i recently wrote a small archive/ grimoire program (command line only) that can store multiline text with title, tags, and basic search functionality (not using curses so the entry, once entered, can't be modified), entries are stored in a pickle file. anybody have any suggestions? i'm keen to work on something with others, both for learning and i'd like to do something a bit meaningful, plus i'm sure it's fun. -- http://mail.python.org/mailman/listinfo/python-list
Re: Personal archive tool, looking for suggestions on improving the code
On 27 Lug, 10:23, Peter Otten __pete...@web.de wrote: mo reina wrote: i've written a tool in python where you enter a title, content, then tags, and the entry is then saved in a pickle file. it was mainly designed for copy-paste functionality (you spot a piece of code you like on the net, copy it, and paste it into the program), not really for handwritten content, though it does that with no problem. i mainly did it because i'm always scanning through my pdf files, books, or the net for some coding example of solution that i'd already seen before, and it just seemed logical to have something where you could just put the content in, give it a title and tags, and just look it up whenever you needed to. i realize there are sites online that handle this ex. http://snippets.dzone.com, but i'm not always online when i code. i also admit that i didn't really look to see if anyone had written a desktop app, the project seemed like a fun thing to do so here i am. it wasn't designed with millions of entries in mind, so i just use a pickle file to serialize the data instead of one of the database APIs. the query is also very basic, only title and tags and no ranking based on the query. there is an issue that i can't figure out, when you are at the list of entries there's a try, except clause where it tries to catch a valid index (integer). if you enter an inavlid integer, it will ask you to enter a valid one, but it doesn't seem to be able to assign it to the variable. if you enter a valid integer straightaway, there are no problems and the entry will display. anyway let me know what you guys think. this is coded for python3. def choices(list_result): '''takes a list of objects and returns the index of the selected object''' os.system('clear') index = 0 for entry in list_result: print('{}. {}'.format(index, entry.title)) index += 1 try: choice = int(input('\nEnter choice: ')) return choice except: pause = input('\nplease enter a valid choice') choices(list_result) When the exception is triggered you call choices() recursively but discard the result. Therefore you get Python's default, None, which is not a valid index. Change the last line to return choices(list_result) for a minimal fix. However, I suggest that you use a while loop instead of the recursion: def choices(list_result): while True: os.system('clear') for index, entry in enumerate(list_result): print('{}. {}'.format(index, entry.title)) try: choice = int(input('\nEnter choice: ')) if 0 = choice len(list_result): return choice except ValueError: pass input('\nplease enter a valid choice') I've also added a test for the integer range and replaced the bare except with a more specific one. I recommend that you never use bare excepts because they can hide unexpected exceptions and lead to nasty bugs. You should also remove the recursive call of main(). Its only effect is that when you enter an invalid choice twice you will have to enter 5 twice to really exit your script. Peter hi peter, i noticed the issue you mentioned but don't understand why they happen. for example, when the function is called in the case of an exception, the variable choice is re-assigned to whatever the next input is, so why is the default None assigned instead? and what' s the difference between just calling the function again (the variable list_result remains unchanged) and using a return statement? i also don' t understand what happens when main is called recursively, the variable choice should be re-assigned to whatever the next input is, and yet it seems that in the first call, after an invalid choice, it doesn't assign the input to the variable. thanks for taking the time to post and review the code by the way, i really appreciate it -- http://mail.python.org/mailman/listinfo/python-list
Re: Personal archive tool, looking for suggestions on improving the code
On Jul 27, 2:06 pm, Peter Otten __pete...@web.de wrote: mo reina wrote: On 27 Lug, 10:23, Peter Otten __pete...@web.de wrote: mo reina wrote: i've written a tool in python where you enter a title, content, then tags, and the entry is then saved in a pickle file. it was mainly designed for copy-paste functionality (you spot a piece of code you like on the net, copy it, and paste it into the program), not really for handwritten content, though it does that with no problem. i mainly did it because i'm always scanning through my pdf files, books, or the net for some coding example of solution that i'd already seen before, and it just seemed logical to have something where you could just put the content in, give it a title and tags, and just look it up whenever you needed to. i realize there are sites online that handle this ex. http://snippets.dzone.com, but i'm not always online when i code. i also admit that i didn't really look to see if anyone had written a desktop app, the project seemed like a fun thing to do so here i am. it wasn't designed with millions of entries in mind, so i just use a pickle file to serialize the data instead of one of the database APIs. the query is also very basic, only title and tags and no ranking based on the query. there is an issue that i can't figure out, when you are at the list of entries there's a try, except clause where it tries to catch a valid index (integer). if you enter an inavlid integer, it will ask you to enter a valid one, but it doesn't seem to be able to assign it to the variable. if you enter a valid integer straightaway, there are no problems and the entry will display. anyway let me know what you guys think. this is coded for python3. def choices(list_result): '''takes a list of objects and returns the index of the selected object''' os.system('clear') index = 0 for entry in list_result: print('{}. {}'.format(index, entry.title)) index += 1 try: choice = int(input('\nEnter choice: ')) return choice except: pause = input('\nplease enter a valid choice') choices(list_result) When the exception is triggered you call choices() recursively but discard the result. Therefore you get Python's default, None, which is not a valid index. Change the last line to return choices(list_result) for a minimal fix. However, I suggest that you use a while loop instead of the recursion: def choices(list_result): while True: os.system('clear') for index, entry in enumerate(list_result): print('{}. {}'.format(index, entry.title)) try: choice = int(input('\nEnter choice: ')) if 0 = choice len(list_result): return choice except ValueError: pass input('\nplease enter a valid choice') I've also added a test for the integer range and replaced the bare except with a more specific one. I recommend that you never use bare excepts because they can hide unexpected exceptions and lead to nasty bugs. You should also remove the recursive call of main(). Its only effect is that when you enter an invalid choice twice you will have to enter 5 twice to really exit your script. Peter hi peter, i noticed the issue you mentioned but don't understand why they happen. for example, when the function is called in the case of an exception, the variable choice is re-assigned to whatever the next input is, so why is the default None assigned instead? and what' s the difference between just calling the function again (the variable list_result remains unchanged) and using a return statement? If you have a function def f(): return 42 and just call it from another function def g(): f() the result of f() is evaluated but immediately discarded. If you want to use it inside g() you have to assign it to a variable def g(): x = f() y = x * x print y and if you want to use it outside g() you can return it. def g(): return f() For recursion the same rules apply, only with the same function as f and g. Here's a simple example for you to work out the program flow: def r1(n): ... print entering level, n ... if n == 5: ... print limit reached ... print exiting level, n ... print returning 42 ... return 42 ... else: ... print recursing ... r1(n+1) ... print exiting level, n ... print (implicitly) returning None ... r1(0) entering level 0 recursing entering level 1 recursing entering level 2 recursing entering level 3 recursing entering level 4 recursing entering level 5 limit reached exiting level 5 returning 42 exiting level 4 (implicitly) returning None exiting level 3 (implicitly) returning None exiting level 2 (implicitly) returning None exiting level 1 (implicitly) returning None exiting level 0 (implicitly) returning None Try to change
Personal archive tool, looking for suggestions on improving the code
0 down vote favorite i've written a tool in python where you enter a title, content, then tags, and the entry is then saved in a pickle file. it was mainly designed for copy-paste functionality (you spot a piece of code you like on the net, copy it, and paste it into the program), not really for handwritten content, though it does that with no problem. i mainly did it because i'm always scanning through my pdf files, books, or the net for some coding example of solution that i'd already seen before, and it just seemed logical to have something where you could just put the content in, give it a title and tags, and just look it up whenever you needed to. i realize there are sites online that handle this ex. http://snippets.dzone.com, but i'm not always online when i code. i also admit that i didn't really look to see if anyone had written a desktop app, the project seemed like a fun thing to do so here i am. it wasn't designed with millions of entries in mind, so i just use a pickle file to serialize the data instead of one of the database APIs. the query is also very basic, only title and tags and no ranking based on the query. there is an issue that i can't figure out, when you are at the list of entries there's a try, except clause where it tries to catch a valid index (integer). if you enter an inavlid integer, it will ask you to enter a valid one, but it doesn't seem to be able to assign it to the variable. if you enter a valid integer straightaway, there are no problems and the entry will display. anyway let me know what you guys think. this is coded for python3. main file: #!usr/bin/python from archive_functions import Entry, choices, print_choice, entry_query import os def main(): choice = '' while choice != 5: os.system('clear') print(Mo's Archive, please select an option) print('') print('1. Enter an entry') print('2. Lookup an entry') print('3. Display all entries') print('4. Delete an entry') print('5. Quit') print('') choice = input(':') if choice == 1: entry = Entry() entry.get_data() entry.save_data() elif choice == 2: queryset = input('Enter title or tag query: ') result = entry_query('entry.pickle', queryset) if result: print_choice(result, choices(result)) else: os.system('clear') print('No Match! Please try another query') pause = input('\npress [Enter] to continue...') elif choice == 3: queryset = 'all' result = entry_query('entry.pickle', queryset) if result: print_choice(result, choices(result)) elif choice == 4: queryset = input('Enter title or tag query: ') result = entry_query('entry.pickle', queryset) if result: entry = result[choices(result)] entry.del_data() else: os.system('clear') print('No Match! Please try another query') pause = input('\npress [Enter] to continue...') elif choice == 5: break else: input('please enter a valid choice...') main() if __name__ == __main__: main() archive_functions.py: #!/bin/usr/python import sys import pickle import os import re class Entry(): def get_data(self): self.title = input('enter a title: ') print('enter the code, press ctrl-d to end: ') self.code = sys.stdin.readlines() self.tags = input('enter tags: ') def save_data(self): with open('entry.pickle', 'ab') as f: pickle.dump(self, f) def del_data(self): with open('entry.pickle', 'rb') as f: data_list = [] while True: try: entry = pickle.load(f) if self.title == entry.title: continue data_list.append(entry) except: break with open('entry.pickle', 'wb') as f: pass with open('entry.pickle', 'ab') as f: for data in data_list: data.save_data() def entry_query(file, queryset): '''returns a list of objects matching the query''' result = [] try: with open(file, 'rb') as f: entry = pickle.load(f) os.system('clear') if queryset == all: while True: try: result.append(entry) entry = pickle.load(f) except: return result break while True: try: if re.search(queryset, entry.title) or re.search(queryset, entry.tags):
Re: python app development
On Jul 3, 9:59 pm, Terry Reedy tjre...@udel.edu wrote: On 7/3/2010 1:48 PM,mo reinawrote: an anyone recommend a resource (book,tutorial,etc.) that focuses on application development in python? something similar to Practical Django Projects, but for stand alone applications instead of web apps (for now). i'm in a bit of a funny place, i have a decent/good grasp of python syntax and my logic isn't bad, but i have no clue on how to assemble an application, i seem to be stuck on writing scripts. i've looked at the source of a few projects but the flow is way over my head, i understand the syntax but not the logic, which is why i'm looking for a project-cenetered learning resource, instead of a reference or language-feature resource. also, it seems that a lot of app programming is 90% gui bindings, with very little actual code, or am i totally way off mark? If the app is a gui app and if logic is overly intermixed with gui stuff, I am sure it can seem like that. Many recommend the MVC model-view-controller model for app design. Even that can be confusing; to me it should be model-controller-view, even though that is harder to say. What are the data (values and objects) and how are they stored? What are the rules for manipulating the data and objects? And then, and only then, how to communicate with the user? i recently picked up the django practical projects book, and in a few days i re-wrote a website i did with django. i feel it was the book's project-centric approach that made this possible. Another issue is who controls the flow of interactions, the user or the code. For instance, a gui form used for input tends to direct the user along a linear path. The same form, used for edit, presents existing data and allows the user to pick and choose the fields to edit. This distinction, along with MVC ideas, is important for reading source code. I have mostly seen this issue discussed in game reviews and game design writing. In computer games, there is the same general difference between a linear obstacle course game and a world to be explored in whatever order one wants. (And there are some with both an explorable world *and* a (somewhat optional) linear main quest line.) I am not familiar with any general app design books, but I have seen game design articles and books that are on a par with writing about web design. There are other books on business apps. -- Terry Jan Reedy so you're suggesting: -write core algorithm(model) -link algorithm(s) with each other and a central menu, if applicable(controller) -write views for gui or cli(view) this is actually the path that i follow when writing django apps, and is the sequence that is being used in Practical Django Projects, where first the different classes/data structures are written, then linked together through the url file, and finally html is written for each view. -- http://mail.python.org/mailman/listinfo/python-list
python app development
an anyone recommend a resource (book,tutorial,etc.) that focuses on application development in python? something similar to Practical Django Projects, but for stand alone applications instead of web apps (for now). i'm in a bit of a funny place, i have a decent/good grasp of python syntax and my logic isn't bad, but i have no clue on how to assemble an application, i seem to be stuck on writing scripts. i've looked at the source of a few projects but the flow is way over my head, i understand the syntax but not the logic, which is why i'm looking for a project-cenetered learning resource, instead of a reference or language-feature resource. also, it seems that a lot of app programming is 90% gui bindings, with very little actual code, or am i totally way off mark? i recently picked up the django practical projects book, and in a few days i re-wrote a website i did with django. i feel it was the book's project-centric approach that made this possible. -- http://mail.python.org/mailman/listinfo/python-list
Name 'NewAxis' is not defined
I found such a script - a gas model. http://des.memphis.edu/lurbano/vpython/gas/Temp_KE_07.py Can anybody help and find a mistake. There is a message: Name 'NewAxis' is not defined. I tried Python 25 with numpy 121 and Python 26 with scipy 071. (Win Vista). -- mo (not proffessional programmer ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: how to stop a loop with ESC key? [newbie]
Thanks, I tryed your example: import msvcrt while 1: print '.' if msvcrt.kbhit() and msvcrt.getch() == chr(27): break but it doesn't work. It is running (Win2000), there is no messages about errors but there is no effect when pressing ESC key. What I am doing wrong? mo -- http://mail.python.org/mailman/listinfo/python-list
Re: how to stop a loop with ESC key? [newbie]
Fredrik Lundh wrote: works for me, when running it from a stock CPython interpreter in a windows console window, with focus set to that window. what environment are you using? I use IDLE 1.0.3, Python 2.3.4 The same problem is when running in a win console. mo -- http://mail.python.org/mailman/listinfo/python-list
how to stop a loop with ESC key? [newbie]
Can somebody explain how to stop a WHILE loop in running program by pressing ESC key? mo -- http://mail.python.org/mailman/listinfo/python-list