Re: tempname.mktemp functionality deprecation

2017-05-01 Thread eryk sun
On Sat, Apr 29, 2017 at 6:45 PM, Tim Chase
 wrote:
> Working on some deduplication code, I want do my my best at
> performing an atomic re-hard-linking atop an existing file, akin to
> "ln -f source.txt dest.txt"
>
> However, when I issue
>
>   os.link("source.txt", "dest.txt")
>
> it fails with an OSError (EEXISTS).  This isn't surprising as it's
> documented.  Unfortunately, os.link doesn't support something like
>
>   os.link("source.txt", "dest.txt", force=True)

FYI, on Windows this is possible if you use the NTAPI functions
NtOpenFile and NtSetInformationFile instead of WinAPI CreateHardLink.
Using the NT API can also support src_dir_fd, dst_dir_fd, and
follow_symlinks=True [1]. I have a prototype that uses ctypes. I named
this parameter "replace_existing". It's atomic, but it will fail if
the destination is open. An open file can't be unlinked on Windows.

[1]: MSDN claims that "if the path points to a symbolic link, the function
 [CreateHardLink] creates a hard link to the target". Unless I'm
 misreading, this statement is wrong because it actually links to the
 symlink, i.e. the reparse point.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MCOW package

2017-05-01 Thread Metallicow
On Sunday, April 30, 2017 at 10:47:44 PM UTC-5, Steve D'Aprano wrote:
> On Mon, 1 May 2017 01:01 pm, Metallicow wrote:
> 
> > I finally uploaded my wx/lib/mcow package.
> > It has many widgets and mixins and probably more to come.
> 
> Congratulations! What does it do?
> 
> 
> 
> 
> -- 
> Steve
> Emoji: a small, fuzzy, indistinct picture used to replace a clear and
> perfectly comprehensible word.

It is a wx/lib/mcow package of widgets and mixins for wxPython.

ShapedBitmapButtons/ThreeWaySplitter/Animations/SmartHighlighting/etc...
-- 
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2017: Talk voting is open

2017-05-01 Thread M.-A. Lemburg
At EuroPython, we let our attendees have a significant say in the
selection of the sessions which are presented at the conference.

We call this "talk voting" - attendees can tell us which submitted
talks they’d like to see at the conference.

To be eligible to vote for talks, you need to be a registered attendee
of the current EuroPython, or attendee of the past two EuroPython
conferences.


How talk voting works
-

Please log in and proceed to

 * https://ep2017.europython.eu/en/speakers/talk-voting/

to vote for talks.

The talk voting page lists all submitted proposals, including talks,
trainings and posters.

At the top of the page you find a few filters you can use to narrow
down the list by e.g. selecting tags you’re interested in or only show
one type of proposal and also to select the sorting order.

For each submission, you can find the talk title with a link to the
talk page.

In order to vote, have a look at the title/abstract and then indicate
your personal interest in attending this session. We have simplified
the voting process and you may chose between these four options:
- must see
- want to see
- maybe
- not interested

If you have questions about the talk, you can go to the talk page and
enter a comment.

Note that your votes are automatically saved to the backend without
the need to click on a save or submit button.


Talk selection
--

After the talk voting phase, the EuroPython Program Workgroup (WG)
will use the votes to select the talks and build a schedule.

The majority of the talks will be chosen based on the talk voting
results. Part of the available slots will be directly assigned by the
Program WG based on editorial criteria to e.g. increase diversity or
give a chance to less mainstream topics.

In general, the Program WG will try to give as many speakers a chance
to talk as possible. If speakers have submitted multiple talks, the
one with the highest rate will most likely get selected.


Enjoy,
--
EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/

PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/859021545066430464
Thanks.

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


I have a encountered a new problem.

2017-05-01 Thread SUMIT SUMAN
I have encountered a problem while opening the Python 3.6.1 IDLE


The error message is this-

[image: Inline image 1]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Array column separations for beginners

2017-05-01 Thread katarin . bern
Hi again,

I am trying to subtract the minimum value from all numbers (in one array). I am 
using this:


(array[:,1] -= np.min(array[:,1])   but I alsways have syntaxerror:invalid 
syntax. Do I need some import for this -=? or its something else? THanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Array column separations for beginners

2017-05-01 Thread Peter Otten
[email protected] wrote:

> Hi again,
> 
> I am trying to subtract the minimum value from all numbers (in one array).
> I am using this:
> 
> 
> (array[:,1] -= np.min(array[:,1])   but I alsways have syntaxerror:invalid
> syntax. Do I need some import for this -=? or its something else? THanks!

The name np is probably a reference to numpy, so you need an import for it:

import numpy as np

However, when you forget the above import you will get a NameError like

>>> np
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'np' is not defined

whereas a SyntaxError indicates that your code is not valid Python. The 
problem are the surrounding parentheses. A simple example:

>>> x = 42

Wrong:

>>> (x -= 1)
  File "", line 1
(x -= 1)
^
SyntaxError: invalid syntax

Correct:

>>> x -= 1
>>> x
41



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


Re: Array column separations for beginners

2017-05-01 Thread Rob Gaddi

On 05/01/2017 08:14 AM, [email protected] wrote:

Hi again,

I am trying to subtract the minimum value from all numbers (in one array). I am 
using this:


(array[:,1] -= np.min(array[:,1])   but I alsways have syntaxerror:invalid 
syntax. Do I need some import for this -=? or its something else? THanks!



Get rid of the leading (.

--
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: Array column separations for beginners

2017-05-01 Thread katarin . bern
Thanks very much, it was pretty easy and now it works :) 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I have a encountered a new problem.

2017-05-01 Thread Joel Goldstick
On Mon, May 1, 2017 at 7:19 AM, SUMIT SUMAN  wrote:
> I have encountered a problem while opening the Python 3.6.1 IDLE
>
>
> The error message is this-
>
> [image: Inline image 1]
> --
> https://mail.python.org/mailman/listinfo/python-list

you need to cut and paste the traceback -- most people (all?) won't
see the image you added here

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Convert text file data into RDF format through the Python

2017-05-01 Thread Peter Pearson
On Sat, 29 Apr 2017 10:06:12 -0700 (PDT), marsh  wrote:
> Hi, 
>
> I would like to ask how can I convert text file data into RDF fromat.
[snip]

What is RDF format?

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Convert text file data into RDF format through the Python

2017-05-01 Thread Grant Edwards
On 2017-05-01, Peter Pearson  wrote:
> On Sat, 29 Apr 2017 10:06:12 -0700 (PDT), marsh  
> wrote:
>> Hi, 
>>
>> I would like to ask how can I convert text file data into RDF fromat.
> [snip]
>
> What is RDF format?

https://en.wikipedia.org/wiki/Resource_Description_Framework


-- 
Grant Edwards   grant.b.edwardsYow! The FALAFEL SANDWICH
  at   lands on my HEAD and I
  gmail.combecome a VEGETARIAN ...

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


Re: tempname.mktemp functionality deprecation

2017-05-01 Thread Tim Chase
On 2017-05-01 18:40, Gregory Ewing wrote:
> The following function should be immune to race conditions
> and doesn't use mktemp.
> 
> def templink(destpath):
>  """Create a hard link to the given file with a unique name.
>  Returns the name of the link."""
>  pid = os.getpid()
>  i = 1
>  while True:
>  linkpath = "%s-%s-%s" % (destpath, pid, i)
>  try:
>  os.link(destpath, linkpath)
>  except FileExistsError:
>  i += 1
>  else:
>  break
>  return linkpath

Ah, this is a good alternative and solves the problem at hand.

As a side-note, apparently os.rename() is only atomic on *nix
systems, but not on Windows.  For the time being, I'm okay with that.

Thanks for your assistance!

-tkc

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


Re: Rosetta: Sequence of non-squares

2017-05-01 Thread jladasky
On Monday, May 1, 2017 at 11:27:01 AM UTC-7, Robert L. wrote:
[no Python]

Do you ever plan to ask any questions about Python?  Or are you just using a 
few lines of code as a fig leaf for the race baiting that you post in your 
signatures?
-- 
https://mail.python.org/mailman/listinfo/python-list


Help Please ! Undocumented ERROR message so dont know how to fix the problem

2017-05-01 Thread murdock
I am having a problem that seems to persist. I have written a program that 
makes a mathematical calculation and uses a uses library that I have written. 
It had been working but somehow in playing around with it, it stoppedgo 
figure!  But here is the thing, when I run the program it gives me a very 
ambiguous message with only a string as in:

"The Receiver Noise Figure =
dBm"  

now the program is being run under PyScripter 

Function is called "Hamath" and has many functions in it but the one in 
question is:


def _Noise_Figure(BW,Signal_to_Noise,RX_Sensitivity):
''' calculates the noise figure of a receiver '''
#import math

return (174 + RX_Sensitivity - (10*log10(BW)) - Signal_to_Noise)

#

and the program that exercises that function is:

import Hamath
import math

def main():
#import math

BW = float (input ("Enter the Receiver Bandwidth in Hz"))
Signal_to_Noise = float (input ("Enter the Signal to Noise in dB"))
RX_Sensitivity = float (input ("Enter the RX_Sensitivity in dBm"))
#
print ("The Receiver Noise Figure = ",Hamath._Noise_Figure," dBm" )
if __name__ == '__main__':
main()

I am told that the error message is NOT an PyScripter error but in fact a 
Python message. But I can not find it anywhere in any of the documentation 
hence I have not been able to fix my problem.  

Any help would be appreciated.

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


Re: Help Please ! Undocumented ERROR message so dont know how to fix the problem

2017-05-01 Thread Michael Torrie
On 05/01/2017 08:57 PM, murdock wrote:
> I am having a problem that seems to persist. I have written a program that 
> makes a mathematical calculation and uses a uses library that I have written. 
> It had been working but somehow in playing around with it, it stoppedgo 
> figure!  But here is the thing, when I run the program it gives me a very 
> ambiguous message with only a string as in:
> 
> "The Receiver Noise Figure =
> dBm"  

> import Hamath
> import math
>
> def main():
> #import math
>
> BW = float (input ("Enter the Receiver Bandwidth in Hz"))
> Signal_to_Noise = float (input ("Enter the Signal to Noise in dB"))
> RX_Sensitivity = float (input ("Enter the RX_Sensitivity in dBm"))
> #
> print ("The Receiver Noise Figure = ",Hamath._Noise_Figure," dBm" )
> if __name__ == '__main__':
> main()

Hamaht._Noise_Figure is a function.  In fact you said so yourself.  But
you're not calling it, nor is your code doing anything with the RW and
Signal_to_Noise variables.

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


Re: Help Please ! Undocumented ERROR message so dont know how to fix the problem

2017-05-01 Thread Gregory Ewing

murdock wrote:

BW = float (input ("Enter the Receiver Bandwidth in Hz"))
Signal_to_Noise = float (input ("Enter the Signal to Noise in dB"))
RX_Sensitivity = float (input ("Enter the RX_Sensitivity in dBm"))
#
print ("The Receiver Noise Figure = ",Hamath._Noise_Figure," dBm" )


I'm guessing you intend the three values you calculate to be
passed as parameters to the function:

   print("The Receiver Noise Figure = ", Hamath._Noise_Figure(BW, 
Signal_to_Noise, RX_Sensitivity), " dBm")


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