Which editor is suited for view a python package's source?

2019-08-19 Thread jfong
I like to download one package's source and study it in an editor. It allows me 
to open the whole package as a project and let me jump from a reference in one 
file to its definition in another file back and forth. It will be even better 
if it can handle the import modules too. (Maybe this is too much:-)

Can anyone recommend such a tool?

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


Re: Which editor is suited for view a python package's source?

2019-08-19 Thread Nick Sarbicki
PyCharm takes you to the source code within the editor for any
variables/functions/classes/modules if you ctrl+click on what you want to
see. It allows you to browse the relevant bits of code quickly, as well as
let you change them in your local environment if need be.

That way you don't have to download the source separately, you can just use
it as a normal dependency.

But if you want to view the source of a project in isolation I imagine any
common editor will suffice. Personally I'll tend to look where the source
is hosted (GitHub, GitLab etc) instead of downloading it. But I can
understand why some may not trust this.

On Mon, 19 Aug 2019, 10:17 ,  wrote:

> I like to download one package's source and study it in an editor. It
> allows me to open the whole package as a project and let me jump from a
> reference in one file to its definition in another file back and forth. It
> will be even better if it can handle the import modules too. (Maybe this is
> too much:-)
>
> Can anyone recommend such a tool?
>
> --Jach
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: absolute path to a file

2019-08-19 Thread Cameron Simpson

On 19Aug2019 08:52, Paul St George  wrote:

On 19/08/2019 01:31, Cameron Simpson wrote:

On 18Aug2019 17:29, Paul St George  wrote:

On 18/08/2019 02:03, Cameron Simpson wrote:
1: Is image01.tif a real existing file when you ran this code?
Yes. image01.tif is real, existing and apparent.
But in what directory? What is its _actual_ full path as you expect it 
to be?


Aha. The Blender file that I am using to test this on has two images 
used as textures. They reside at:

/Users/Lion/Desktop/test8/image01.tif
/Users/Lion/Desktop/images/image02.tif

The Blender file is at /Users/Lion/Desktop/test8/tifftest8.blend


There's a remark on that web page I mentioned that suggests that the 
leading '//' indicates the filename is relative to the Blender model, so 
the context directory for the '//' is likely /Users/Lion/Desktop/test8.


(Chris and Peter lead me to believe that Blender has a special kind 
of relative path. The double slashes replace the path to the blend 
file’s directory.) realpath has done something but I know not what.


realpath needs a UNIX path. Your //image01.tif isn't a UNIX path, it is 
a special Blender path. First you need to convert it. By replacing '//' 
with the blend file's directory. Then you can call realpath. If you 
still need to.


[...snip...]

So you might want to write an unBlenderiser (untested example):

 from os.path import isabs, join as joinpath

 def unblenderise(filename, context_dir=None):
   # transmute Blender "relative" path
   if filename.startswith('//'):
 filename = filename[2:]
   if not isabs(filename) and context_dir is not None:
 # attach the filename to `context_dir` if supplied
 filename = joinpath(context_dir, filename)
   return filename

The idea here is to get back a meaningful UNIX path from a Blender 
path. It first strips a leading '//'. Next, _if_ the filename is 
relative _and_ you supplied the optional context_dir (eg the 
directory used for a file brwoser dialogue box), then it prepends 
that context directory.


This _does not_ call abspath or realpath or anything, it just 
returns a filename which can be used with them.


The idea is that if you know where image01.tif lives, you could 
supply that as the context directory.


Yes! Until Peter Otten's timely intervention, I was trying to do this 
and had managed to join the 
path_to_the_folder_that_contains_the_Blender_file to 
the_name_of_the_image (stripped of its preceding slashes).


Your unblenderise looks much better than my nascent saneblender so 
thank you. I will explore more!


Looks like you want wd=os.path.dirname(path_of_blend_file).

Does it depend on knowing where image01.tif lives and manually 
supplying that?


Sort of.

