Re: "no module named kivy" import error in ubuntu 14.04

2015-08-17 Thread Laura Creighton
In a message of Sun, 16 Aug 2015 22:05:29 -0700, rurpy--- via Python-list write
s:
>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.

Can you post what one should do with modern Fedora distributions, so
we can tell the kivy-devs and they can update that webpage?

Laura

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


Re: Old DbaseV DOS Programmer wants to step over to new/actual modern program software

2015-08-17 Thread Adriaan Renting

For building new programs using free software, I currently like a mix
of Qt, Python, C++ and various open source SQL databases (MySQL,
PostGreSQL). I have found QtCreator an easy IDE to use in such cases, I
don't really like Eclipse.
But it requires a heavy knowledge of C++, which is not an easy
language, if you want to use Qt directly.
PyQt works for smaller projects, I've used it with
http://eric-ide.python-projects.org/ in the past.

A few things you need to ask yourself:
- How much time do I have?
- Who are my users, what OS/systems do they use? I like Qt because it
allows me to create programs for all kinds of operating systems.
- How do I want to distribute my software? Is it a problem if a user is
able to read the souce code?
- How well do I really know Dbase V? What do I want to do the same and
what differently? My dad worked with Dbase III/IV/V for years, but
learned how to program it by changing the autogenerated code, which is a
horrible way to learn programming and leads to very bad habbits.
- What kind of programs are you trying to make? There also exist a lot
of more specialized solutions, like http://www.4d.com/, which might suit
your needs, if you're looking for a dBase replacement.

Cheers



Adriaan Renting| Email: rent...@astron.nl
Software Engineer Radio Observatory
ASTRON | Phone: +31 521 595 100 (797 direct)
P.O. Box 2 | GSM:   +31 6 24 25 17 28
NL-7990 AA Dwingeloo   | FAX:   +31 521 595 101
The Netherlands| Web: http://www.astron.nl/~renting/



>>> On 16-8-2015 at 20:40, Vladimir Ignatov  wrote:

> 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

2015-08-17 Thread Sven Boden
On Sun, Aug 16, 2015 at 7:27 PM, Albert-Jan Roskam 
wrote:

>
>
>
> > 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
>
>
> On python 3.x sys.maxint is gone... sys.maxsize is a lot larger on Windows
64bit (same laptop I run the code on).

Regards,
Sven
-- 
https://mail.python.org/mailman/listinfo/python-list


Error in IDLE

2015-08-17 Thread Henry Quansah
I just installed python. But I'm unable to access IDLE after several clicks
and double clicks. I even tried repairing by trying to reinstall but I have
the same issue.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error in IDLE

2015-08-17 Thread Laura Creighton
In a message of Sat, 15 Aug 2015 16:42:13 +0100, Henry Quansah writes:
>I just installed python. But I'm unable to access IDLE after several clicks
>and double clicks. I even tried repairing by trying to reinstall but I have
>the same issue.
>

What version of Python have you installed?  How did you install it?
What Operating system are you using?
What error messages (if any) do you get when you try to run Idle?
Paste the whole traceback into your mail, if you get one.

Laura

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


Python 3 sort() problem

2015-08-17 Thread Владислав
# first: works fine

x = [1, 2, 4, 2, 1, 3]
x = list(set(x))
x.sort()
print(x)  # output: 1, 2, 3, 4

# second: why x became None ??

x = [1, 2, 4, 2, 1, 3]
x = list(set(x)).sort()
print(x)  # output: None

I know that sort() returns None, but I guess that it would be returned x
that was sorted. Why so?



 

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


Re: Python 3 sort() problem

2015-08-17 Thread Joonas Liik
>
> I know that sort() returns None, but I guess that it would be returned x
> that was sorted. Why so?

if it returned a sorted list it might lead some people to believe it
did not modify the oridinal list which would lead to a ton of
confusion for new users.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 sort() problem

2015-08-17 Thread Fabien

On 08/17/2015 01:42 PM, Владислав wrote:

x = [1, 2, 4, 2, 1, 3]
x = list(set(x)).sort()
print(x) /# output: None/

I know that sort() returns None, but I guess that it would be returned x
that was sorted. Why so?


If sort() returns None, than the following:

x = list(set(x)).sort()

is equivalent to writing:

x = None

So I don't really understand your question, I'm sorry...

