Re: `import somemodule` does not check all paths in `sys.path`

2018-07-29 Thread stefand986
Am Sonntag, 29. Juli 2018 01:32:07 UTC+2 schrieb MRAB:
That was also my first suspicion, but I checked that the path exists by 
printing the directory contents out, right before the ìmport ` statement.

The "please check your config" message are a result of another package 
(aiohttp_cors) that is also dynamically installed and then not found when it is 
imported.

> The log contains entries that say "Please check your config". To me it 
> looks like it hasn't been installed.
> 
> Does the path 
> /home/pyuser/.homeassistant/deps/lib/python3.7/site-packages actually exist?

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


Why is multiprocessing.Queue creating a thread ?

2018-07-29 Thread Léo El Amri via Python-list
Hello list,

This is a simple question: I wonder what is the reason behind
multiprocessing.Queue creating a thread to send objects through a
multiprocessing.connection.Connection.
I plan to implement an asyncio "aware" Connection class. And while
reading the source code of the multiprocessing module, I found that (As
outlined in the documentation) Queue is indeed creating a thread. I want
to know if I'm missing something.

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


Re: Why is multiprocessing.Queue creating a thread ?

2018-07-29 Thread Chris Angelico
On Sun, Jul 29, 2018 at 8:03 PM, Léo El Amri via Python-list
 wrote:
> Hello list,
>
> This is a simple question: I wonder what is the reason behind
> multiprocessing.Queue creating a thread to send objects through a
> multiprocessing.connection.Connection.
> I plan to implement an asyncio "aware" Connection class. And while
> reading the source code of the multiprocessing module, I found that (As
> outlined in the documentation) Queue is indeed creating a thread. I want
> to know if I'm missing something.

I'm not certain, but I suspect it's the simplest way to create a
non-blocking feeder. If you want to subclass it and replace that with
something that uses your event loop, go ahead; it might end up
becoming an additional subclass in the stdlib, alongside SimpleQueue
and JoinableQueue.

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


Re: Using Python on a fork-less POSIX-like OS

2018-07-29 Thread Jan Claeys
On Fri, 2018-07-27 at 19:13 +0200, Barath Aron wrote:
> I intend to cross-compile Python v3.6.6 to Threos ( https://threos.io
>  ) operating system. Threos is supports a quite large set from 
> POSIX and C89/C99. Unfortunately, Threos lacks fork(2), but
> provides posix_spawn(3) instead. I already made some local changes
> in posixmodule.c to compile due to some features are detected 
> as present but actually not supported, like HAVE_FORK -- I blame
> autotools for this :-). I don't know, however, whether the Python
> shall cross-compile without issues.
> 
> My question is that the _posixsubprocess.c can be prepared to
> use posix_spawn(3) instead of fork(2)? Maybe the UNIX/Linux version
> can also benefit from it, see: https://salsa.debian.org/ruby-
> team/ruby-posix-spawn

You might want to ask this on the python-dev mailing list.


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


Demo-Mode in IPython broken?

2018-07-29 Thread Albert Brandl
Hi!

The IPython documentation mentions a demo mode that can be used
to execute chunks of a Python file that are separated by special
comments (e.g. "#  stop").

The annotated Python file can be executed by importing `Demo` from
`IPython.lib.demo`, instantiating it using the file name and calling
the `Demo` instance:

from IPython.lib.demo import Demo
d = Demo("some_file.py")
d()

According to the documentation, all names that are defined in such a
chunk are transferred to the global IPython namespace. This would
allow me to interactively inspect the names etc.

It looks like this feature does not work in the version 6.4.0 of
IPython: the global namespace does not change after executing any chunk
of a Python file. The Demo instance has a dictionary called `user_ns`
that _is_ updated when a chunk is executed, but using it to access the
names is quite clumsy ;-).

Is this a known bug? Do you have a suggestion how I could emulate the
behavior of the demo mode by other means (not necessarily with IPython)?

TIA and best regards,

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


Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread stanimira . s . 93
Hi there,

I'm trying make reach analyze with Urban network analysis (UNA) tool in ArcGIS. 
It's based on points for buildings and pedestrian network of acceptability 
steets. The aim is to show how many people from each building can reach 
different building in radius of 150 meters (so i can find the density of the 
pedestrian routes). 

I run Urban network analysis but It shows similar mistake several times. The 
UNA tool is free plugin that i downloaded, it's not from the default intalled 
in ArcGIS packed. It ask for integer data.
I checked the type of the attributes, it's all integer. PLus it's all in geo 
data based file.

Unfortunately I don't understand Python, I'm one of those who use ArcGIS as 
sample customer. 

This is the mistake:

Start Time: Fri Jul 27 14:48:32 2018
Running script Centrality...
[started] Copying input buildings
[finished]
[1 started] Computing adjacency list
[1 failed] 
Not successful
Completed script Centrality...
Succeeded at Fri Jul 27 14:48:36 2018 (Elapsed Time: 4,56 seconds)

Any suggestions? How it's calling these adjaency list? What could be wrong? I 
even don't know how to get debugger, so it could give me more information.

Thank you previously,
Mira

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


Re: Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread MRAB

On 2018-07-29 18:56, stanimira.s...@gmail.com wrote:

Hi there,

I'm trying make reach analyze with Urban network analysis (UNA) tool in ArcGIS. 
It's based on points for buildings and pedestrian network of acceptability 
steets. The aim is to show how many people from each building can reach 
different building in radius of 150 meters (so i can find the density of the 
pedestrian routes).

I run Urban network analysis but It shows similar mistake several times. The 
UNA tool is free plugin that i downloaded, it's not from the default intalled 
in ArcGIS packed. It ask for integer data.
I checked the type of the attributes, it's all integer. PLus it's all in geo 
data based file.

Unfortunately I don't understand Python, I'm one of those who use ArcGIS as 
sample customer.

This is the mistake:

Start Time: Fri Jul 27 14:48:32 2018
Running script Centrality...
[started] Copying input buildings
[finished]
[1 started] Computing adjacency list
[1 failed]
Not successful
Completed script Centrality...
Succeeded at Fri Jul 27 14:48:36 2018 (Elapsed Time: 4,56 seconds)

Any suggestions? How it's calling these adjaency list? What could be wrong? I 
even don't know how to get debugger, so it could give me more information.

Thank you previously,
Mira

All you've shown is that says that it was unsuccessful, and it doesn't 
say why.


We'd need a lot more info than that!

The best way to debug it is to try it with the minimal amount of test 
data that should give a result.

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


Re: Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread Станимира Николова
неделя, 29 юли 2018 г., 23:41:01 UTC+3, MRAB написа:
> On 2018-07-29 18:56, stanimira.s...@gmail.com wrote:
> > Hi there,
> > 
> > I'm trying make reach analyze with Urban network analysis (UNA) tool in 
> > ArcGIS. It's based on points for buildings and pedestrian network of 
> > acceptability steets. The aim is to show how many people from each building 
> > can reach different building in radius of 150 meters (so i can find the 
> > density of the pedestrian routes).
> > 
> > I run Urban network analysis but It shows similar mistake several times. 
> > The UNA tool is free plugin that i downloaded, it's not from the default 
> > intalled in ArcGIS packed. It ask for integer data.
> > I checked the type of the attributes, it's all integer. PLus it's all in 
> > geo data based file.
> > 
> > Unfortunately I don't understand Python, I'm one of those who use ArcGIS as 
> > sample customer.
> > 
> > This is the mistake:
> > 
> > Start Time: Fri Jul 27 14:48:32 2018
> > Running script Centrality...
> > [started] Copying input buildings
> > [finished]
> > [1 started] Computing adjacency list
> > [1 failed]
> > Not successful
> > Completed script Centrality...
> > Succeeded at Fri Jul 27 14:48:36 2018 (Elapsed Time: 4,56 seconds)
> > 
> > Any suggestions? How it's calling these adjaency list? What could be wrong? 
> > I even don't know how to get debugger, so it could give me more information.
> > 
> > Thank you previously,
> > Mira
> > 
> All you've shown is that says that it was unsuccessful, and it doesn't 
> say why.
> 
> We'd need a lot more info than that!
> 
> The best way to debug it is to try it with the minimal amount of test 
> data that should give a result.

I'm sorry. 
Could someone help me by telling me how to make these test data? (so i could 
send it to You)

I realize the review of the bug is just the customer view. Any chance to help 
me out with the test of the process? 

Thank you previously. If there is another forum that i have to write to, i will 
switch. The fact is that in the Themes for UNA tool or GIS software, almost no 
one respond.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using Python on a fork-less POSIX-like OS

2018-07-29 Thread Terry Reedy

On 7/29/2018 10:28 AM, Jan Claeys wrote:

On Fri, 2018-07-27 at 19:13 +0200, Barath Aron wrote:

I intend to cross-compile Python v3.6.6 to Threos ( https://threos.io
  ) operating system. Threos is supports a quite large set from
POSIX and C89/C99. Unfortunately, Threos lacks fork(2), but
provides posix_spawn(3) instead. I already made some local changes
in posixmodule.c to compile due to some features are detected
as present but actually not supported, like HAVE_FORK -- I blame
autotools for this :-).


Then perhaps Threos should be patched to describe itself more accurately 
or autotools patched to detect more accurately.



I don't know, however, whether the Python
shall cross-compile without issues.


We generally prefer that it does, but no longer try to officially 
support (with conditionals in the codebase) every odd-ball OS.  You or 
some Threos group may have to keep a separate patch set, to be update 
for each Python version.  If there is any such thing now, Google does 
not find it.



My question is that the _posixsubprocess.c can be prepared to
use posix_spawn(3) instead of fork(2)?


What does the doc for _posixubprocess so it does?  If it says 'create a 
subprocess by forking', then perhaps not.



Maybe the UNIX/Linux version
can also benefit from it, see: https://salsa.debian.org/ruby-
team/ruby-posix-spawn


You might want to ask this on the python-dev mailing list.


multiprocessing module uses 'spawn' rather than 'fork' on Windows and it 
has an option to use 'spawn' even on *nix.  I presume the latter refers 
to posix_spawn.  You might want to check the multiprocessing code to see 
what *it* is doing 'under the covers'.


--
Terry Jan Reedy

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


Re: Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread MRAB

On 2018-07-29 22:00, Станимира Николова wrote:

неделя, 29 юли 2018 г., 23:41:01 UTC+3, MRAB написа:

On 2018-07-29 18:56, stanimira.s...@gmail.com wrote:
> Hi there,
> 
> I'm trying make reach analyze with Urban network analysis (UNA) tool in ArcGIS. It's based on points for buildings and pedestrian network of acceptability steets. The aim is to show how many people from each building can reach different building in radius of 150 meters (so i can find the density of the pedestrian routes).
> 
> I run Urban network analysis but It shows similar mistake several times. The UNA tool is free plugin that i downloaded, it's not from the default intalled in ArcGIS packed. It ask for integer data.

> I checked the type of the attributes, it's all integer. PLus it's all in geo 
data based file.
> 
> Unfortunately I don't understand Python, I'm one of those who use ArcGIS as sample customer.
> 
> This is the mistake:
> 
> Start Time: Fri Jul 27 14:48:32 2018

> Running script Centrality...
> [started] Copying input buildings
> [finished]
> [1 started] Computing adjacency list
> [1 failed]
> Not successful
> Completed script Centrality...
> Succeeded at Fri Jul 27 14:48:36 2018 (Elapsed Time: 4,56 seconds)
> 
> Any suggestions? How it's calling these adjaency list? What could be wrong? I even don't know how to get debugger, so it could give me more information.
> 
> Thank you previously,

> Mira
> 
All you've shown is that says that it was unsuccessful, and it doesn't 
say why.


We'd need a lot more info than that!

The best way to debug it is to try it with the minimal amount of test 
data that should give a result.


I'm sorry.
Could someone help me by telling me how to make these test data? (so i could 
send it to You)

I realize the review of the bug is just the customer view. Any chance to help 
me out with the test of the process?

Thank you previously. If there is another forum that i have to write to, i will 
switch. The fact is that in the Themes for UNA tool or GIS software, almost no 
one respond.


I'm unfamiliar with ArcGIS, so I doubt I could help.

It might have generated a log file somewhere that gives more details.
--
https://mail.python.org/mailman/listinfo/python-list


Re: `import somemodule` does not check all paths in `sys.path`

2018-07-29 Thread dieter
stefand...@gmail.com writes:
> ...
> The "story" is: In homeassistant (short HA) some modules are installed at 
> runtime during first start ("bootstrapping"), and for some reason loading the 
> modules fails directly after installing the modules. Subsequent starts work 
> fine.
>
> The modules that are installed during bootstrapping are installed to 
> `~/.homeassistant/deps/lib/python3.7/site-packages`. Installing the modules 
> happens in a different thread than where the modules are imported. (However 
> as far as I can tell the importing thread waits for the install to finish.)
>
> Now the interesting thing is that when I start HA in verbose mode, I can see 
> that Python is trying not all of the paths that are in `sys.path` (in the 
> following snippet I cut out some stuff for brevity. Link to the full log at 
> the end). As one can see the 
> `~/.homeassistant/deps/lib/python3.7/site-packages` location is not tried and 
> hence the import fails:

When I remember right:

 * Python silently ignores non existent directories in "sys.path"
 * "~" is not automatically expanded into the home directory.

This would suggest, remplace "~/.homeassistent/..." by
"/home/pyuser/.homeassistent/..." and try again.

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


Re: `import somemodule` does not check all paths in `sys.path`

2018-07-29 Thread Chris Angelico
On Mon, Jul 30, 2018 at 3:15 PM, dieter  wrote:
> stefand...@gmail.com writes:
>> ...
>> The "story" is: In homeassistant (short HA) some modules are installed at 
>> runtime during first start ("bootstrapping"), and for some reason loading 
>> the modules fails directly after installing the modules. Subsequent starts 
>> work fine.
>>
>> The modules that are installed during bootstrapping are installed to 
>> `~/.homeassistant/deps/lib/python3.7/site-packages`. Installing the modules 
>> happens in a different thread than where the modules are imported. (However 
>> as far as I can tell the importing thread waits for the install to finish.)
>>
>> Now the interesting thing is that when I start HA in verbose mode, I can see 
>> that Python is trying not all of the paths that are in `sys.path` (in the 
>> following snippet I cut out some stuff for brevity. Link to the full log at 
>> the end). As one can see the 
>> `~/.homeassistant/deps/lib/python3.7/site-packages` location is not tried 
>> and hence the import fails:
>
> When I remember right:
>
>  * "~" is not automatically expanded into the home directory.

Yes, this would be correct. The expansion of ~ into your home
directory is actually a shell feature. You can use os.path.expanduser
to do the transformation manually, but it won't happen automatically.

Good catch.

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


Re: Python bug in ArcGIS - Urban Network analysis tool

2018-07-29 Thread Станимира Николова
понеделник, 30 юли 2018 г., 3:29:44 UTC+3, MRAB написа:
> On 2018-07-29 22:00, Станимира Николова wrote:
> > неделя, 29 юли 2018 г., 23:41:01 UTC+3, MRAB написа:
> >> On 2018-07-29 18:56, stanimira.s...@gmail.com wrote:
> >> > Hi there,
> >> > 
> >> > I'm trying make reach analyze with Urban network analysis (UNA) tool in 
> >> > ArcGIS. It's based on points for buildings and pedestrian network of 
> >> > acceptability steets. The aim is to show how many people from each 
> >> > building can reach different building in radius of 150 meters (so i can 
> >> > find the density of the pedestrian routes).
> >> > 
> >> > I run Urban network analysis but It shows similar mistake several times. 
> >> > The UNA tool is free plugin that i downloaded, it's not from the default 
> >> > intalled in ArcGIS packed. It ask for integer data.
> >> > I checked the type of the attributes, it's all integer. PLus it's all in 
> >> > geo data based file.
> >> > 
> >> > Unfortunately I don't understand Python, I'm one of those who use ArcGIS 
> >> > as sample customer.
> >> > 
> >> > This is the mistake:
> >> > 
> >> > Start Time: Fri Jul 27 14:48:32 2018
> >> > Running script Centrality...
> >> > [started] Copying input buildings
> >> > [finished]
> >> > [1 started] Computing adjacency list
> >> > [1 failed]
> >> > Not successful
> >> > Completed script Centrality...
> >> > Succeeded at Fri Jul 27 14:48:36 2018 (Elapsed Time: 4,56 seconds)
> >> > 
> >> > Any suggestions? How it's calling these adjaency list? What could be 
> >> > wrong? I even don't know how to get debugger, so it could give me more 
> >> > information.
> >> > 
> >> > Thank you previously,
> >> > Mira
> >> > 
> >> All you've shown is that says that it was unsuccessful, and it doesn't 
> >> say why.
> >> 
> >> We'd need a lot more info than that!
> >> 
> >> The best way to debug it is to try it with the minimal amount of test 
> >> data that should give a result.
> > 
> > I'm sorry.
> > Could someone help me by telling me how to make these test data? (so i 
> > could send it to You)
> > 
> > I realize the review of the bug is just the customer view. Any chance to 
> > help me out with the test of the process?
> > 
> > Thank you previously. If there is another forum that i have to write to, i 
> > will switch. The fact is that in the Themes for UNA tool or GIS software, 
> > almost no one respond.
> > 
> I'm unfamiliar with ArcGIS, so I doubt I could help.
> 
> It might have generated a log file somewhere that gives more details.

Ok, thank you for the patiance.
I installed PyCharm for trying make some tests. 

I add in a project the .py file for the adjacency list.

That's the main from the debuger:

pydev debugger: process 8904 is connecting

Connected to pydev debugger (build 182.3684.100)
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2018.2\helpers\pydev\pydevd.py", 
line 1664, in 
main()
  File "C:\Program Files\JetBrains\PyCharm 2018.2\helpers\pydev\pydevd.py", 
line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm 2018.2\helpers\pydev\pydevd.py", 
line 1068, in run
pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 
2018.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/INSTALL/Urban Network Analysis Toolbox 
1.01/src/Centrality/Adjacency_List_Computation.py", line 14, in 
from arcpy import AddField_management
ModuleNotFoundError: No module named 'arcpy'

May I found the following lines from the code?
-- 
https://mail.python.org/mailman/listinfo/python-list