What you've got is '//image01.tif', which is Blender's special notation 
indicating a filename relative to the blend file's directory. All the 
Python library stuff expects an OS path (OS==UNIX on a Mac). So you want 
to convert that into a UNIX path.  For example:


   from os.path import dirname

   # Get this from somewhere just hardwiring it for the example.
   # Maybe from your 'n' object below?
   blend_file = '/Users/Lion/Desktop/test8/tifftest8.blend'

   blender_image_file = n.image.filename

   unix_image_file = unblenderise(blender_image_file, dirname(blend_file))

Now you have a UNIX path. If blend_file is an absolute path, 
unix_image_path will also be an absolute path. But if blend_file is a 
relative path (eg you opened up "tifftest8.blend") unix_image_path will 
be a relative path.


You don't need to use realpath or abspath on that _unless_ you need to 
reference the file from any directory (i.e. _not_ relative to where you 
currently are).


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Application Preferences

2019-08-19 Thread Dave via Python-list
The plan for an app that I'm doing was to use SQLite for data and to 
hold the preference settings as some apps do.  The plan was changed last 
week to allow the user to select the location of the data files (SQLite) 
rather than putting it where the OS would dictate.  Ok with that, but it 
brings up some questions.  First, I will need to have a file that points 
to the location of the data file  since that can't be hard coded. 
Second, if I have to have a file that is likely part of the application 
group of files, would it make more sense to use a more traditional 
preferences file?  How have other Python app developers done in this case?


Thanks,
Dave
--
https://mail.python.org/mailman/listinfo/python-list


Re: Application Preferences

2019-08-19 Thread Malcolm Greene
Hi Dave,

> The plan for an app that I'm doing was to use SQLite for data and to hold the 
> preference settings as some apps do.  The plan was changed last week to allow 
> the user to select the location of the data files (SQLite) rather than 
> putting it where the OS would dictate.  Ok with that, but it brings up some 
> questions.  First, I will need to have a file that points to the location of 
> the data file  since that can't be hard coded. Second, if I have to have a 
> file that is likely part of the application group of files, would it make 
> more sense to use a more traditional preferences file?  How have other Python 
> app developers done in this case?

We handle the "where is my config file" question by defaulting to script's 
current directory, then a script-specific folder within their home directory. 
Users can override that behavior by setting a script specific environment 
variable or by using a command line switch to point to a different location or 
config file.

We store our preferences in an INI style config file which we've found easier 
to support when there's problems.

Malcolm


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


Re: Application Preferences

2019-08-19 Thread Dave via Python-list

On 8/19/19 9:22 AM, Malcolm Greene wrote:

Hi Dave,


The plan for an app that I'm doing was to use SQLite for data and to hold the 
preference settings as some apps do.  The plan was changed last week to allow 
the user to select the location of the data files (SQLite) rather than putting 
it where the OS would dictate.  Ok with that, but it brings up some questions.  
First, I will need to have a file that points to the location of the data file  
since that can't be hard coded. Second, if I have to have a file that is likely 
part of the application group of files, would it make more sense to use a more 
traditional preferences file?  How have other Python app developers done in 
this case?


We handle the "where is my config file" question by defaulting to script's 
current directory, then a script-specific folder within their home directory. Users can 
override that behavior by setting a script specific environment variable or by using a 
command line switch to point to a different location or config file.

We store our preferences in an INI style config file which we've found easier 
to support when there's problems.

Malcolm



Malcolm,

Thanks for the reply.  I agree that a traditional INI file is the 
easiest way, especially since Python supports them.  So if I understand 
you, your apps look like this:


-App Dir
  |
  +-App Code Folder
 |
 +-(File to direct to home folder)

-Home Folder (the default location, but user can select other locations)
  |
  +-App INI Folder
 |
 +-App INI file
--
https://mail.python.org/mailman/listinfo/python-list


Re: Application Preferences

2019-08-19 Thread Malcolm Greene
Hi Dave,

> I agree that a traditional INI file is the easiest way, especially since 
> Python supports them.  So if I understand you, your apps look like this:

Yes with the following nuance for our application sized scripts that require 
multiple configuration files. In this latter case, we place all config files in 
a ../conf folder (see the OR option below).

