PyOBEX installation problem

2020-09-22 Thread Johny
I tried to install PyOBEX

see the log  below

C:\Users\expor\Downloads\OBEX>setup.py install
running install
running bdist_egg
running egg_info
writing PyOBEX.egg-info\PKG-INFO
writing top-level names to PyOBEX.egg-info\top_level.txt
writing dependency_links to PyOBEX.egg-info\dependency_links.txt
reading manifest file 'PyOBEX.egg-info\SOURCES.txt'
writing manifest file 'PyOBEX.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\PyOBEX
copying PyOBEX\client.py -> build\lib\PyOBEX
copying PyOBEX\common.py -> build\lib\PyOBEX
copying PyOBEX\headers.py -> build\lib\PyOBEX
copying PyOBEX\requests.py -> build\lib\PyOBEX
copying PyOBEX\responses.py -> build\lib\PyOBEX
copying PyOBEX\server.py -> build\lib\PyOBEX
copying PyOBEX\__init__.py -> build\lib\PyOBEX
creating build\bdist.win-amd64
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\client.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\common.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\headers.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\requests.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\responses.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\server.py -> build\bdist.win-amd64\egg\PyOBEX
copying build\lib\PyOBEX\__init__.py -> build\bdist.win-amd64\egg\PyOBEX
byte-compiling build\bdist.win-amd64\egg\PyOBEX\client.py to client.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\common.py to common.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\headers.py to headers.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\requests.py to requests.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\responses.py to responses.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\server.py to server.pyc
byte-compiling build\bdist.win-amd64\egg\PyOBEX\__init__.py to __init__.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\dependency_links.txt -> 
build\bdist.win-amd64\egg\EGG-INFO
copying PyOBEX.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\PyOBEX-0.29-py2.7.egg' and adding 'build\bdist.win-amd64\egg' to 
it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing PyOBEX-0.29-py2.7.egg
Copying PyOBEX-0.29-py2.7.egg to c:\python27\lib\site-packages
Adding PyOBEX 0.29 to easy-install.pth file

but still I can not use it. See

>>> from PyOBEX.client import BrowserClient
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named PyOBEX.client
>>>

Where can be a problem?
Thank you for help




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


Question from a "java background" developer

2020-09-22 Thread Agnese Camellini
Hello to everyone, I have a question. I come from a Java background and I
would like to develop in python but i'm wondering: is there anything, in
python, like Java "reflection"?
I mean do i have a keyword to obtain all the methods and the attributes of
a class in python?
Thanks to anyone that can answer me.
Best
Agnese
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Question from a "java background" developer

2020-09-22 Thread Chris Angelico
On Tue, Sep 22, 2020 at 7:15 PM Agnese Camellini
 wrote:
>
> Hello to everyone, I have a question. I come from a Java background and I
> would like to develop in python but i'm wondering: is there anything, in
> python, like Java "reflection"?
> I mean do i have a keyword to obtain all the methods and the attributes of
> a class in python?

Yes - introspection can be done by looking at a class's dictionary.
Check out the dir() function to start exploring!

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


Re: Question from a "java background" developer

2020-09-22 Thread Mats Wichmann
On 9/22/20 3:25 AM, Chris Angelico wrote:
> On Tue, Sep 22, 2020 at 7:15 PM Agnese Camellini
>  wrote:
>>
>> Hello to everyone, I have a question. I come from a Java background and I
>> would like to develop in python but i'm wondering: is there anything, in
>> python, like Java "reflection"?
>> I mean do i have a keyword to obtain all the methods and the attributes of
>> a class in python?
> 
> Yes - introspection can be done by looking at a class's dictionary.
> Check out the dir() function to start exploring!

Without knowing any specifics of what you're looking for you can examine
and modifiy object attributes. Python's dynamic nature makes the
modifying part easy (sometimes I think *too* easy :) ).  Along with
dir(), other functions to read a bit on:

type, isinstance, callable, setattr, getattr as well as the attribute
__dict__.




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


Importing from within package