Cheers,

Fabien

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


Re: Python 3 sort() problem

2015-08-17 Thread Mark Lawrence

On 17/08/2015 12:42, Владислав wrote:

# first: works fine

x = [1, 2, 4, 2, 1, 3]
x = list(set(x))
x.sort()
print(x) /# output: 1, 2, 3, 4

/# second: why x became None ??

x = [1, 2, 4, 2, 1, 3]
x = list(set(x)).sort()
print(x) /# output: None/

I know that sort() returns None, but I guess that it would be returned x
that was sorted. Why so?/


A set is created from x.  This is converted to a list.  You call sort() 
and assign the return value from that, None, to x.  You will see exactly 
the same thing above if you do:-


x = x.sort()

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Python 3 sort() problem

2015-08-17 Thread Rustom Mody
On Monday, August 17, 2015 at 7:32:08 PM UTC+5:30, Владислав wrote:
> # first: works fine
> x = [1, 2, 4, 2, 1, 3]
> x = list(set(x))
> x.sort()
> print(x)  # output: 1, 2, 3, 4
> 
> # second: why x became None ??
> x = [1, 2, 4, 2, 1, 3]
> x = list(set(x)).sort()
> print(x)  # output: None
> I know that sort() returns None, but I guess that it would be returned x that 
> was sorted. Why so?
> 
> 
>  

Maybe you want sorted?
>>> x = [4,2,1,3]
>>> sorted(x)
[1, 2, 3, 4]

[The list(set(..)) is probably for removing duplicates. Right?
Which you seem to have worked out it seems?
So best when asking questions to focus on one issue at a time]
-- 
https://mail.python.org/mailman/listinfo/python-list


Who is using littletable?

2015-08-17 Thread Paul McGuire
littletable is a little module I knocked together a few years ago, found it 
sort of useful, so uploaded to SF and PyPI.  The download traffic at SF is very 
light, as I expected, but PyPI shows > 3000 downloads in the past month!  Who 
*are* all these people?

In my own continuing self-education, it is interesting to see overlap in the 
basic goals in littletable, and the much more widely known pandas module (with 
littletable being more lightweight/freestanding, not requiring numpy, but 
correspondingly not as snappy).