-App Dir
   |
   +-App Code Folder (src)
  |
  +-App INI file

OR

-App Dir
   |
   +-conf
  |
  +-App INI file

AND

-Home Folder (the default location, but user can select other locations)
   |
   +-App INI Folder
  |
  +-App INI file

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


Using scapy to defeat the dns poisoning, is it possible?

2019-08-19 Thread Hongyi Zhao
Hi,

See my following testings:

$ dig www.twitter.com @8.8.8.8 +short
66.220.147.44

While the tcpdump gives the following at the meanwhile:


$ sudo tcpdump -n 'host 8.8.8.8 and port 53'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp5s0, link-type EN10MB (Ethernet), capture size 262144 
bytes
06:49:35.779852 IP 192.168.1.2.59443 > 8.8.8.8.53: 56457+ [1au] A? 
www.twitter.com. (44)
06:49:35.818492 IP 8.8.8.8.53 > 192.168.1.2.59443: 56457 1/0/0 A 
66.220.147.44 (49)
06:49:35.818531 IP 8.8.8.8.53 > 192.168.1.2.59443: 56457 1/0/0 A 
69.171.248.65 (49)
06:49:35.824454 IP 8.8.8.8.53 > 192.168.1.2.59443: 56457 3/0/1 CNAME 
twitter.com., A 104.244.42.129, A 104.244.42.65 (90)


As you can see, the dns is poisoned, is it possible to defeat this with 
scapy or some techniques with python?

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
-- 
https://mail.python.org/mailman/listinfo/python-list


Xlabel and ylabel are not shown

