Old DbaseV DOS Programmer wants to step over to new/actual modern program software
I'm a 25year DBASE-5 DOS programmer and want/have to step over to new program/platform software, because there is no future anymore for DOS after W-XP, I've been looking around for alternatives and cannot figure out where to start, I already have been learning the SQL with SSMS database system/script this is very important because I work mostly with large databases invoicing/stock/statements etc. I always manage my users with design-programs,windows-input,files-views, using custom made windows/input. I did all this in *.prg files with hard-coding. I have some ideas in mind like Java with (ECLIPS) because it is very popular, it is the most widely used and can get tutorials and videos all over the internet. I've read a lot of good things about Python, that it is much easier but too complicate to define what to choose, at the first place witch version 2.x or 3.x, a lot of IDE's to choose from, beside of that witch IDE with what pluggin. I'll need something suitable to manage/manipulate M-SQL. I have a lot of programs to rewrite and not much time, that's why it is very important to me to start with something appropriate with the best software combination that I can learn completely from the internet, cannot go back to the classroom, too old for that. I appreciate very much that any of you can help me to figure out to choose the right software combination for my new project. Thanks! -- https://mail.python.org/mailman/listinfo/python-list
-2146826246 in win32com.client for empty #N/A cell in Excel
Anyone know how to handle "#N/A" in Excel from win32com.client. I'm extracting data from an Excel file using win32com.client. Everything works fine except for when the value "#N/A" is entered in excel. An empty cell. I assumed I do something as if ws.Cells(r, c).Value is None: ... But that doesn't seem to work. When I debug the piece of code while handling #N/A in a cell the type of the cell according to win32com.client is int and the value in the cell is -2146826246. Chances are small just this number will appear in Excel, but it looks dirty to depend on that value to decide if a cell is empty. Looked around the net for a solution, but nothing came up so far. Anyone knows how to handle a "#N/A" cell in Excel in the proper way? Regards, Sven -- https://mail.python.org/mailman/listinfo/python-list
Re: Old DbaseV DOS Programmer wants to step over to new/actual modern program software
Hi, On Sun, Aug 16, 2015 at 12:40 PM, AGOSTINHO TEIXEIRA wrote: > I'm a 25year DBASE-5 DOS programmer and want/have to step over to new > program/platform software, because there is no future anymore for DOS after > W-XP, I've been looking around for alternatives and cannot figure out where > to start, I already have been learning the SQL with SSMS database > system/script this is very important because I work mostly with large > databases invoicing/stock/statements etc. I always manage my users with > design-programs,windows-input,files-views, using custom made windows/input. I > did all this in *.prg files with hard-coding. I have some ideas in mind like > Java with (ECLIPS) because it is very popular, it is the most widely used and > can get tutorials and videos all over the internet. I've read a lot of good > things about Python, that it is much easier but too complicate to define what > to choose, at the first place witch version 2.x or 3.x, a lot of IDE's to > choose from, beside of that witch IDE with what pluggin. I'll need something > suitable to manage/manipulat e > M-SQL. I have a lot of programs to rewrite and not much time, that's why it > is very important to me to start with something appropriate with the best > software combination that I can learn completely from the internet, cannot go > back to the classroom, too old for that. I appreciate very much that any of > you can help me to figure out to choose the right software combination for my > new project. Thanks! It really doesn't matter which language you choose for you implementation. You will still need to learn it somehow and understand how to operate with it and how to write a nice maintainable code with it. I'd suggest to go to some local college and get some knowledge about your language of the choice. Perl/python might be better. because with them you will be able to test you changes right away on the spot. Also make sure that you DBMS does have a ODBC driver so you can connect to the DB... Thank you. > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Old DbaseV DOS Programmer wants to step over to new/actual modern program software
On 08/16/2015 10:40 AM, AGOSTINHO TEIXEIRA wrote: > I'm a 25year DBASE-5 DOS programmer and want/have to step over to new > program/platform software, because there is no future anymore for DOS > after W-XP, I've been looking around for alternatives and cannot > figure out where to start, I already have been learning the SQL with > SSMS database system/script this is very important because I work > mostly with large databases invoicing/stock/statements etc. I always > manage my users with design-programs,windows-input,files-views, using > custom made windows/input. I did all this in *.prg files with > hard-coding. I have some ideas in mind like Java with (ECLIPS) > because it is very popular, it is the most widely used and can get > tutorials and videos all over the internet. I've read a lot of good > things about Python, that it is much easier but too complicate to > define what to choose, at the first place witch version 2.x or 3.x, a > lot of IDE's to choose from, beside of that witch IDE with what > pluggin. I'll need something suitable to manage/manipulate M-SQL. I > have a lot of programs to rewrite and not much time, that's why it is > very important to me to start with something appropriate with the > best software combination that I can learn completely from the > internet, cannot go back to the classroom, too old for that. I > appreciate very much that any of you can help me to figure out to > choose the right software combination for my new project. > Thanks! > Here're a couple of interesting projects that I found on a google search that might relate to what you're trying to do: http://www.python-camelot.com/ http://kivy.org/ But like the other poster said, take some time to learn a new language, such as Python. Things can get complicated in a hurry, but if you have a solid understanding of the language, it's doable. Also it is helpful if you have a good working knowledge of SQL. SQL is useful when interacting with a variety of database engines such as MS SQL, or a freely available one like PostgreSQL. Then there are dozens of different database access libraries and abstractions you can choose from such as SQLAlchemy. And for creating a GUI there are several different toolkits. As for the future of DOS, existing DOS programs including your DBASE-5 apps should continue running indefinitely with the wonderful DOSBox program: http://www.dosbox.com/. While it's aimed at running games, it runs business apps quite well. -- https://mail.python.org/mailman/listinfo/python-list
Re: Old DbaseV DOS Programmer wants to step over to new/actual modern program software
On Sunday, August 16, 2015 at 10:10:18 PM UTC+5:30, AGOSTINHO TEIXEIRA wrote: > I'm a 25year DBASE-5 DOS programmer and want/have to step over to new > program/platform software, because there is no future anymore for DOS after > W-XP, I've been looking around for alternatives and cannot figure out where > to start, I already have been learning the SQL with SSMS database > system/script this is very important because I work mostly with large > databases invoicing/stock/statements etc. I always manage my users with > design-programs,windows-input,files-views, using custom made windows/input. I > did all this in *.prg files with hard-coding. I have some ideas in mind like > Java with (ECLIPS) because it is very popular, it is the most widely used and > can get tutorials and videos all over the internet. I've read a lot of good > things about Python, that it is much easier but too complicate to define what > to choose, at the first place witch version 2.x or 3.x, a lot of IDE's to > choose from, beside of that witch IDE with what pluggin. I'll need something > suitable to manage/manipulat e M-SQL. I have a lot of programs to rewrite and not much time, that's why it is very important to me to start with something appropriate with the best software combination that I can learn completely from the internet, cannot go back to the classroom, too old for that. I appreciate very much that any of you can help me to figure out to choose the right software combination for my new project. Thanks! Questions 1. Are you talking MSQL, MS-SQL? Quite different and also different from MySQL 2. How bound are you to your DBMS? If you are going to anyway port DBase-V to a modern DBMS, you can as well choose a more python-friendly one -- one of postgres, MySql, Sqlite. Anyways... Assuming you are committed to MsSql, I'd suggest in sequence: 1. Forget about DBMS and study the python tutorial for a few days 2. Forget get about *your* DBMS and play around with Sqlite that runs out of the box. This will familiarize you with python's DBMS model without the headaches of installing many pieces of softwares 3. Pick a python MsSql library and port your stuff to that -- https://mail.python.org/mailman/listinfo/python-list
RE: -2146826246 in win32com.client for empty #N/A cell in Excel
> Date: Sun, 16 Aug 2015 09:53:32 -0700 > Subject: -2146826246 in win32com.client for empty #N/A cell in Excel > From: sven.bo...@gmail.com > To: python-list@python.org > > > Anyone know how to handle "#N/A" in Excel from win32com.client. > > I'm extracting data from an Excel file using win32com.client. Everything > works fine except for when the value "#N/A" is entered in excel. An empty > cell. I assumed I do something as > > if ws.Cells(r, c).Value is None: > ... > > But that doesn't seem to work. When I debug the piece of code while handling > #N/A in a cell the type of the cell according to win32com.client is int and > the value in the cell is -2146826246. Chances are small just this number will > appear in Excel, but it looks dirty to depend on that value to decide if a > cell is empty. Looked around the net for a solution, but nothing came up so > far. > > Anyone knows how to handle a "#N/A" cell in Excel in the proper way? > > Regards, > Sven > -- > https://mail.python.org/mailman/listinfo/python-list Hello, Does that number happen to be -1 * sys.maxint? Regards,Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list
Re: Old DbaseV DOS Programmer wants to step over to new/actual modern program software
On Sun, Aug 16, 2015 at 1:11 PM, Rustom Mody wrote: >> I have some ideas in mind like Java with (ECLIPS) because it is very >> popular, it is the most widely used and can get tutorials and videos all >> over the internet. >> I've read a lot of good things about Python, that it is much easier but too >> complicate to define what to choose, >> at the first place witch version 2.x or 3.x, a lot of IDE's to choose from, >> beside of that witch IDE with what pluggin. Hi, I am using python for years but still curious about best IDE to suggest newbies. IMHO - too many choices with no clear winner and each with its own flaws. For me two crucial features are: good autocompletion and ability to step over code in debugger. I'd try Eclipse+PyDev first and then additionally check PyCharm ($$$) for comparison (to see how "best free" compares to "good commercial") Vladimir https://itunes.apple.com/us/app/python-code-samples/id1025613117 -- https://mail.python.org/mailman/listinfo/python-list
Re: -2146826246 in win32com.client for empty #N/A cell in Excel
On Mon, Aug 17, 2015 at 3:27 AM, Albert-Jan Roskam wrote: > Does that number happen to be -1 * sys.maxint? No, it's -1 * 0x7ff5f806. As a signed 32-bit integer, it's 0x800a07fa. Does either of those numbers mean anything? Sven, you might do better to ask on a dedicated Python + Win32 mailing list; I haven't used Python on Windows much for a while. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
"no module named kivy" import error in ubuntu 14.04
Hi I am new to linux. I tried various things in attempt to install kivy. I installed python 2.7.10 (I think python3 was already installed in ubuntu 14.04). Then i downloaded kivy from https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, extracted it and tried to execute "python setup.py" inside the kivy folder. But it showed the error "no module named cython". Then I tried installing cython, it installed successfully but the command "python setup.py" still gave the error "no module named cython". Finally I installed kivy using instructions on this video: https://www.youtube.com/watch?v=mypVFCIIZtw. Now when i try to run the following commands: "$ cd (I used the actual path, i.e., "/usr/share/kivy-examples") $ cd demo/touchtracer $ python main.py" I am still getting the error:"ImportError: No module named kivy". Any help will be highly appreciated. Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
On 2015-08-16 20:16, shiva upreti wrote: Hi I am new to linux. I tried various things in attempt to install kivy. I installed python 2.7.10 (I think python3 was already installed in ubuntu 14.04). Then i downloaded kivy from https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, extracted it and tried to execute "python setup.py" inside the kivy folder. But it showed the error "no module named cython". Then I tried installing cython, it installed successfully but the command "python setup.py" still gave the error "no module named cython". Finally I installed kivy using instructions on this video: https://www.youtube.com/watch?v=mypVFCIIZtw. Now when i try to run the following commands: "$ cd (I used the actual path, i.e., "/usr/share/kivy-examples") $ cd demo/touchtracer $ python main.py" I am still getting the error:"ImportError: No module named kivy". Any help will be highly appreciated. Thanks. Do you know which Python they were installed into? Was it the system Python (you should probably leave that one alone) or the one that you installed? And which one is it trying to run? -- https://mail.python.org/mailman/listinfo/python-list
distutils error ?
I tried building the spammodule.c example described in the documentation section "Extending Python with C or C++." As shown the code compiles OK but generates a link error: LINK : error LNK2001: unresolved external symbol init_spam build\temp.win32-2.7\Release\_spam.lib : fatal error LNK1120: 1 unresolved externals I tried changing the name of the initialization function spam_system to init_spam and removed the static declaration. This compiled and linked without errors but generated a system error when _spam was imported. The same error occurs with Python 2.6 and the current compiler. The code and the setup.py file are shown below. setup.py: - from setuptools import setup, Extension setup(name='spam', version='0.1', description='test module', ext_modules=[Extension('_spam', ['spammodule.c'], include_dirs=[C:\Documents and Settings\Owner\Miniconda\include], )], ) sammodule.c -- #include static PyObject *SpamError; static PyObject * spam_system(PyObject *self, PyObject *args) { const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &command)) return NULL; sts = system(command); if (sts < 0) { PyErr_SetString(SpamError, "System command failed"); return NULL; } return PyLong_FromLong(sts); } static PyMethodDef SpamMethods[] = { {"system", spam_system, METH_VARARGS, "Execute a shell command."}, {NULL, NULL, 0, NULL}/* Sentinel */ }; PyMODINIT_FUNC initspam(void) { PyObject *m; m = Py_InitModule("spam", SpamMethods); if (m == NULL) return; SpamError = PyErr_NewException("spam.error", NULL, NULL); Py_INCREF(SpamError); PyModule_AddObject(m, "error", SpamError); } -- https://mail.python.org/mailman/listinfo/python-list
RPI.GPIO Help
Hello, all. I am hoping some people here are familiar with the RPi.GPIO python module for the Raspberry Pi. Very new to Python and electronics. Not to computing in general though. I posted for help about accepting key presses and then discovered that wiring up buttons directly to the Pi was 1/50th as difficult as I thought it would be so I am going a different route than keyboard emulation and needing GUI toolkits, etc. However, I am getting error messages with RPi.GPIO. I have three buttons, Red, Yellow and Blue in colour, attached to the Pi. The eventual goal is to have pressing one button result in changing the colour of an LED lightstrip to that colour and the Pi record how long the strip spent as each colour. For development purposes I have the controls near me and my desktop computer, and the Pi networked to this computer. For now I have each button press result in a print statement. When I get this working I will replace the print statements with the code to change colours on the LED strip using the Blinkstick module. This is the basic test code. import atexit import time from blinkstick import blinkstick import RPi.GPIO as GPIO led = blinkstick.find_first() colour = 0 timered = 0 timeyellow = 0 timeblue = 0 timestamp = time.strftime("%H:%M:%S") GPIO.setmode(GPIO.BCM) GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) def red_button(channel): colour = 1 print "Red Button Pressed" while colour == 1: timered += 1 def yellow_button(channel): colour = 2 print "Yellow Button Pressed" while colour == 2: timeyellow += 1 def blue_button(channel): colour = 3 print "Blue Button Pressed" while colour == 3: timeblue += 1 while True: GPIO.add_event_detect(22, GPIO.RISING, callback=red_button, bouncetime=200) GPIO.add_event_detect(23, GPIO.RISING, callback=yellow_button, bouncetime=200) GPIO.add_event_detect(24, GPIO.RISING, callback=blue_button, bouncetime=200) def exit_handler(): print '\033[0;41;37mRed Team:\033[0m ', timered print '\033[0;43;30mYellow Time:\033[0m ', timeyellow print '\033[0;44;37mBlue Time:\033[0m ', timeblue flog = open('flag1log.text', 'a') flog.write(timestamp + '\n' + 'Red Team: ' + str(timered) + '\n' + 'Yellow Team: ' + str(timeyellow) + '\n' + 'Blue Team: ' + str(timeblue) + '\n') flog.close() atexit.register(exit_handler) GPIO.cleanup() This results in the error message "RuntimeError: Conflicting edge detection already enabled for this GPIO channel". Running GPIO.cleanup() in the interpreter results in a message stating the GPIO pins are not assigned and there is nothing to cleanup. Removing line 40, the while True: line, removes the error, but the program does not sit and wait waiting for a button press, it just runs and ends a second later. There are other things this script will need, but this is the core function that I need to get working -pressing a button does what I want and the script keeps running so I can press another button if I want. If are familiar with the RPi.GPIO or see a more general Python mistake that could be affecting everything know I would appreciate your help. Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: -2146826246 in win32com.client for empty #N/A cell in Excel
For what it's worth, I use xlrd for this. http://www.python-excel.org/ Laura -- https://mail.python.org/mailman/listinfo/python-list
Re: Keypress Input
Thanks again to everyone who tried to help. Michael, I especially appreciate your encouragement and chiming in to point out that telling newbies to learn everything there is before posting question was not helpful in getting more people using Python. Have the Pi wired up directly to the buttons, read up on the GPIO library and I just posted for help regarding the error messages I am getting from my Python buttons script. Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
In a message of Sun, 16 Aug 2015 12:16:53 -0700, shiva upreti writes: >I am still getting the error:"ImportError: No module named kivy". > >Any help will be highly appreciated. >Thanks. The preferred way to install kivy with ubuntu is to follow the instructions here: http://kivy.org/docs/installation/installation-linux.html i.e. $ sudo apt-get install python3-kivy $ sudo apt-get install kivy-examples This assumes you want to use Python 3. See if this works, write back if it doesn't. Laura -- https://mail.python.org/mailman/listinfo/python-list
Re: RPI.GPIO Help
On 2015-08-16 20:40, John McKenzie wrote: Hello, all. I am hoping some people here are familiar with the RPi.GPIO python module for the Raspberry Pi. Very new to Python and electronics. Not to computing in general though. I posted for help about accepting key presses and then discovered that wiring up buttons directly to the Pi was 1/50th as difficult as I thought it would be so I am going a different route than keyboard emulation and needing GUI toolkits, etc. However, I am getting error messages with RPi.GPIO. I have three buttons, Red, Yellow and Blue in colour, attached to the Pi. The eventual goal is to have pressing one button result in changing the colour of an LED lightstrip to that colour and the Pi record how long the strip spent as each colour. For development purposes I have the controls near me and my desktop computer, and the Pi networked to this computer. For now I have each button press result in a print statement. When I get this working I will replace the print statements with the code to change colours on the LED strip using the Blinkstick module. This is the basic test code. import atexit import time from blinkstick import blinkstick import RPi.GPIO as GPIO led = blinkstick.find_first() colour = 0 timered = 0 timeyellow = 0 timeblue = 0 timestamp = time.strftime("%H:%M:%S") GPIO.setmode(GPIO.BCM) GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) def red_button(channel): colour = 1 print "Red Button Pressed" while colour == 1: timered += 1 def yellow_button(channel): colour = 2 print "Yellow Button Pressed" while colour == 2: timeyellow += 1 def blue_button(channel): colour = 3 print "Blue Button Pressed" while colour == 3: timeblue += 1 while True: GPIO.add_event_detect(22, GPIO.RISING, callback=red_button, bouncetime=200) GPIO.add_event_detect(23, GPIO.RISING, callback=yellow_button, bouncetime=200) GPIO.add_event_detect(24, GPIO.RISING, callback=blue_button, bouncetime=200) def exit_handler(): print '\033[0;41;37mRed Team:\033[0m ', timered print '\033[0;43;30mYellow Time:\033[0m ', timeyellow print '\033[0;44;37mBlue Time:\033[0m ', timeblue flog = open('flag1log.text', 'a') flog.write(timestamp + '\n' + 'Red Team: ' + str(timered) + '\n' + 'Yellow Team: ' + str(timeyellow) + '\n' + 'Blue Team: ' + str(timeblue) + '\n') flog.close() atexit.register(exit_handler) GPIO.cleanup() This results in the error message "RuntimeError: Conflicting edge detection already enabled for this GPIO channel". Running GPIO.cleanup() in the interpreter results in a message stating the GPIO pins are not assigned and there is nothing to cleanup. Removing line 40, the while True: line, removes the error, but the program does not sit and wait waiting for a button press, it just runs and ends a second later. There are other things this script will need, but this is the core function that I need to get working -pressing a button does what I want and the script keeps running so I can press another button if I want. If are familiar with the RPi.GPIO or see a more general Python mistake that could be affecting everything know I would appreciate your help. Thanks. I'm looking at this: http://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/ As far as I can tell, the 'add_event_detect' method adds a callback. However, you have it in a loop, so you're trying to add more than one callback (actually, the same one more than once!), which it doesn't like. You should add the callbacks only once and then have some kind of sleep or do-nothing loop, perhaps waiting for the signal to quit (I don't have a Raspberry Pi, so I don't know what the usual practice is). -- https://mail.python.org/mailman/listinfo/python-list
Re: -2146826246 in win32com.client for empty #N/A cell in Excel
On Sun, Aug 16, 2015, at 14:41, Chris Angelico wrote: > On Mon, Aug 17, 2015 at 3:27 AM, Albert-Jan Roskam > wrote: > > Does that number happen to be -1 * sys.maxint? > > No, it's -1 * 0x7ff5f806. As a signed 32-bit integer, it's 0x800a07fa. > Does either of those numbers mean anything? That's a COM error code, for Excel error 2042, which (unsurprisingly) means N/A. http://stackoverflow.com/questions/7526640/any-ideas-why-excel-interop-reads-many-decimals-as-2146826246 Here's some information from someone having the same problem in .NET, which may or may not be helpful https://xldennis.wordpress.com/2006/11/22/dealing-with-cverr-values-in-net-%E2%80%93-part-i-the-problem/ It looks like the values are actually returned as a VT_ERROR variant, which .NET (and apparently python) reads as an integer. -- https://mail.python.org/mailman/listinfo/python-list
Re: -2146826246 in win32com.client for empty #N/A cell in Excel
On Sun, 16 Aug 2015 09:53:32 -0700, Sven Boden wrote: > Anyone knows how to handle a "#N/A" cell in Excel in the proper way? 0x800A07FA is how xlErrNA (error 2042) is marshalled. This isn't specific to Python; you'll get the same value using e.g C# or VB.NET. There's a fairly thorough article on this topic at: https://xldennis.wordpress.com/2006/11/22/ https://xldennis.wordpress.com/2006/11/29/ -- https://mail.python.org/mailman/listinfo/python-list
return types from library api wrappers
What's the accepted practice for return types from a c based API Python wrapper? I have many methods which return generators which yield potentially many fields per iteration. In lower level languages we would yield a struct with readonly fields. The existing implementation returns a dict which I am not fond of. I'd rather return an object with properties, however all the guys who use this api use IDE's and want the type hinting. So, options I can think of are to create a load of classes and returning instances of them, return named tuples or even terser would be to return something like: def api_method(foo, bar): """produces two return values, x and y.""" ... return type('MyResult', (), {'__slots__': [], 'some_field': x, 'another_field': y})() The last option humorously returns readonly fields. However, the latter two don't help much for type hinting unless someone knows something I don't about doc strings? As a Python user, what is preferred? Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
On Mon, Aug 17, 2015 at 5:16 AM, shiva upreti wrote: > I am new to linux. I tried various things in attempt to install kivy. I > installed python 2.7.10 (I think python3 was already installed in ubuntu > 14.04). Then i downloaded kivy from > https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, extracted > it and tried to execute "python setup.py" inside the kivy folder. As Laura said, the preferred way to install under Ubuntu would be to use apt-get. But if you want to install directly from PyPI, the best way is to use pip. Those are two package managers, which remove from you the hassle of hunting down all the different dependencies, like Cython. Try apt-get first, and if that doesn't do what you're looking for, use pip (maybe inside a virtualenv). It'll chug for a while and then give you what you need. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: return types from library api wrappers
On 8/16/2015 7:31 PM, Joseph L. Casale wrote: What's the accepted practice for return types from a c based API Python wrapper? I have many methods which return generators which yield potentially many fields per iteration. In lower level languages we would yield a struct with readonly fields. Current practice is a NamedTuple for python code or the C equivalent. I forget the C name, but I believe it is used by os.stat >>> os.stat('C:/programs') os.stat_result(st_mode=16895, st_ino=1970324837036820, st_dev=1816146727, st_nlink=1, st_uid=0, st_gid=0, st_size=4096, st_atime=1437490766, st_mtime=1437490766, st_ctime=1313612988) >>> s = os.stat('C:/programs') >>> s.st_atime 1437490766.6669185 >>> s.st_atime = 3 Traceback (most recent call last): File "", line 1, in s.st_atime = 3 AttributeError: readonly attribute The existing implementation returns a dict which I am not fond of. I'd rather return an object with properties, however all the guys who use this api use IDE's and want the type hinting. I believe the above gives you both: custom class for type hinting and properties. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
On Monday, August 17, 2015 at 7:30:14 AM UTC+5:30, Chris Angelico wrote: > On Mon, Aug 17, 2015 at 5:16 AM, shiva upreti wrote: > > I am new to linux. I tried various things in attempt to install kivy. I > > installed python 2.7.10 (I think python3 was already installed in ubuntu > > 14.04). Then i downloaded kivy from > > https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, extracted > > it and tried to execute "python setup.py" inside the kivy folder. > > As Laura said, the preferred way to install under Ubuntu would be to > use apt-get. But if you want to install directly from PyPI, the best > way is to use pip. Those are two package managers, which remove from > you the hassle of hunting down all the different dependencies, like > Cython. Try apt-get first, and if that doesn't do what you're looking > for, use pip (maybe inside a virtualenv). It'll chug for a while and > then give you what you need. Its not vanilla apt-get but ppa-apt-get (as Laura's link indicates) -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
On Mon, Aug 17, 2015 at 12:51 PM, Rustom Mody wrote: > On Monday, August 17, 2015 at 7:30:14 AM UTC+5:30, Chris Angelico wrote: >> On Mon, Aug 17, 2015 at 5:16 AM, shiva upreti wrote: >> > I am new to linux. I tried various things in attempt to install kivy. I >> > installed python 2.7.10 (I think python3 was already installed in ubuntu >> > 14.04). Then i downloaded kivy from >> > https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, >> > extracted it and tried to execute "python setup.py" inside the kivy folder. >> >> As Laura said, the preferred way to install under Ubuntu would be to >> use apt-get. But if you want to install directly from PyPI, the best >> way is to use pip. Those are two package managers, which remove from >> you the hassle of hunting down all the different dependencies, like >> Cython. Try apt-get first, and if that doesn't do what you're looking >> for, use pip (maybe inside a virtualenv). It'll chug for a while and >> then give you what you need. > > Its not vanilla apt-get but ppa-apt-get (as Laura's link indicates) I didn't actually click the link. But it's still apt-get, just with an additional repository. In any case, it's way better to use a package manager (either system-provided or Python-provided) than to do everything manually. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
On Sunday, August 16, 2015 at 8:00:14 PM UTC-6, Chris Angelico wrote: > On Mon, Aug 17, 2015 at 5:16 AM, shiva upreti > wrote: > > I am new to linux. I tried various things in attempt to install kivy. I > > installed python 2.7.10 (I think python3 was already installed in ubuntu > > 14.04). Then i downloaded kivy from > > https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, extracted > > it and tried to execute "python setup.py" inside the kivy folder. > >[...] > use pip (maybe inside a virtualenv). It'll chug for a while and > then give you what you need. Umm, actually no... | ~# pip3 install kivy | Downloading/unpacking kivy | Downloading Kivy-1.9.0.tar.gz (16.2MB): 16.2MB downloaded | Running setup.py (path:/tmp/pip-build-m40337r5/kivy/setup.py) egg_info for package kivy | Traceback (most recent call last): | File "", line 17, in | File "/tmp/pip-build-m40337r5/kivy/setup.py", line 173, in | from Cython.Distutils import build_ext |ImportError: No module named 'Cython' | Cython is missing, its required for compiling kivy ! (on Fedora-21 where no kivy repo package is available) -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
In a message of Sun, 16 Aug 2015 20:19:49 -0700, rurpy--- via Python-list write s: >On Sunday, August 16, 2015 at 8:00:14 PM UTC-6, Chris Angelico wrote: >> On Mon, Aug 17, 2015 at 5:16 AM, shiva upreti >> wrote: >> > I am new to linux. I tried various things in attempt to install kivy. I >> > installed python 2.7.10 (I think python3 was already installed in ubuntu >> > 14.04). Then i downloaded kivy from >> > https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz, >> > extracted it and tried to execute "python setup.py" inside the kivy folder. >> >>[...] >> use pip (maybe inside a virtualenv). It'll chug for a while and >> then give you what you need. > >Umm, actually no... > >| ~# pip3 install kivy >| Downloading/unpacking kivy >| Downloading Kivy-1.9.0.tar.gz (16.2MB): 16.2MB downloaded >| Running setup.py (path:/tmp/pip-build-m40337r5/kivy/setup.py) egg_info for >package kivy >| Traceback (most recent call last): >| File "", line 17, in >| File "/tmp/pip-build-m40337r5/kivy/setup.py", line 173, in >| from Cython.Distutils import build_ext >|ImportError: No module named 'Cython' >| Cython is missing, its required for compiling kivy ! > >(on Fedora-21 where no kivy repo package is available) >-- >https://mail.python.org/mailman/listinfo/python-list If you scroll down http://kivy.org/docs/installation/installation-linux.html there are instructions for Fedora as well. Laura -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
On Sunday, August 16, 2015 at 10:14:29 PM UTC-6, Laura Creighton wrote: > In a message of Sun, 16 Aug 2015 20:19:49 -0700, rurpy--- via Python-list > writes: > >On Sunday, August 16, 2015 at 8:00:14 PM UTC-6, Chris Angelico wrote: > >>[...] > >> use pip (maybe inside a virtualenv). It'll chug for a while and > >> then give you what you need. > > > >Umm, actually no... > > > >| ~# pip3 install kivy > >| Downloading/unpacking kivy > >| Downloading Kivy-1.9.0.tar.gz (16.2MB): 16.2MB downloaded > >| Running setup.py (path:/tmp/pip-build-m40337r5/kivy/setup.py) egg_info > >for package kivy > >| Traceback (most recent call last): > >| File "", line 17, in > >| File "/tmp/pip-build-m40337r5/kivy/setup.py", line 173, in > >| from Cython.Distutils import build_ext > >|ImportError: No module named 'Cython' > >| Cython is missing, its required for compiling kivy ! > > > >(on Fedora-21 where no kivy repo package is available) > >-- > >https://mail.python.org/mailman/listinfo/python-list > > If you scroll down > http://kivy.org/docs/installation/installation-linux.html > > there are instructions for Fedora as well. Thanks. But I note that those are all for very old, EoL'd versions of Fedora. I manually installed cython with pip, but then the kivy install failed with some C errors. At the top of it's multi-thousand line log output was a warning that it requires cython-0.21.2. Pip had installed cython-0.23. I installed cython-0.21.2 (since I do not use cython for anything else and noting that pip did not bother to inform me it was overwriting an existing install) and then pip installed kivy without error. However there were a number of warning message about missing somethings (libs or python packages, was not clear to me). So I eventually found the kivy docs on their website where they list prerequisite packages for installing kivy on ubuntu. I'll translate those to hopefully the equivalent fedora package names, install them, reinstall kivy, and get a working kivy install. The point here that all the above is a LONG way from what was was posted here: "just type 'pip install kivy' and pip will take care of everything". I hope someday Python gets a decent packaging/distribution story. -- https://mail.python.org/mailman/listinfo/python-list
Re: "no module named kivy" import error in ubuntu 14.04
shiva upreti wrote: >Hi >I am new to linux. I tried various things in attempt to install kivy. I >installed python 2.7.10 Just to make clear what others have said -- replacing Ubuntu 14.04's system Python 2.7.6 is a bad idea and will break stuff, so if you really must have the latest version of Python2, then you install it separately, leaving the system Python in place. That in turn means that you can no longer use Ubuntu's normal method of installing libraries via its own software management. > Then i downloaded kivy from > https://pypi.python.org/packages/source/K/Kivy/Kivy-1.9.0.tar.gz I suggest that you DON'T install from tarfiles unless your understanding of Python is of near python-developer level. You really need to know what you're doing regarding dependencies and the search path for modules. If you do want to install a separate instance of the latest version of Python, then the PIP package management is best, and use it to install the libraries separately, NOT in the /usr/ directory -- see the other posts. -- https://mail.python.org/mailman/listinfo/python-list
Re: Detecting if a library has native dependency
Harish Vishwanath writes: > Is there a reliable way to detect if a python library has native dependency > or native code? For ex. can I programmatically determine that "lxml" > package has native code and depends on the presence of libxml on the system? I do not expect a tool that in all cases can reliably determine such dependencies. In simple cases (and "lxml" might be such a case), an import of the package might reveal a potential problem -- usually, via an "ImportError", resulting from the fact that the Python module binding to the external C library cannot be imported (either because it was not built or because it cannot be initialized). Under "*nix", you can often use "ldd" to determine on which external C libraries a "shared object" depends on. Thus, in the second case (Python binding available, but not initializable), you can often find out what is missing. However, the import of the Python binding might be delayed. Then, importing the package will not directly reveal the missing dependencies. In addition, some packages (e.g. "dm.xmlsec.binding") not only have an external dependency but depend on specific versions of a native library. Thus, even if a dependency seems to be satisfied, there might be a version problem. Thus, I recommend not to rely on program logic but read the installation instructions. -- https://mail.python.org/mailman/listinfo/python-list