Re: Need to 'import gtk' on Ubuntu 20.04, what do I need?

2020-07-27 Thread Chris Green
Liste guru  wrote:
> Il 24/07/2020 10:31, Chris Green ha scritto:
> 
> 
>    ...
> 
> > I'm a *fairly* competant Python programmer so, if I have to, I 
> > willconsider converting from using the gtk module to using the gi 
> > module,are there any good tutorials which might help me down this road?
> 
> 
>    If you look at the pygobject documentation there is a chapter (and a 
> script, similar to 2to3) to help the migration: 
> https://pygobject.readthedocs.io/en/latest/guide/porting.html
> 
Thanks, it looks as if this is the way I will have to go.

I guess converting to Python 3 and pygobject (for 3) will be a 'good
thing' in the long run and it will mean I will become familiar enough
with the software to keep maintaining it easily (and even fix some
annoying quirks).

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Symlinks already present

2020-07-27 Thread Termoregolato

Il 26/07/20 20:39, Dennis Lee Bieber ha scritto:


Since symbolic links are essentially just short files containing the
path to the eventual target file/directory, with an OS flag that the file
is a link


Yes, I use them massively to give to a lot of directories a kind of 
order, depending on their contents. It's simple to see if link is 
broken, but not if they're duplicate


--
Pastrano
   con un altro account
--
https://mail.python.org/mailman/listinfo/python-list


Re: Symlinks already present

2020-07-27 Thread Chris Angelico
On Tue, Jul 28, 2020 at 4:26 AM Termoregolato  wrote:
>
> Il 26/07/20 20:39, Dennis Lee Bieber ha scritto:
>
> > Since symbolic links are essentially just short files containing the
> > path to the eventual target file/directory, with an OS flag that the file
> > is a link
>
> Yes, I use them massively to give to a lot of directories a kind of
> order, depending on their contents. It's simple to see if link is
> broken, but not if they're duplicate
>

Ah, I think I get what you're doing.

Do you need an efficient way to see if a single target directory has
multiple symlinks pointing to it, or are you trying to audit the
entire collection all at once? I don't think there's a neat way to do
the former, but the latter isn't too hard. Try something like this:

# Enumerate the target directories (the real/physical ones)
dirs = {dir: None for dir in os.listdir("")}

# Iterate over the symlinks and see where they point
for link in os.listdir(""):
dest = os.readlink(link)
if dirs[dest]:
print("DUPLICATE")
print(dirs[dest], link)
dirs[dest] = link

You can then also check if any are missing, by seeing if there are any
Nones left in the dirs dict.

Unfortunately there's no real way to shortcut this if you just want to
check one target directory. You'd still have to readlink() every
symlink to try to find them.

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


Re: Symlinks already present

2020-07-27 Thread 2QdxY4RzWzUUiLuE
On 2020-07-27 at 20:20:08 +0200,
Termoregolato  wrote:

> Il 26/07/20 20:39, Dennis Lee Bieber ha scritto:
> 
> > Since symbolic links are essentially just short files containing the
> > path to the eventual target file/directory, with an OS flag that the file
> > is a link
> 
> Yes, I use them massively to give to a lot of directories a kind of order,
> depending on their contents. It's simple to see if link is broken, but not
> if they're duplicate

If you know where the symlinks can be, then find and collect them into a
dictionary whose keys are the *targets* and whose values are a list of
the symlinks that point to that target.  Then it's easy to spot the
targets that have more than one symlink.

-- 
“Whoever undertakes to set himself up as a
judge of Truth and Knowledge is shipwrecked
by the laughter of the gods.” – Albert Einstein
Dan Sommers, http://www.tombstonezero.net/dan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Symlinks already present

2020-07-27 Thread Termoregolato

Il 26/07/20 22:47, dn ha scritto:


Thus, compare the results of the two calls to detect a difference.


I will try also another way, If I don't err symlinks and original 
directory  have the same inode number (I talk about Linux, where I'm 
using the application). I've a lot of directories like this


abcd efgh .ab dc de

where last part can change depending on contents. The are symlinked in a 
tree of a different dir, divided in many other directories, like


work/a/abcd efgh .ab dc de

where generally there are 5-50 links. So I could, if correct, walk the 
directory, and keeping a small array with the inode numbers check if 
these numbers are duplicated.


--
Pastrano
   con un altro account
--
https://mail.python.org/mailman/listinfo/python-list


Very Simple (Rather Dumb) Question