2020-09-22 Thread Abdur-Rahmaan Janhangeer
Greeting list,

I have this main script:
https://github.com/Abdur-rahmaanJ/shopyo/blob/dev/shopyo/__main__.py

However, i get errors after package installation
saying:
ImportError: cannot import name 'shopyoapi' from 'shopyo'

I've tried from .shopyoapi also but to no avail.

To reproduce:

python -m pip install shopyo==1.1.45
shopyo new . test2

Thanks!

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

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


EuroPython "Ask me Anything"

2020-09-22 Thread M.-A. Lemburg
Dear Community,

we want to try a new experiment and run an “Ask me Anything” (AMA) this
Thursday to answer questions you may have, share our knowledge or help
you in planning your online event.

Some of the topics we can cover:
- our tools research and findings
- our concepts for running an online conference or event
- our experience with running EuroPython online
- what we could do to support you
- how our Zoom license sharing works
- how you can apply for a grant
- how the EuroPython Society works
- how we run the EuroPython organization with fully remote work groups
and, of course, anything else :-)

If you’re interested in joining the call, please send your name and
email to helpd...@europython.eu and we’ll send you the invite for the
call on

* Thursday, Sept 24, starting at 19:30 CEST *

When requesting the invite, please also consider adding any more
detailed questions, so we can better prepare and make the meeting more
effective.

If there is demand, we’ll probably have these calls on a monthly basis
to keep the momentum going.

BTW: We are making our conference resources available on our website, in
case you have missed our blog post earlier this year.

Many thanks.


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/629951901661790208/europython-ask-me-anything

Tweet:

https://twitter.com/europython/status/1308346430130663426

Thanks,
--
EuroPython 2020 Team
https://ep2020.europython.eu/
https://www.europython-society.org/

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


Re: PyOBEX installation problem

2020-09-22 Thread Walter Penn

Johny wrote:

I tried to install PyOBEX


Maybe this one instead?

pip install PyOBEX


see https://pypi.org/project/PyOBEX/

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


Fwd: Trouble with uninstalling Python 3.8 from windows10