I know Adam Sah uses (or at least used to use) littletable as an in-memory 
product catalog for his website Buyer's Best friend 
(http://www.bbfdirect.com/).  Who else is out there, and what enticed you to 
use this little module?

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


Re: Who is using littletable?

2015-08-17 Thread Laura Creighton
Some of the PyPI traffic is for mirrors.  In addition to our official
mirrors, some people/companies set up their own mirrors and suck down
everything.

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


Python Mobile development using kivy

2015-08-17 Thread reetesh nigam
Hi All,

I am using Python2.7 version, while developing basic app using kivy, I am 
getting following error :

dev@synechron-desktop-156:~/myDev/mobile_app$ cat main.py 
from kivy import app
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()

dev@synechron-desktop-156:~/myDev/mobile_app$ python main.py 
[INFO   ] [Logger  ] Record log in /home/dev/.kivy/logs/kivy_15-08-17_0.txt
[INFO   ] [Kivy] v1.9.0
[INFO   ] [Python  ] v2.7.5 (default, Aug  9 2015, 22:40:01) 
[GCC 4.4.3]
[INFO   ] [Factory ] 173 symbols loaded
[INFO   ] [Image   ] Providers: img_tex, img_dds, img_gif, img_pygame 
(img_pil, img_ffpyplayer ignored)
 Traceback (most recent call last):
   File "main.py", line 1, in 
 from kivy import app
   File "/usr/local/lib/python2.7/site-packages/kivy/app.py", line 324, in 

 from kivy.uix.widget import Widget
   File "/usr/local/lib/python2.7/site-packages/kivy/uix/widget.py", line 167, 
in 
 from kivy.graphics.transformation import Matrix
   File "/usr/local/lib/python2.7/site-packages/kivy/graphics/__init__.py", 
line 89, in 
 from kivy.graphics.instructions import Callback, Canvas, CanvasBase, \
   File "kivy/graphics/vbo.pxd", line 7, in init kivy.graphics.instructions 
(kivy/graphics/instructions.c:14003)
   File "kivy/graphics/compiler.pxd", line 1, in init kivy.graphics.vbo 
(kivy/graphics/vbo.c:5112)
   File "kivy/graphics/shader.pxd", line 5, in init kivy.graphics.compiler 
(kivy/graphics/compiler.c:2863)
   File "kivy/graphics/texture.pxd", line 3, in init kivy.graphics.shader 
(kivy/graphics/shader.c:10293)
   File "kivy/graphics/fbo.pxd", line 5, in init kivy.graphics.texture 
(kivy/graphics/texture.c:29967)
   File "kivy/graphics/fbo.pyx", line 84, in init kivy.graphics.fbo 
(kivy/graphics/fbo.c:7065)
 ImportError: /usr/local/lib/python2.7/site-packages/kivy/graphics/opengl.so: 
undefined symbol: glBlendEquationSeparate
dev@synechron-desktop-156:~/myDev/mobile_app$ 


More information :

I have installed kivy,pygame and cython as well:

dev@synechron-desktop-156:~/myDev/mobile_app$ python
Python 2.7.5 (default, Aug  9 2015, 22:40:01) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import kivy
[INFO   ] [Logger  ] Record log in /home/dev/.kivy/logs/kivy_15-08-17_1.txt
[INFO   ] [Kivy] v1.9.0
[INFO   ] [Python  ] v2.7.5 (default, Aug  9 2015, 22:40:01) 
[GCC 4.4.3]
>>> import pygame
>>> import cython
>>> 
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: return types from library api wrappers

2015-08-17 Thread Joseph L. Casale
> 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

Hi Terry,
Ok, that is what I will go with.

Thanks for the confirmation,
jlc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python command not working

2015-08-17 Thread Paul McGuire
On Friday, August 14, 2015 at 6:13:37 AM UTC-5, sam.h...@gmail.com wrote:
> On Wednesday, April 22, 2009 at 8:36:21 AM UTC+1, David Cournapeau wrote:
> > On Wed, Apr 22, 2009 at 4:20 PM, 83nini <83n...@gmail.com> wrote:
> > > Hi guys,
> > >
> > > I'm new to python, i downloaded version 2.5, opened windows (vista)
> > > command line and wrote "python", this should take me to the python



> 
> You can do it easily by adding the Python path (in my case C:\Python27) to 
> your system PATH.
> 

This thread is > 6 years old, OP has probably gone on to other things...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Mobile development using kivy

2015-08-17 Thread Laura Creighton
In a message of Mon, 17 Aug 2015 09:35:12 -0700, reetesh nigam writes:
>Hi All,
>
>I am using Python2.7 version, while developing basic app using kivy, I am 
>getting following error :
>
>dev@synechron-desktop-156:~/myDev/mobile_app$ cat main.py 
>from kivy import app
>from kivy.app import App
>from kivy.uix.label import Label
>class MyApp(App):
>def build(self):
>return Label(text='Hello world')
>if __name__ == '__main__':
>MyApp().run()
>
>dev@synechron-desktop-156:~/myDev/mobile_app$ python main.py 
>[INFO   ] [Logger  ] Record log in /home/dev/.kivy/logs/kivy_15-08-17_0.txt
>[INFO   ] [Kivy] v1.9.0
>[INFO   ] [Python  ] v2.7.5 (default, Aug  9 2015, 22:40:01) 
>[GCC 4.4.3]
>[INFO   ] [Factory ] 173 symbols loaded
>[INFO   ] [Image   ] Providers: img_tex, img_dds, img_gif, img_pygame 
>(img_pil, img_ffpyplayer ignored)
> Traceback (most recent call last):
>   File "main.py", line 1, in 
> from kivy import app
>   File "/usr/local/lib/python2.7/site-packages/kivy/app.py", line 324, in 
> 
> from kivy.uix.widget import Widget
>   File "/usr/local/lib/python2.7/site-packages/kivy/uix/widget.py", line 167, 
> in 
> from kivy.graphics.transformation import Matrix
>   File "/usr/local/lib/python2.7/site-packages/kivy/graphics/__init__.py", 
> line 89, in 
> from kivy.graphics.instructions import Callback, Canvas, CanvasBase, \
>   File "kivy/graphics/vbo.pxd", line 7, in init kivy.graphics.instructions 
> (kivy/graphics/instructions.c:14003)
>   File "kivy/graphics/compiler.pxd", line 1, in init kivy.graphics.vbo 
> (kivy/graphics/vbo.c:5112)
>   File "kivy/graphics/shader.pxd", line 5, in init kivy.graphics.compiler 
> (kivy/graphics/compiler.c:2863)
>   File "kivy/graphics/texture.pxd", line 3, in init kivy.graphics.shader 
> (kivy/graphics/shader.c:10293)
>   File "kivy/graphics/fbo.pxd", line 5, in init kivy.graphics.texture 
> (kivy/graphics/texture.c:29967)
>   File "kivy/graphics/fbo.pyx", line 84, in init kivy.graphics.fbo 
> (kivy/graphics/fbo.c:7065)
> ImportError: /usr/local/lib/python2.7/site-packages/kivy/graphics/opengl.so: 
> undefined symbol: glBlendEquationSeparate
>dev@synechron-desktop-156:~/myDev/mobile_app$

If you get undefined opengl errors, it is usually caused by an old
version of opengl, and the error you got is common.

This is a puzzling error that most often happens when compiling under
i386 for the old libGL.  Given that the symbol is present in libGL and
that compilation works under amd64, this shouldn't be happening.  But
for some reason it does.  If a newer version of opengl.so  doesn't fix
your problem, post a bug report here:
https://github.com/kivy/kivy/issues

or discuss it on #kivy on freenode

Laura


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


Re: "no module named kivy" import error in ubuntu 14.04

2015-08-17 Thread Rustom Mody
On Monday, August 17, 2015 at 10:35:48 AM UTC+5:30, rurpy wrote:
> I hope someday Python gets a decent packaging/distribution story.

You are in august company

| The final question was about what he (Guido) hates in Python. "Anything to do
| with package distribution", he answered immediately. There are problems
| with version skew and dependencies that just make for an "endless
| mess". He dreads it when a colleague comes to him with a "simple Python
| question". Half the time it is some kind of import path problem and
| there is no easy solution to offer.

>From https://mail.python.org/pipermail/python-list/2015-July/694818.html
Quoting https://lwn.net/Articles/651967/

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


Re: Error in IDLE

2015-08-17 Thread Terry Reedy

On 8/15/2015 11:42 AM, Henry Quansah wrote:

I just installed python. But I'm unable to access IDLE after several
clicks and double clicks. I even tried repairing by trying to reinstall
but I have the same issue.


If you just installed 3.5.0rc1 on Windows, look for my fix message on or 
about the 14th.


--
Terry Jan Reedy

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


Re: memory control in Python

2015-08-17 Thread Ping Liu
On Saturday, August 15, 2015 at 11:56:22 AM UTC-7, Laura Creighton wrote:
> If the problem is that Python is using too much memory, then PyPy may
> be able to help you.  PyPy is an alternative implementation of Python,
> and by defaiult uses a minimark garbage collector.
> https://pypy.readthedocs.org/en/release-2.4.x/garbage_collection.html
> 
> You will have to write your own bindings for the CPLEX C library, though,
> using cffi. http://cffi.readthedocs.org/en/latest/overview.html  (since
> the bindings you have assume the CPython ref counting gc).
> 
> But if your C program is itself using too much memory, then this probably
> won't help.
> 
> Discuss this more on pypy-...@python.org or the #pypy channel on freenode.
> People on pypy-dev would appreciate not getting libreoffice spreadsheet
> attachments but just the figures as plain text.
> 
> Laura