2019-08-19 Thread Amirreza Heidari
plt.figure(1)
plt.plot(history.history["loss"], "b", label="Mean Square Error of training")
plt.plot(history.history["val_loss"], "g", label="Mean Square Error of 
validation")
plt.legend()
plt.xlabel("Epoche")
plt.ylabel("Mean Square Error")
plt.xlim(0,200)
plt.show()
plt.savefig(r"C:\Users\aheidari\Dropbox\Dissertation\primary hot water use 
prediction\Diagrams\UnivariateTrainingerror.png", dpi=1200)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Meanwhile Norwegian trolls created ...

2019-08-19 Thread John Ladasky
On Saturday, August 17, 2019 at 2:40:14 AM UTC-7, Abdur-Rahmaan Janhangeer 
wrote:
> But it is not so easy to combine different memory management paradigms.

Oh, I feel this.  I love the look and feel of PyQt5, but object management has 
bitten me more than once.
-- 
https://mail.python.org/mailman/listinfo/python-list


How to login remote windos device using python

2019-08-19 Thread Iranna Mathapati
Hi Team,

can you please let me know, How to login the remote Windows machine using
python??

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


Re: My pseudocode to Python?

2019-08-19 Thread Rob Gaddi

On 8/19/19 10:43 AM, Stefan Ram wrote:

   Can someone kindly translate my pseudocode to terse Python:

list = \
[ 'afaueghauihaiuhgaiuhgaiuhgaeihui',
   'erghariughauieghaiughahgaihgaiuhgaiuh',
   'rejganregairghaiurghaiuhgauihgauighaei',
   if x: 'argaeruighaiurhauirguiahuiahgiauhgaeuihi',
   'reiugaheirughauierhgauiaeihauiehgiuaehuih'
   'ejiaeigaiuegreaiugheiugheaiughauighaiughaiu'
   'egairughauirghauiruiegihgruiehgiuaehgiaue' ]

   ? I want the list to have the seven strings shown as entries
   if bool(x) is True, but otherwise the list should only have
   six entries - without the entry directly behind "if x: ".




mylist = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
if not x:
   del mylist[3]


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Application Preferences

2019-08-19 Thread Barry Scott



> On 19 Aug 2019, at 13:43, Dave via Python-list  wrote:
> 
> The plan for an app that I'm doing was to use SQLite for data and to hold the 
> preference settings as some apps do.  The plan was changed last week to allow 
> the user to select the location of the data files (SQLite) rather than 
> putting it where the OS would dictate.  Ok with that, but it brings up some 
> questions.  First, I will need to have a file that points to the location of 
> the data file  since that can't be hard coded. Second, if I have to have a 
> file that is likely part of the application group of files, would it make 
> more sense to use a more traditional preferences file?  How have other Python 
> app developers done in this case?

There are expected locations for config files and data files on each OS.

On macOS you would use ~/Library/Preferences/ and put a file or a folder of 
files in there.
The convention is use your website name as the base name of the  file or folder.
For example for scm-workbench I use: org.barrys-emacs.scm-workbench as the 
folder name for
all the scm-workbench files.

On Windows you can use a file or folder in %APPDATA% that is named after your 
app. You should
find the folder by doing a win32 API call to get the value. See 
getPreferencesDir()  in
https://github.com/barry-scott/scm-workbench/blob/master/Source/Common/wb_platform_win32_specific.py
 

for how to get the value.

On Linux the XDG spec says that you should put config files in 
~/.config/ and data files
in  ~/.local/share/. Doing XDG to the spec is a little involved. I 
have some experimental
code that implements the logic for config the XdgConfigPath class in:
https://github.com/barry-scott/CLI-tools/blob/master/Source/smart_find/__init__.py
 


Putting a file directly in the $HOME folder is no longer recommended.

The format of the config data you are free to choose.
I have been using JSON files recently as it allow for structured data.


Barry

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


Re: Application Preferences

2019-08-19 Thread Dave via Python-list

On 8/19/19 1:53 PM, Barry Scott wrote:




On 19 Aug 2019, at 13:43, Dave via Python-list  wrote:

The plan for an app that I'm doing was to use SQLite for data and to hold the 
preference settings as some apps do.  The plan was changed last week to allow 
the user to select the location of the data files (SQLite) rather than putting 
it where the OS would dictate.  Ok with that, but it brings up some questions.  
First, I will need to have a file that points to the location of the data file  
since that can't be hard coded. Second, if I have to have a file that is likely 
part of the application group of files, would it make more sense to use a more 
traditional preferences file?  How have other Python app developers done in 
this case?


There are expected locations for config files and data files on each OS.

On macOS you would use ~/Library/Preferences/ and put a file or a folder of 
files in there.
The convention is use your website name as the base name of the  file or folder.
For example for scm-workbench I use: org.barrys-emacs.scm-workbench as the 
folder name for
all the scm-workbench files.

On Windows you can use a file or folder in %APPDATA% that is named after your 
app. You should
find the folder by doing a win32 API call to get the value. See 
getPreferencesDir()  in
https://github.com/barry-scott/scm-workbench/blob/master/Source/Common/wb_platform_win32_specific.py
 

for how to get the value.

On Linux the XDG spec says that you should put config files in 
~/.config/ and data files
in  ~/.local/share/. Doing XDG to the spec is a little involved. I 
have some experimental
code that implements the logic for config the XdgConfigPath class in:
https://github.com/barry-scott/CLI-tools/blob/master/Source/smart_find/__init__.py 


Putting a file directly in the $HOME folder is no longer recommended.

The format of the config data you are free to choose.
I have been using JSON files recently as it allow for structured data.


Barry



Barry, and all,

I agree that various OS's have a favorite place to put things.  Python 
has a library that will help.  However, there are valid reasons to let 
the customer choose.  Perhaps the drive/folder is a journaling one, or 
one that is backed up multiple times per day.  My take is to start with 
the OS solution, but let the customer decide.


How did this thread show up in the SQLite mailing list anyway?  Really 
has nothing to do with SQLite that I can see.


Dave,


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


Re: Application Preferences

2019-08-19 Thread dboland9 via Python-list
Wow, what happened here?  I posted this to the Python discussion group as it is 
a Python question, not an SQL question.  That said, I agree with what you have 
said, and that was the plan.  Plans get changed.  A number of apps. allow the 
user to specify the location of data and configuration files, and for good 
reason.  Some folders are auto-backup in that they are either journaled or 
backed up multiple times per day.  I think that is the argument in this case.

Dave,

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐ Original Message ‐‐‐
On Monday, August 19, 2019 1:53 PM, Barry Scott  wrote:

>> On 19 Aug 2019, at 13:43, Dave via Python-list  
>> wrote:
>>
>> The plan for an app that I'm doing was to use SQLite for data and to hold 
>> the preference settings as some apps do.  The plan was changed last week to 
>> allow the user to select the location of the data files (SQLite) rather than 
>> putting it where the OS would dictate.  Ok with that, but it brings up some 
>> questions.  First, I will need to have a file that points to the location of 
>> the data file  since that can't be hard coded. Second, if I have to have a 
>> file that is likely part of the application group of files, would it make 
>> more sense to use a more traditional preferences file?  How have other 
>> Python app developers done in this case?
>
> There are expected locations for config files and data files on each OS.
>
> On macOS you would use ~/Library/Preferences/ and put a file or a folder of 
> files in there.
> The convention is use your website name as the base name of the  file or 
> folder.
> For example for scm-workbench I use: org.barrys-emacs.scm-workbench as the 
> folder name for
> all the scm-workbench files.
>
> On Windows you can use a file or folder in %APPDATA% that is named after your 
> app. You should
> find the folder by doing a win32 API call to get the value. See 
> getPreferencesDir()  in
> https://github.com/barry-scott/scm-workbench/blob/master/Source/Common/wb_platform_win32_specific.py
> for how to get the value.
>
> On Linux the XDG spec says that you should put config files in 
> ~/.config/ and data files
> in  ~/.local/share/. Doing XDG to the spec is a little involved. I 
> have some experimental
> code that implements the logic for config the XdgConfigPath class in:
> https://github.com/barry-scott/CLI-tools/blob/master/Source/smart_find/__init__.py
>
> Putting a file directly in the $HOME folder is no longer recommended.
>
> The format of the config data you are free to choose.
> I have been using JSON files recently as it allow for structured data.
>
> Barry
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: absolute path to a file

2019-08-19 Thread Paul St George

On 19/08/2019 14:16, Cameron Simpson wrote:

On 19Aug2019 08:52, Paul St George  wrote:

On 19/08/2019 01:31, Cameron Simpson wrote:

On 18Aug2019 17:29, Paul St George  wrote:

On 18/08/2019 02:03, Cameron Simpson wrote:
1: Is image01.tif a real existing file when you ran this code?
Yes. image01.tif is real, existing and apparent.
But in what directory? What is its _actual_ full path as you expect 
it to be?


Aha. The Blender file that I am using to test this on has two images 
used as textures. They reside at:

/Users/Lion/Desktop/test8/image01.tif
/Users/Lion/Desktop/images/image02.tif

The Blender file is at /Users/Lion/Desktop/test8/tifftest8.blend


There's a remark on that web page I mentioned that suggests that the 
leading '//' indicates the filename is relative to the Blender model, so 
the context directory for the '//' is likely /Users/Lion/Desktop/test8.


Yes. That makes sense. The reason I was testing with two images, one at 
/Users/Lion/Desktop/test8/image01.tif and the other at 
/Users/Lion/Desktop/images/image02.tif is that I cannot rely on images 
being in the same folder as the Blender file.


So, let's assume the context directory is /Users/Lion/Desktop/test8
and see how we get on below.



(Chris and Peter lead me to believe that Blender has a special kind 
of relative path. The double slashes replace the path to the blend 
file’s directory.) realpath has done something but I know not what.


realpath needs a UNIX path. Your //image01.tif isn't a UNIX path, it is 
a special Blender path. First you need to convert it. By replacing '//' 
with the blend file's directory. Then you can call realpath. If you 
still need to.


Understood. Now. Thanks!


[...snip...]


Did you just [...snip...] yourself?


So you might want to write an unBlenderiser (untested example):

 from os.path import isabs, join as joinpath

 def unblenderise(filename, context_dir=None):
   # transmute Blender "relative" path
   if filename.startswith('//'):
 filename = filename[2:]
   if not isabs(filename) and context_dir is not None:
 # attach the filename to `context_dir` if supplied
 filename = joinpath(context_dir, filename)
   return filename

The idea here is to get back a meaningful UNIX path from a Blender 
path. It first strips a leading '//'. Next, _if_ the filename is 
relative _and_ you supplied the optional context_dir (eg the 
directory used for a file brwoser dialogue box), then it prepends 
that context directory.


This _does not_ call abspath or realpath or anything, it just returns 
a filename which can be used with them.


The idea is that if you know where image01.tif lives, you could 
supply that as the context directory.


Yes! Until Peter Otten's timely intervention, I was trying to do this 
and had managed to join the 
path_to_the_folder_that_contains_the_Blender_file to 
the_name_of_the_image (stripped of its preceding slashes).


Your unblenderise looks much better than my nascent saneblender so 
thank you. I will explore more!


Looks like you want wd=os.path.dirname(path_of_blend_file).


Thank you!


Does it depend on knowing where image01.tif lives and manually 
supplying that?


Sort of.

What you've got is '//image01.tif', which is Blender's special notation 
indicating a filename relative to the blend file's directory. All the 
Python library stuff expects an OS path (OS==UNIX on a Mac). So you want 
to convert that into a UNIX path.  For example:


    from os.path import dirname

    # Get this from somewhere just hardwiring it for the example.
    # Maybe from your 'n' object below?
    blend_file = '/Users/Lion/Desktop/test8/tifftest8.blend'

Is this setting a relative path?


    blender_image_file = n.image.filename

    unix_image_file = unblenderise(blender_image_file, dirname(blend_file))

Now you have a UNIX path. If blend_file is an absolute path, 
unix_image_path will also be an absolute path. But if blend_file is a 
relative path (eg you opened up "tifftest8.blend") unix_image_path will 
be a relative path.



Does unix_image_path = unix_image_file?

Two possibilities here.
blend_file (and so unix_image_file) is an absolute path OR blend_file 
(and so unix_image_file) is a relative path.


I just want to check my understanding. If I supply the path to 
blend_file then it is absolute, and if I ask Python to generate the path 
to blend_file from within Blender it is relative. Have I got it?




You don't need to use realpath or abspath on that _unless_ you need to 
reference the file from any directory (i.e. _not_ relative to where you 
currently are).


If I decided not to supply the path and so ended up with a relative UNIX 
path, I could now use realpath or abspath to find the absolute path. 
Have I still got it?


#
I combined your unblenderise and your use of it (see below). Is my 
attempt error free?


It works very well. So thank you! I tested it with a Blend file that had 
two images, one in the same folder as the Blend file and the other was 
in a fo

Re: My pseudocode to Python?

2019-08-19 Thread Kyle Stanley
Rather than starting with all seven strings in the list and deleting one if
a conditional is not true, why not start with 6 elements (with the one in
index 3 missing) and insert the 7th element into the third index?

>>> mylist = ['a', 'b', 'c', 'e', 'f', 'g']
>>> if x:
>>>mylist.insert(3, 'd')

>>> mylist
['a', 'b', 'c', 'd', 'e', 'f', 'g']


Regards,
Kyle Stanley (aeros167)


On Mon, Aug 19, 2019 at 2:30 PM Rob Gaddi 
wrote:

> On 8/19/19 10:43 AM, Stefan Ram wrote:
> >Can someone kindly translate my pseudocode to terse Python:
> >
> > list = \
> > [ 'afaueghauihaiuhgaiuhgaiuhgaeihui',
> >'erghariughauieghaiughahgaihgaiuhgaiuh',
> >'rejganregairghaiurghaiuhgauihgauighaei',
> >if x: 'argaeruighaiurhauirguiahuiahgiauhgaeuihi',
> >'reiugaheirughauierhgauiaeihauiehgiuaehuih'
> >'ejiaeigaiuegreaiugheiugheaiughauighaiughaiu'
> >'egairughauirghauiruiegihgruiehgiuaehgiaue' ]
> >
> >? I want the list to have the seven strings shown as entries
> >if bool(x) is True, but otherwise the list should only have
> >six entries - without the entry directly behind "if x: ".
> >
> >
>
> mylist = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
> if not x:
> del mylist[3]
>
>
> --
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order.  See above to fix.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which editor is suited for view a python package's source?

2019-08-19 Thread Dan Stromberg
Uh oh.  Editor wars.

The most popular choices today are probably PyCharm and VSCode.  I prefer
vim with the syntastic plugin (and a few other plugins including Jedi), but
I've heard good things about the other two.  And emacs almost certainly can
edit/view Python files well, though I haven't heard much about that.

HTH.

On Mon, Aug 19, 2019 at 2:15 AM  wrote:

> I like to download one package's source and study it in an editor. It
> allows me to open the whole package as a project and let me jump from a
> reference in one file to its definition in another file back and forth. It
> will be even better if it can handle the import modules too. (Maybe this is
> too much:-)
>
> Can anyone recommend such a tool?
>
> --Jach
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Your IDE's?

2019-08-19 Thread Dan Stromberg
I just mentioned essentially this in another thread, but I really like vim
with syntastic and jedi plus a few other plugins.

I keep all my vim config at http://stromberg.dnsalias.org/svn/vimrc/trunk/
so it's easy to set up a new machine.  I haven't used it on anything but
Debian/Ubuntu/Mint recently though, so other OS'es/Distributions may not
work.  It also does bash, lua, etcetera.

On Mon, Mar 25, 2019 at 2:40 PM John Doe  wrote:

>
> What is your favorite Python IDE?
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which editor is suited for view a python package's source?

2019-08-19 Thread Kyle Stanley
> The most popular choices today are probably PyCharm and VSCode.  I prefer
> vim with the syntastic plugin (and a few other plugins including Jedi),
but
> I've heard good things about the other two.

Personally, I've been using VSCode with the Python and Vim extensions. I've
used PyCharm as well and have no issues with it, but I've found VSCode to
be significantly more customizable. I also like that VSCode works across a
number of different languages instead of being exclusive to Python, so it
works great as a general purpose editor. I'm not a huge fan of switching
between different editors constantly, so I usually use Vim for plaintext
and VSCode for anything programming related.

On Mon, Aug 19, 2019 at 8:03 PM Dan Stromberg  wrote:

> Uh oh.  Editor wars.
>
> The most popular choices today are probably PyCharm and VSCode.  I prefer
> vim with the syntastic plugin (and a few other plugins including Jedi), but
> I've heard good things about the other two.  And emacs almost certainly can
> edit/view Python files well, though I haven't heard much about that.
>
> HTH.
>
> On Mon, Aug 19, 2019 at 2:15 AM  wrote:
>
> > I like to download one package's source and study it in an editor. It
> > allows me to open the whole package as a project and let me jump from a
> > reference in one file to its definition in another file back and forth.
> It
> > will be even better if it can handle the import modules too. (Maybe this
> is
> > too much:-)
> >
> > Can anyone recommend such a tool?
> >
> > --Jach
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to login remote windos device using python

2019-08-19 Thread Kyle Stanley
I would recommend checking out WMI: https://pypi.org/project/WMI/

For remote connection as a named user (official WMI docs):
http://timgolden.me.uk/python/wmi/tutorial.html#connecting-to-a-remote-machine-as-a-named-user

Also, another example (unofficial):
https://stackoverflow.com/questions/18961213/how-to-connect-to-a-remote-windows-machine-to-execute-commands-using-python.
This was done in Python2, but the example is still useful.

On Mon, Aug 19, 2019 at 2:11 PM Iranna Mathapati 
wrote:

> Hi Team,
>
> can you please let me know, How to login the remote Windows machine using
> python??
>
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which editor is suited for view a python package's source?

2019-08-19 Thread jfong
Nick Sarbicki於 2019年8月19日星期一 UTC+8下午5時33分27秒寫道:
> PyCharm takes you to the source code within the editor for any
> variables/functions/classes/modules if you ctrl+click on what you want to
> see. It allows you to browse the relevant bits of code quickly, as well as
> let you change them in your local environment if need be.
> 
> That way you don't have to download the source separately, you can just use
> it as a normal dependency.
> 
> But if you want to view the source of a project in isolation I imagine any
> common editor will suffice. Personally I'll tend to look where the source
> is hosted (GitHub, GitLab etc) instead of downloading it. But I can
> understand why some may not trust this.
> 
> On Mon, 19 Aug 2019, 10:17 ,  wrote:
> 
> > I like to download one package's source and study it in an editor. It
> > allows me to open the whole package as a project and let me jump from a
> > reference in one file to its definition in another file back and forth. It
> > will be even better if it can handle the import modules too. (Maybe this is
> > too much:-)
> >
> > Can anyone recommend such a tool?
> >
> > --Jach
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >

There is a free community version of PyCharm. Will it support the 
cross-reference of viewing different files in different subdirectory? and what 
Windows versions it requires? 

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


Re: My pseudocode to Python?

2019-08-19 Thread Alan Bawden
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> for i in range( len( list )- 1, 0, -1 ):
> if list[ i ]is None: del list[ i ]

list = [x for x in list if x is not None]

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


Re: My pseudocode to Python?

2019-08-19 Thread Alan Bawden
Alan Bawden  writes:

> r...@zedat.fu-berlin.de (Stefan Ram) writes:
> > for i in range( len( list )- 1, 0, -1 ):
> > if list[ i ]is None: del list[ i ]
> 
> list = [x for x in list if x is not None]

Except 'list' is a bad name to use...

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


Re: My pseudocode to Python?

2019-08-19 Thread Kyle Stanley
> Except 'list' is a bad name to use...

Definitely, it's not a good practice to use any reserved names, especially
built-in ones. A pretty common substitute I've seen is "ls", but it would
be preferable to have something more descriptive of the elements within the
list. But, for basic examples, "ls" should be fine.

On Mon, Aug 19, 2019 at 11:35 PM Alan Bawden  wrote:

> Alan Bawden  writes:
>
> > r...@zedat.fu-berlin.de (Stefan Ram) writes:
> > > for i in range( len( list )- 1, 0, -1 ):
> > > if list[ i ]is None: del list[ i ]
> >
> > list = [x for x in list if x is not None]
>
> Except 'list' is a bad name to use...
>
> --
> Alan Bawden
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which editor is suited for view a python package's source?

2019-08-19 Thread Nick Sarbicki
Yes the community edition works fine.

It seems to require a 64 bit version of Windows 7 or higher (I'm not sure
as I haven't used Windows in years).

On Tue, 20 Aug 2019, 03:27 ,  wrote:

> Nick Sarbicki於 2019年8月19日星期一 UTC+8下午5時33分27秒寫道:
> > PyCharm takes you to the source code within the editor for any
> > variables/functions/classes/modules if you ctrl+click on what you want to
> > see. It allows you to browse the relevant bits of code quickly, as well
> as
> > let you change them in your local environment if need be.
> >
> > That way you don't have to download the source separately, you can just
> use
> > it as a normal dependency.
> >
> > But if you want to view the source of a project in isolation I imagine
> any
> > common editor will suffice. Personally I'll tend to look where the source
> > is hosted (GitHub, GitLab etc) instead of downloading it. But I can
> > understand why some may not trust this.
> >
> > On Mon, 19 Aug 2019, 10:17 ,  wrote:
> >
> > > I like to download one package's source and study it in an editor. It
> > > allows me to open the whole package as a project and let me jump from a
> > > reference in one file to its definition in another file back and
> forth. It
> > > will be even better if it can handle the import modules too. (Maybe
> this is
> > > too much:-)
> > >
> > > Can anyone recommend such a tool?
> > >
> > > --Jach
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
>
> There is a free community version of PyCharm. Will it support the
> cross-reference of viewing different files in different subdirectory? and
> what Windows versions it requires?
>
> --Jach
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list