2020-09-22 Thread Malkinson Guy
Hello 
I'm a Python beginner. I installed last week python 3.8 64bit on windows 10 for 
the purpose of working with tiff images. 
I next tried to import PIL (or pil), but was unsuccessful (all stackoverflow 
solutions didn't work either). I next thought this could be due to the python 
version, and wanted to removed the 3.8 in order to install an older version. 
But I can't seem to uninstall: while the uninstaller gives a "successfully 
uninstalled" message, the python is not removed from the list of programs. I 
also tried deleting the python folder itself, this doesn't work. And of course 
have restarted the computer... 
I then tried to modify via the applications list: I didn't receive the option 
of "modify" or "repair", only install. So I proceeded with the installation, 
which failed , error message 0x80070001 
Any ideas how to solve these issues? 
All the best 
Guy 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Question from a "java background" developer

2020-09-22 Thread Dieter Maurer
Chris Angelico wrote at 2020-9-22 19:25 +1000:
>On Tue, Sep 22, 2020 at 7:15 PM Agnese Camellini
> wrote:
>>
>> Hello to everyone, I have a question. I come from a Java background and I
>> would like to develop in python but i'm wondering: is there anything, in
>> python, like Java "reflection"?
>> I mean do i have a keyword to obtain all the methods and the attributes of
>> a class in python?
>
>Yes - introspection can be done by looking at a class's dictionary.
>Check out the dir() function to start exploring!

I find also `help(obj)` very helpful.

The basics behind `help` (a built in function) come from
the `inspect` module. It is very helpful to programmatically inspect
features of Python objects.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pythonic style

2020-09-22 Thread Stavros Macrakis
Thanks to everyone for the comments, especially Tim Chase for the simple
and elegant tuple unpacking solution, and Léo El Amri for the detailed
comments on the variants. Below are some more variants which *don't *use
tuple unpacking, on the theory that the coding patterns may be useful in
other cases where unpacking doesn't apply.

For me, one of the interesting lessons from all these finger exercises is
that *for* and unpacking hide a lot of messiness, both the initial *iter* call
and the exception handling. I don't see any way to eliminate the *iter*,
but there are ways to avoid the verbose exception handling.

Using the second arg to *next*, we get what is arguably a more elegant
solution:


_uniq = []
def firstg(iterable):
it = iter(iterable)
val0 = next(it,_uniq)
val1 = next(it,_uniq)
if val0 is not _uniq and val1 is _uniq:
return val0
else:
raise ValueError("first1: arg not exactly 1 long")


But I don't know if the *_uniq* technique is considered Pythonic.

If *next* were instead defined to return a flag (rather than raising an
exception), the code becomes cleaner and clearer, something like this:


def firsth(iterable):
  it = iter(iterable)
  (val0, good0) = next2(it)
  (val1, good1) = next2(it)  # val1 is dummy
  if good0 and not good1:
return val0
  else:
raise ValueError("first1: arg not exactly 1 long")

# returns (value, validp)

# validp is False if no more values

def next2(iterable):
  try:
val = next(iterable)
  except StopIteration:
return (None, False)
  return (val, True)


(To be clear, I'm *not *suggesting that *next2* replace *next*!)

Thoughts?

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


Re: Pythonic style

2020-09-22 Thread Chris Angelico
On Wed, Sep 23, 2020 at 3:52 AM Stavros Macrakis  wrote:
>
> Thanks to everyone for the comments, especially Tim Chase for the simple
> and elegant tuple unpacking solution, and Léo El Amri for the detailed
> comments on the variants. Below are some more variants which *don't *use
> tuple unpacking, on the theory that the coding patterns may be useful in
> other cases where unpacking doesn't apply.

When doesn't it apply? Can you elaborate on this? It might be easier
to advise on Pythonic style when the specific requirements are known.

> For me, one of the interesting lessons from all these finger exercises is
> that *for* and unpacking hide a lot of messiness, both the initial *iter* call
> and the exception handling. I don't see any way to eliminate the *iter*,
> but there are ways to avoid the verbose exception handling.

In Python, exception handling IS the way to do these things. Having a
two-part return value rather than using an exception is an unusual
idiom in Python (although it's well known in other languages; I
believe JavaScript does iterators this way, for one).

> Using the second arg to *next*, we get what is arguably a more elegant
> solution:
>
>
> _uniq = []
> def firstg(iterable):
> it = iter(iterable)
> val0 = next(it,_uniq)
> val1 = next(it,_uniq)
> if val0 is not _uniq and val1 is _uniq:
> return val0
> else:
> raise ValueError("first1: arg not exactly 1 long")
>
> But I don't know if the *_uniq* technique is considered Pythonic.

It is when it's needed, but a more common way to write this would be
to have the sentinel be local to the function (since it doesn't need
to be an argument):

def firstg_variant(iterable):
it = iter(iterable)
sentinel = object()
first = next(it, sentinel)
if first is sentinel:
raise ValueError("empty iterable")
second = next(it, sentinel)
if second is not sentinel:
raise ValueError("too many values")
return first

But getting a return value and immediately checking it is far better
spelled "try/except" here. (Note, BTW, that I made a subtle change to
the logic here: this version doesn't call next() a second time if the
first one returned the sentinel. This avoids problems with broken
iterators that raise StopException and then keep going.)

> If *next* were instead defined to return a flag (rather than raising an
> exception), the code becomes cleaner and clearer, something like this:
>
>
> def firsth(iterable):
>   it = iter(iterable)
>   (val0, good0) = next2(it)
>   (val1, good1) = next2(it)  # val1 is dummy
>   if good0 and not good1:
> return val0
>   else:
> raise ValueError("first1: arg not exactly 1 long")
>

IMO this isn't any better than the previous one. You still need a
sentinel, but now you use True and False instead of a special object.
It isn't *terrible*, but it's no advantage either.

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


List Partition Comprehension (Feature Suggestion)

2020-09-22 Thread Yakov Shalunov
Python list comprehension is substantially faster than plan iteration, to the 
point where
```
l0, l1 = [],[]
for x in l:
if cond(x):
l0.append(x)
else:
l1.append(x)
```
runs at about the same speed as
```
l0 = [x for x in l if cond(x)]
l1 = [x for x in l if not cond(x)]
```
assuming `cond` is a computationally light conditional.
While this isn't an extremely common use, I suggest a "partition comprehension" 
syntax which extends normal filtered-generator syntax. Such as:
```
l0, l1 = ([x for x in l if cond(x) else x])
```
(parenthesis there to indicate that the output is a tuple)
It could allow extension to n-way partitions as well. Because elif doesn't fit 
nicely in-line, it would probably be nicer to do it like:
```
l0, l1, l2 = ([x for x in l if cond0(x) else x**2 if cond1(x) else x**3])
```
So l0 would be all elements that match cond0, l1 would be squares of all that 
match cond1, and l2 would be cubes of everything that matches neither.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: List Partition Comprehension (Feature Suggestion)

2020-09-22 Thread Yakov Shalunov
A possible alternative would be a partition library function in the same vein 
as `map` and `filter`
```
def partition(n, key, iter):
"""
Partitions a list.
Args: (n: the number of partitions), (key: function which takes elements 
and returns the index of the partition to place them in), (iter: the iterable 
to be partitioned)
Returns: A tuple of lists partitioned per the key function. If this were a 
library function, this would likely return a tuple of generators instead in the 
same vein as `map` and `filter`.
"""
lists = tuple([] for _ in range(n))
for x in iter:
lists[key(x)].append(x)
return lists
```
Except it would be optimized like a library function (which means written in C, 
I believe)

On Tuesday, September 22, 2020 at 12:16:39 PM UTC-7, Yakov Shalunov wrote:
> Python list comprehension is substantially faster than plan iteration, to the 
> point where 
> ``` 
> l0, l1 = [],[] 
> for x in l: 
> if cond(x): 
> l0.append(x) 
> else: 
> l1.append(x) 
> ``` 
> runs at about the same speed as 
> ``` 
> l0 = [x for x in l if cond(x)] 
> l1 = [x for x in l if not cond(x)] 
> ``` 
> assuming `cond` is a computationally light conditional. 
> While this isn't an extremely common use, I suggest a "partition 
> comprehension" syntax which extends normal filtered-generator syntax. Such 
> as: 
> ``` 
> l0, l1 = ([x for x in l if cond(x) else x]) 
> ``` 
> (parenthesis there to indicate that the output is a tuple) 
> It could allow extension to n-way partitions as well. Because elif doesn't 
> fit nicely in-line, it would probably be nicer to do it like: 
> ``` 
> l0, l1, l2 = ([x for x in l if cond0(x) else x**2 if cond1(x) else x**3]) 
> ``` 
> So l0 would be all elements that match cond0, l1 would be squares of all that 
> match cond1, and l2 would be cubes of everything that matches neither.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Importing from within package

2020-09-22 Thread Chris Angelico
On Wed, Sep 23, 2020 at 9:24 AM Dennis Lee Bieber  wrote:
>
> On Tue, 22 Sep 2020 20:14:01 +0400, Abdur-Rahmaan Janhangeer
>  declaimed the following:
>
> >I have this main script:
> >https://github.com/Abdur-rahmaanJ/shopyo/blob/dev/shopyo/__main__.py
> >
>
> Well, that file name scares me...
>
> __main__ is the name Python uses internally for the, well, main 
> program
> (whatever the real file name is), and becomes part of the convention
>
> if __name__ == "__main__":
> #running as stand-alone program
> #do stuff
>
> where imported files will appear with the name by which they were imported.
>

In a package, __main__.py does that same job.

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


Re: Question from a "java background" developer

2020-09-22 Thread David Lowry-Duda
On Tue, Sep 22, 2020 at 11:13:50AM +0200, Agnese Camellini wrote:
> I mean do i have a keyword to obtain all the methods and the 
> attributes of
> a class in python?

In addition to the `dir()` that others have mentioned, I'll add that 
developing interactively is very common, especially in ipython/jupyter 
sessions or notebooks. With these, you have tab completion or question 
mark documentation.

For example, if you have an instance `myobj` of the class `MyClass`, 
then in an ipython session, typing `myobj.` will open up a list of 
all the methods for objects of `MyClass`. And given an object or 
funcation, appending `?` will bring up the documentation (as given in 
the docstring) for that object or function. This is true even for 
user-defined functions and objects, even if they were defined during the 
same interactive session.

Good luck!

-- 
David Lowry-Duda  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: List Partition Comprehension (Feature Suggestion)

2020-09-22 Thread Greg Ewing

On 23/09/20 7:16 am, Yakov Shalunov wrote:

l0, l1 = ([x for x in l if cond(x) else x])
l0, l1, l2 = ([x for x in l if cond0(x) else x**2 if cond1(x) else x**3])


This syntax seems a bit convoluted. One of the result expressions
is at the beginning as usual, but the rest are tacked on the end.
And it's far from obvious that it returns multiple lists instead
of a single list with alternative values, as you would get from

[(x if cond0(x) else x**2 if cond1(x) else x**3) for x in l]

which at first glance seems very similar.

Also I'm not sure how this would interact with the existing
comprehension syntax in its full generality, where you can
have multiple "for" and "if" clauses mixed in any order.


A possible alternative would be a partition library function in the
same vein as `map` and `filter`

That sounds like a much better idea for something that is so
rarely needed. Although it probably wouldn't be as fast as an
LC could potentially be, due to the need to call a user-supplied
function for every item.

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


Re: Importing from within package

2020-09-22 Thread 黃炳熙
Chris Angelico  writes:

> ...
> In a package, __main__.py does that same job.

Sorry ChrisA, would you please some example? Because i am working in
progress with Python things... 

Sicnerely, Byung-Hee

-- 
^고맙습니다 _布德天下_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Importing from within package

2020-09-22 Thread Terry Reedy

On 9/22/2020 8:31 PM, Chris Angelico wrote:

On Wed, Sep 23, 2020 at 9:24 AM Dennis Lee Bieber  wrote:


On Tue, 22 Sep 2020 20:14:01 +0400, Abdur-Rahmaan Janhangeer
 declaimed the following:


I have this main script:
https://github.com/Abdur-rahmaanJ/shopyo/blob/dev/shopyo/__main__.py



 Well, that file name scares me...

 __main__ is the name Python uses internally for the, well, main program
(whatever the real file name is), and becomes part of the convention

if __name__ == "__main__":
 #running as stand-alone program
 #do stuff

where imported files will appear with the name by which they were imported.



In a package, __main__.py does that same job.


I am not sure of your intended meaning.

Assume that director 'mypac' is in a directory on sys.path.  Forget 
namespace packages, which I have not studied.

'import mypac' within code imports mypac/__init__.py
'python -m mypac' on a command line runs mypac/__main__.py

Example: .../pythonxy/lib/idlelib. lib is on sys.path.
idlelib/__init__.py is nearly empty.
idlelib/__main__.py starts IDLE,
so 'python -m idlelib' on a command line starts idle.


--
Terry Jan Reedy

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


Re: List Partition Comprehension (Feature Suggestion)

2020-09-22 Thread Terry Reedy

On 9/22/2020 3:16 PM, Yakov Shalunov wrote:

Python list comprehension is substantially faster than plan iteration, to the 
point where
```
l0, l1 = [],[]
for x in l:
 if cond(x):
 l0.append(x)
 else:
 l1.append(x)
```
runs at about the same speed as
```
l0 = [x for x in l if cond(x)]
l1 = [x for x in l if not cond(x)]
```
assuming `cond` is a computationally light conditional.
While this isn't an extremely common use, I suggest a "partition comprehension" 
syntax which extends normal filtered-generator syntax. Such as:
```
l0, l1 = ([x for x in l if cond(x) else x])
```
(parenthesis there to indicate that the output is a tuple)


Parentheses only make a tuple when empty.  They otherwise group items as 
function arguments or to indicate precedence.


'else' by itself would be enough to indicate that one wants two streams, 
even if it is a bit baroque.


'x for x in iterable if condition' is a generator comprehension. 
Putting {} or [] around it says to run the iteration to make a set or 
list.  Passing the generator comprehension to set() or list() has the 
same effect, but the set or list comprehensions can be optimized to run 
faster.


'x:f(x) for x in iterable' is not quite legal as a standalone generator, 
but '(x,f(x)} for x in iterable' is, and {x:f(x) for x in iterable} has 
the effect of

dict((x,f(x)) for x in iterable).

By analogy,
'ftrue(x) for x in iterable if condition else ffalse(x)'
should be a double generator comprehension producing a pair of generators
'(f(x) for x in iterable if condition),
 (f(x) for x in iterable if not condition)'

Then enclosing in {} or [] applies set() or list() to each separately to 
produce a pair of sets or lists.  But the latter could be optimized.


The double generator comprehension is similar to a conditional 
expression except that both true and false values are produced -- and 
kept separate.

'(ft(x) if condition else ff(x)) for x in iterable'
is legal today, but does not separate the true and false results.

--
Terry Jan Reedy

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


Python 3.8.5 Not Launching

2020-09-22 Thread yehudisgru
   Hi,

    

   I installed Python 3.8.5 on Windows 10

   When I click on a python file it launches the program but it closes
   immediately.

    

   Please help, thanks.

    

   Yehudis Gruber

    

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


Re: Importing from within package

2020-09-22 Thread Chris Angelico
On Wed, Sep 23, 2020 at 2:16 PM Terry Reedy  wrote:
>
> On 9/22/2020 8:31 PM, Chris Angelico wrote:
> > On Wed, Sep 23, 2020 at 9:24 AM Dennis Lee Bieber  
> > wrote:
> >>
> >> On Tue, 22 Sep 2020 20:14:01 +0400, Abdur-Rahmaan Janhangeer
> >>  declaimed the following:
> >>
> >>> I have this main script:
> >>> https://github.com/Abdur-rahmaanJ/shopyo/blob/dev/shopyo/__main__.py
> >>>
> >>
> >>  Well, that file name scares me...
> >>
> >>  __main__ is the name Python uses internally for the, well, main 
> >> program
> >> (whatever the real file name is), and becomes part of the convention
> >>
> >> if __name__ == "__main__":
> >>  #running as stand-alone program
> >>  #do stuff
> >>
> >> where imported files will appear with the name by which they were imported.
> >>
> >
> > In a package, __main__.py does that same job.
>
> I am not sure of your intended meaning.
>
> Assume that director 'mypac' is in a directory on sys.path.  Forget
> namespace packages, which I have not studied.
> 'import mypac' within code imports mypac/__init__.py
> 'python -m mypac' on a command line runs mypac/__main__.py
>
> Example: .../pythonxy/lib/idlelib. lib is on sys.path.
> idlelib/__init__.py is nearly empty.
> idlelib/__main__.py starts IDLE,
> so 'python -m idlelib' on a command line starts idle.
>

Correct. I was a bit too brief there, but Terry's elaboration is what
I was getting at: that __main__.py is a valid and normal member of a
package, and will be used as the entry point.

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


Re: Python 3.8.5 Not Launching

2020-09-22 Thread Igor Korot
Hi,

On Tue, Sep 22, 2020 at 11:25 PM  wrote:
>
>Hi,
>
>
>
>I installed Python 3.8.5 on Windows 10
>
>When I click on a python file it launches the program but it closes
>immediately.

What is the content of this file?
Is it a py or pyc file?

Thank you.

>
>
>
>Please help, thanks.
>
>
>
>Yehudis Gruber
>
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Importing from within package

2020-09-22 Thread Abdur-Rahmaan Janhangeer
Greetings list,

In case this might help, i am on Python3.8 and running in a virtual env
This command also does not work:
python -m shopyo new . test2

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

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