Hi, Laura, 
Thank you for the advice. I see that some people also mention that PyPy may 
save some speed and memory than CPython. But since I am working on an 
optimization problem, I wonder whether PyPy would support NumPy and Scipy. In 
which progress have this integration been done?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: memory control in Python

2015-08-17 Thread Laura Creighton
In a message of Mon, 17 Aug 2015 11:40:32 -0700, Ping Liu writes:
>> Discuss this more on pypy-...@python.org or the #pypy channel on freenode.
>> People on pypy-dev would appreciate not getting libreoffice spreadsheet
>> attachments but just the figures as plain text.
>> 
>> Laura
>
>Hi, Laura, 
>Thank you for the advice. I see that some people also mention that PyPy may 
>save some speed and memory than CPython. But since I am working on an 
>optimization problem, I wonder whether PyPy would support NumPy and Scipy. In 
>which progress have this integration been done?
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Significant progress has been made to support NumPy.   SciPy, no.
Ask on pypy-dev and/or freenode to find out if the NumPy features you
need are done yet.

Laura

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


Re: How to model government organization hierarchies so that the list can expand and compress

2015-08-17 Thread Alex Glaros
Perhaps most jointly parented governmental organizations are functionally, 
collaborative "projects" (not organizations) which my model handles. But thanks 
to Laura, will not assume there are none, or will never be any in the future, 
so will use adjacent list (see fast response times documented in 
explainedextended.com article below), but created new 1:M table to handle 
multiple parents.