2020-07-27 Thread Romulus Schilling via Python-list
Hello, I have a quick, and most likely rather dumb begginer question on Python.
It may be simple, but I'm completely new to Python, and to programming in
general, so I'll go right to the point.
My question is: I just downloaded the latest version of python, and started
following a tutorial I found online on "first steps with Python Programming."
The thing is, in the very first part, where I just had to write "print("Hello
World")" into IDLE and then save the file to my desktop and execute it, I ran
into a problem. When I saved the file with helloworld.py, the file that popped
up into my desktop was a uTorrent file for some reason (I have uTorrent
installed), even though I saved it with the right format for a Python file (I've
added photos below). I searched online for explanations but found nothing (maybe
because, again, its a very stupid question). Anyway, I was wondering if someone
could help me in fixing this. (and yes, I've already tried unistalling and
reinstalling python, and uTorrent, to no avail)
thx for the 
attention[https://api.criptext.com/email/open/%3C1595885704865.954141%40criptext.com%3E]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Dowloading package dependencies from locked down machine

2020-07-27 Thread Andrew McLean

On 26/07/2020 14:07, Mike Dewhirst wrote:
I think your best bet is to make a formal business case to your IT 
people and explain what's in it for them. If they hold all the cards 
you defeat them at your peril.


The issue is that the IT department thinks that installing the full 
power of Python scripting on an Internet facing machine is inconsistent 
with the "Cyber Essentials Plus" accreditiation that they need to win 
Government contracts. I'm trying to come up with an alternative that 
would be acceptable to them, I'm not going behind their backs.


I wonder, would it be possible to create a standalone executable version 
of pip with py2exe or similar?


- Andrew


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


Re: Symlinks already present

2020-07-27 Thread Grant Edwards
On 2020-07-27, Termoregolato  wrote:
> Il 26/07/20 22:47, dn ha scritto:
>
>> Thus, compare the results of the two calls to detect a difference.
>
> I will try also another way, If I don't err symlinks and original 
> directory  have the same inode number (I talk about Linux, where I'm 
> using the application).

You err.  Symlinks are distinct i-nodes which are not the same i-node
as the destination.  A symlink is basically a file containing a string
that is read and then used a path to another file.

If you create a "hard" link (ln without the '-s') then you end up a single 
i-node that has entries in multiple directories.

[old-Unix-guy story: Way back when, SunOS used to allow you (if root)
to create a hard link to a directory.  It's not something you did a
second time.]





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


Re: Dowloading package dependencies from locked down machine

2020-07-27 Thread Mike Dewhirst
On 28/07/2020 9:43 am, Andrew McLean wrote:
> On 26/07/2020 14:07, Mike Dewhirst wrote:
>> I think your best bet is to make a formal business case to your IT
>> people and explain what's in it for them. If they hold all the cards
>> you defeat them at your peril.
>
> The issue is that the IT department thinks that installing the full
> power of Python scripting on an Internet facing machine is
> inconsistent with the "Cyber Essentials Plus" accreditiation that they
> need to win Government contracts. 

If that is the issue you need to change their thinking. You need to
persuade them first that "Cyber Essentials Plus" accreditation is not
necessary to win government contracts -OR- that replacing vb with python
will (perhaps) enhance it to "Plus Plus"

> I'm trying to come up with an alternative that would be acceptable to
> them, I'm not going behind their backs.

They could unlock your machine in a wink if you can successfully argue a
compelling case.

>
> I wonder, would it be possible to create a standalone executable
> version of pip with py2exe or similar?

It might be possible. I don't know. I think however it would be
unnecessary if you win your case.

The hard facts are that IT people are usually overloaded and
under-resourced. Anything out of the ordinary is a severe burden. Not
only do they have to start catering for individual differences they have
to be able to justify their decisions to management *before* anything
goes wrong. Because if it did go wrong and they hadn't run it past the
boss they would be looking (with a "loose cannon" blot on their CV) for
another employer.

May the case be with you!

Mike

>
> - Andrew
>
>



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Dowloading package dependencies from locked down machine

2020-07-27 Thread Igor Korot
Hi,

On Mon, Jul 27, 2020 at 6:46 PM Andrew McLean  wrote:
>
> On 26/07/2020 14:07, Mike Dewhirst wrote:
> > I think your best bet is to make a formal business case to your IT
> > people and explain what's in it for them. If they hold all the cards
> > you defeat them at your peril.
>
> The issue is that the IT department thinks that installing the full
> power of Python scripting on an Internet facing machine is inconsistent
> with the "Cyber Essentials Plus" accreditiation that they need to win
> Government contracts. I'm trying to come up with an alternative that
> would be acceptable to them, I'm not going behind their backs.
>
> I wonder, would it be possible to create a standalone executable version
> of pip with py2exe or similar?

Coming from experience working with the Government Contractor first hand,
they have to have an approved list of software people can work with.

Ask to provide that list.
Now such a list is provided by the Security Office and it does not
come from the IT department.

You can actually go and check this list yourself. Check with your company
FSO.

I can assure you python will definitely be on that list.
Its possible that some python modules may not be there but the
language/interpreter will.

Thank you.

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