ORGANIZATION
-
1. organization_Id (PK)
2. organization_name

ORGANIZATION_HIERARCHY (1:M)
--
1. organization_Id (FK to above table) - can have multiple parents
2. adjacent_parent_id (FK to above table) 

Thanks to all for the assistance.  Led me to some great articles including
http://explainextended.com/2009/09/24/adjacency-list-vs-nested-sets-postgresql/

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


Re: How to rearrange array using Python?

2015-08-17 Thread Martin Schöön
Den 2015-07-31 skrev Martin Schöön :
> Den 2015-07-31 skrev Thomas 'PointedEars' Lahn :
>> Mark Lawrence wrote:
>>> 
>>> I'm not absolutely certain but I think you're into what's known as a
>>> constraint satisfaction problem, in which case this
>>> https://pypi.python.org/pypi/python-constraint/1.2 is as good a starting
>>> point as any.  If I'm wrong we'll soon get told :)
>>
>> It is a CSP indeed, and as I was reading the OP I was thinking of SWI-
>>
> Thanks guys, I will follow up on the CSP lead. It is not something I
> have prior experience of so it will be interesting.
>
Brief progress report (just to tell you that your advice has been
'absorbed').

I have been reading a bit, here is one example.
http://kti.ms.mff.cuni.cz/~bartak/constraints/index.html
Interesting stuff but sometimes head-spinning -- I don't always follow
the lingo.

I have also downloaded and installed Python-Constraint. It works as
advertised as long as I replicate the examples found at:
http://labix.org/python-constraint
I can even scale some of the examples.

Creating my own examples has proven harder -- in part because the
documentation is minimalistic but also because I have not tried very
hard. We have, finally, got some nice summer weather here...

I have tried my hand at a *very* basic room placement problem. It
works
apart from the fact that I have not figured out how to tell the solver
there are limits to how many occupants each room can house.

Yesterday I started on a basic Kenken example. I need to experiment
a little to find a way to add the needed division and subtraction
constraints. I haven't given this much thought yet.

Today I found Numberjack:
http://numberjack.ucc.ie/
It seems better documented than Python-Constraint but that is all
I know. Anyone with experience of Numberjack?

In summary: I am having fun using ipython and org-mode for emacs.
I am not making much headway but then I don't have a dead-line
:-)

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


Re: memory control in Python

2015-08-17 Thread Ping Liu
Hi, Dieter,

If I move from Python to Jython or IronPython, do I need to retool whatever I 
have done? If so, that may take quite a long time. This may make the 
reimplementation impossible. 
-- 
https://mail.python.org/mailman/listinfo/python-list


why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread alex . flint
using Python 2.7.9, I get the following:

>>> id(multiprocessing.Process.start) == id(multiprocessing.Process.start)
True

But on the other hand:

>>> multiprocessing.Process.start is multiprocessing.Process.start
False

I thought that these two expressions were equivalent. Can somebody help me to 
understand what's going on here?
-- 
https://mail.python.org/mailman/listinfo/python-list


Python Import Hooks and __main__

2015-08-17 Thread Sven R. Kunze

Hi,

following up on this thread on StackOverflow 
http://stackoverflow.com/questions/16515347/python-import-hooks-and-main 
does somebody has a great idea how to manage this?


The issue at hand is, that I would like to apply a specific import hook 
right from the beginning of the interpreter run (here, a simple test 
case), i.e. also affecting the import/exec of the module __main__.


Hook: https://github.com/srkunze/fork/blob/2e7ecd4b0a/fork.py#L429
Dirty Magic to get things running: 
https://github.com/srkunze/fork/blob/2e7ecd4b0a/fork.py#L425


Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list


Re: why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread alex . flint
On Monday, August 17, 2015 at 3:24:22 PM UTC-7, alex@gmail.com wrote:
> using Python 2.7.9, I get the following:
> 
> >>> id(multiprocessing.Process.start) == id(multiprocessing.Process.start)
> True
> 
> But on the other hand:
> 
> >>> multiprocessing.Process.start is multiprocessing.Process.start
> False
> 
> I thought that these two expressions were equivalent. Can somebody help me to 
> understand what's going on here?

Sorry I completely mistype that. It was supposed to read:

>>> id(multiprocessing.Process.is_alive) == id(multiprocessing.Process.start)
True

>>> multiprocessing.Process.is_alive is multiprocessing.Process.start
False

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


Re: why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread Chris Kaynor
On Mon, Aug 17, 2015 at 3:25 PM,  wrote:
>
> Sorry I completely mistype that. It was supposed to read:
>
> >>> id(multiprocessing.Process.is_alive) ==
> id(multiprocessing.Process.start)
> True
>

What is going on here is that it get multiprocessing.Process.is_alive,
computes the id of it, then throws away the value of
multiprocessing.Process.is_alive. It then does the same thing for
multiprocessing.Process.start, where by it happens to reuse the id of the
first value.


> >>> multiprocessing.Process.is_alive is multiprocessing.Process.start
> False
>

In this case, the "is" operator keeps both references around during its
call, and therefore they will get different ids.


The rules for the id is that they are only guaranteed unique during the
lifespan of both objects. Also, generally, you do not want to use id or is
for much of anything unless you really know what you are doing - generally,
you just want == instead.


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


Re: why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread Ian Kelly
On Mon, Aug 17, 2015 at 4:57 PM, Chris Kaynor  wrote:
> The rules for the id is that they are only guaranteed unique during the
> lifespan of both objects. Also, generally, you do not want to use id or is
> for much of anything unless you really know what you are doing - generally,
> you just want == instead.

In the case of "is", I don't agree. "is" is a useful operator and is
not prone to user error like "id". The only caveat is that one should
understand the distinction between "is" and "==".
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "no module named kivy" import error in ubuntu 14.04

2015-08-17 Thread rurpy--- via Python-list
On 08/17/2015 01:52 AM, Laura Creighton wrote:
> In a message of Sun, 16 Aug 2015 22:05:29 -0700, rurpy--- via Python-list 
> writes:
>> 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.

Actually, right after I posted, I saw a Fedora-specific list of
packages on the kivy website. However, after I installed them
and reinstalled kivy I still got the same set of missing package
warning that I got before.
And hoping that the packages just enabled optional features I
tried running the simple "hello-world" program from their website.
It died horribly:

| [CRITICAL] [Window ] Unable to find any valuable Window provider at all!
| egl_rpi - ImportError: cannot import name 'bcm'
| File "/usr/lib64/python3.4/site-packages/kivy/core/__init__.py", line 57, in 
core_select_lib
and
| x11 - ImportError: No module named 'kivy.core.window.window_x11'
| File "/usr/lib64/python3.4/site-packages/kivy/core/__init__.py", line 57, in 
core_select_lib
| fromlist=[modulename], level=0)
| [CRITICAL] [App ] Unable to get a Window, abort.

>> 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.
> 
> Can you post what one should do with modern Fedora distributions, so
> we can tell the kivy-devs and they can update that webpage?

Unfortunately I have no idea what one should do. The standard response
in this group is that pip knows, hence I don't need to. I just wanted
to point out the fallacy of that.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: memory control in Python

2015-08-17 Thread Chris Angelico
On Tue, Aug 18, 2015 at 8:09 AM, Ping Liu  wrote:
> If I move from Python to Jython or IronPython, do I need to retool whatever I 
> have done? If so, that may take quite a long time. This may make the 
> reimplementation impossible.

You're not moving from Python to something else; you're moving from
CPython to something else. It's like moving from Borland's C compiler
to Watcom's C compiler - all your code should still run unchanged.
There will be differences, but the bulk of your code shouldn't need
changing. With Python interpreters, the usual difference is extension
libraries - CPython can call on a bunch of things implemented in
native code, Jython can call on a bunch of things implemented in Java,
etc.

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


execute commands as su on remote server

2015-08-17 Thread harirammanohar159

execute commands as su on remote server

Postby hariram » Mon Aug 17, 2015 4:02 am
Needed:
I need to execute commands after doing su to other user on remote server(not 
sudo which doesn't require password) how i can achieve this using python?
I googled and came to know that its not possible, so just for confirmation 
asking again, is it possible ?

Already Tried:
Tried paramiko that's too not working.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: execute commands as su on remote server

2015-08-17 Thread Chris Angelico
On Tue, Aug 18, 2015 at 12:57 PM,   wrote:
> I need to execute commands after doing su to other user on remote server(not 
> sudo which doesn't require password) how i can achieve this using python?
> I googled and came to know that its not possible, so just for confirmation 
> asking again, is it possible ?

Ultimately, this isn't a Python question, it's a systems
administration one. You want a way to execute commands as a specific
user, triggering them remotely. There are basically two ways you can
do this: either you provide some form of credentials (this is what
sudo does), or you elevate the entire management process. The latter
option is far FAR easier (running it as root if you might need to go
to any different user, or as that specific user if you'll only ever
use one), but then you have to ensure, in some way, that your Python
program can't be compromised.

Python has nothing to do with any of this. If you want to manage
elevation using sudo, Python can invoke sudo in a subprocess. If you
want to elevate the Python process and then simply invoke something
directly, Python won't even be aware of it.

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


Re: why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

2015-08-17 Thread random832
On Mon, Aug 17, 2015, at 18:25, alex.fl...@gmail.com wrote:
> Sorry I completely mistype that. It was supposed to read:
> 
> >>> id(multiprocessing.Process.is_alive) == id(multiprocessing.Process.start)
> True
> 
> >>> multiprocessing.Process.is_alive is multiprocessing.Process.start
> False

Try this:
is_alive = multiprocessing.Process.is_alive
start = multiprocessing.Process.start
id(is_alive) == id(start)

If (as I believe it will) this ends up being false, this shows that it's
an issue of object lifespan with the values of the expression being
temporary method wrappers. From some testing, on my machine on CPython
2.7 this appears to work for any method of any class written in python.
While you fixed the typo, it is instructive to note that, as in your
original example, multiprocessing.Process.start is
multiprocessing.Process.start is *also* False, which would not be the
case if the method wrapper were a permanent object.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: memory control in Python

2015-08-17 Thread dieter
Ping Liu  writes:

> If I move from Python to Jython or IronPython, do I need to retool whatever I 
> have done? If so, that may take quite a long time. This may make the 
> reimplementation impossible. 

As Chris already pointed out, you are still using Python -- i.e. the
base language does not change.

However, extension packages, such as "NumPy", might not be supported.
If you are using extension packages, carefully check whether they
are supported for a different Python implementation before you decide
a switch.

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


Re: memory control in Python

2015-08-17 Thread Laura Creighton
In a message of Tue, 18 Aug 2015 10:13:57 +1000, Chris Angelico writes:
>On Tue, Aug 18, 2015 at 8:09 AM, Ping Liu  wrote:
>> If I move from Python to Jython or IronPython, do I need to retool whatever 
>> I have done? If so, that may take quite a long time. This may make the 
>> reimplementation impossible.
>
>You're not moving from Python to something else; you're moving from
>CPython to something else. It's like moving from Borland's C compiler
>to Watcom's C compiler - all your code should still run unchanged.
>There will be differences, but the bulk of your code shouldn't need
>changing. With Python interpreters, the usual difference is extension
>libraries - CPython can call on a bunch of things implemented in
>native code, Jython can call on a bunch of things implemented in Java,
>etc.
>
>ChrisA

Unless, as I expect, what he has done uses Numpy and or SciPy a lot.
Enthought is no longer supporting NumPy for IronPython (and it never
worked all that well, anyway, I am told ... but I never used it myself).
Even the maintainer of Jnumeric (which is trying to do Numeric not
NumPy) thinks the Jnumeric project should die.
http://stackoverflow.com/questions/18832169/numpy-analog-for-jython

We already know that Ping has a really big C extension he needs to work
with -- CPLEX, and well, here he may be in luck as there are java
versions of CPLEX and there is something called the CPLEX/Concert .NET
API  which may -- I never tried this -- let him work with Iron Python.
But that is one lirary.  If he has many more C extensions he needs to
use, then this could mean retooling them.

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