Beat_Slayer 17 Posting Pro in Training

For your example you open python command-line and type.

cxfreeze hello.py --target-dir dist

as it is on the documentation, your hello.py its a normal python script, without no imports or references to cx_freeze.

Beat_Slayer 17 Posting Pro in Training

Have you tried withou using the ie.PollWhileBusy() calls?

Every example I saw doesn't use it, like the example in the module documentation:

import IEC

ie = IEC.IEController()                # Creates a new IE Window
ie.Navigate('http://www.google.com/')  # Navigate to a website.
html = ie.GetDocumentHTML()            # Get the HTML

and it also says that:

PollWhileBusy(self):

This method is mostly used by other methods in the class, but is made
public, in case a user needs it. This method polls the Internet
Explorer instance and returns if IE is NOT busy doing anything.

Beat_Slayer 17 Posting Pro in Training

Assuming you have a script called hello.py which you want to turn into an executable, this can be accomplished by this command:

cxfreeze hello.py --target-dir dist

Source

You must run the cx_freeze script to modify your script, you don't include or import cx_freeze on your scripts.

The info you misunderstood, is to make distutils setup scripts with cx_freeze.

Beat_Slayer 17 Posting Pro in Training
Beat_Slayer 17 Posting Pro in Training
Beat_Slayer 17 Posting Pro in Training

Something like this can do it also:

overwrite = None

print w.fill('WIP will create Backup, Resized and Watermarked folders to store the original, resized and watermarked pictures. It will overwrite them if they already exists. Are you sure you want to continue (y/n)?')
While overwrite.lower() != 'n' and overwrite.lower() != 'y':
    overwrite = raw_input('> ')
if overwrite == 'y':
    #Create a Backup directory
    if not os.path.exists('Backup'):
        os.mkdir('Backup')
    
    #Create a Resized directory
    if not os.path.exists('Resized'):
        os.mkdir('Resized')
    
    #Create a marked directory
    if not os.path.exists('Watermarked'):
        os.mkdir('Watermarked')
elif overwrite == 'n':
    print 'Thank you for using WIP'
    sys.exit()
Beat_Slayer 17 Posting Pro in Training

Thanks for the words tonyjv.

And btw, I have no solution posted on mastermind.

Beat_Slayer 17 Posting Pro in Training

This checks if the path exists, and if don't it creates it. More info.

if not os.path.exists('Backup'):
    os.mkdir('Backup')
Beat_Slayer 17 Posting Pro in Training

I'm sorry if you take it personnaly vegaseat, I really didn't mean it.

I just see lost of my posts harshly commented, and decided to let it out, only that.

Congrats

Beat_Slayer 17 Posting Pro in Training

Hi MrAlshahawy,

some commands are available on the FP1 API's the others only on the FP2 API's, but thats again only on Symbian C++.

I'll give a try on the sending and receiving on the same device using the btsocket, but it depends a lot on what youre tryning to achieve, and how you pass them to the system.

Cumps

Beat_Slayer 17 Posting Pro in Training

Dont forget to select your code and press (CODE) next time.

And do you have a sample file, becasue this normally works.

import csv

for row in csv.reader(open('mesaure.csv')):
    print row
Beat_Slayer 17 Posting Pro in Training

Come on guys you are arsh with each others.

I said that as info vegaseat, nothing more.

I said that because he had made like that and succeded, so he already have done mantining proportions, I said that so it was easier for him to see that this is without.

I don't understand, why the people here is so difficult with each others, I really like this forum, but i think that the people should keep their minds on sharing knowledge and trying to help.

And I'm not arguing against you vegaseat, I hope you understand me.

I'm just a coder wanting to share some knowledge, and to learn a lot with the great coders that go on this forums.

Happy coding!!!

EDIT: And sorry it this is off-topic or something like that.

Beat_Slayer 17 Posting Pro in Training

That won't keep proportions.

Beat_Slayer 17 Posting Pro in Training

You can create semaphores and work with locks.

To me, if you tried all those possibilities. I think you just messing something.

Beat_Slayer 17 Posting Pro in Training

You can if you calculate the factor of the resize, and use it to calculate the other dimension.

I think thats the only solution.

Beat_Slayer 17 Posting Pro in Training

Can you explain what you mean with

I'm trying to do pretty much the same thing

It's exactly the same code?

Is it some adjusted version? Where is it?

Can you post a logfile example?
More info please.

Happy coding!!

:D

Beat_Slayer 17 Posting Pro in Training

I also thought of that, but that's what he asks.

Beat_Slayer 17 Posting Pro in Training

Nice one vegaseat.

Thanks for the share.

Beat_Slayer 17 Posting Pro in Training

About the cycle.

countries = open('languages/country.lang', 'r').readlines()
for i in range (0, len(countries):
    vars()['A%s' % i + 1] = countries[i]
Beat_Slayer 17 Posting Pro in Training

Quick Fix

from sys import path
path.append('path_to_files')
Beat_Slayer 17 Posting Pro in Training

You should take a look at the sys module.

Beat_Slayer 17 Posting Pro in Training

For me it seems like it's working.

Beat_Slayer 17 Posting Pro in Training

You should take a look at the subprocess module.

Beat_Slayer 17 Posting Pro in Training

Because of this line:

bin=2

it should be something like:

bin_n = bin(2)
r = bin_n ** n_input
Beat_Slayer 17 Posting Pro in Training

Can you explain better or give some code?

Beat_Slayer 17 Posting Pro in Training

And something like:

newdata = data.replace("\\r\\n", "")
Beat_Slayer 17 Posting Pro in Training

This should do it. Yhere could be some tweaks depending on the data input.

proteins = open('protein.txt').readlines()
clusters = open('cluster.txt').readlines()

for protein in proteins:
    proteinid, geneid = protein.split(' ')
    geneid = geneid.rstrip('\n')
    for cluster in clusters:
        clusterid, genes = cluster.split(':')
        genes = genes.rstrip('\n')
        geneids = []
        geneids += genes.split(',')
        geneids = [x.lstrip() for x in geneids]
        if geneid in geneids:
            print protein.rstrip('\n')
            print cluster.rstrip('\n')
            print
Beat_Slayer 17 Posting Pro in Training

You should revisit your install and see what went wrong there, I never work on Mac, but this will make a fix.

A slightly less convenient way is to edit the site.py file in Python’s standard library, and modify sys.path. site.py is automatically imported when the Python interpreter is executed, unless the -S switch is supplied to suppress this behaviour. So you could simply edit site.py and add two lines to it:

import sys
sys.path.append('PATH_TO_MODULES')

Resource

Not the doc I was searching but it serves your needs.

Beat_Slayer 17 Posting Pro in Training

Error message or something like that?

Beat_Slayer 17 Posting Pro in Training

you can search for the modules in the file search. It seems like a path problem.

Beat_Slayer 17 Posting Pro in Training

I don't know much about OOP. But shouldn't it be like that.

And about the replace, can you post the error message???

import csv

class MyDialect(csv.excel): 
    self.lineterminator = "\n"  #  here
csv.register_dialect("myDialect", MyDialect) 

cr = csv.reader(open("data.csv","rb"), dialect = "myDialect")
cw = csv.writer(open("clean_data.csv", "wb"))
crlf = '\r\n'
for row in cr:
    for col in row:
        if crlf in col:
            #col.replace("\r\n", "") <-- didn't work
            col = col.rstrip()
    cw.writerow(row)
    
print "Finished"
Beat_Slayer 17 Posting Pro in Training

And how are those clusters. I see that you want to search for the value on the fisrt column of the first file, I just don't know what would be a valid match on the second one.

A cluster that doesn't have some values, tat has some values uin some order....

What?

Beat_Slayer 17 Posting Pro in Training

and wheres the code of that part where you type a folder name to see it's contents.

Beat_Slayer 17 Posting Pro in Training

Extracting the number at the end of a data string is fairly simple ...

data = """\
No of records Date Status
1 7/7/2010 Progress
Total Number of records Processed so far: 1012
Currently active records: 1"""

# split into a list of words and take the final element
active_records = data.split()[-1]
print(active_records)  # 1

Nice, looks like I wasn't lazy enough.

Nice line Vegas.

Beat_Slayer 17 Posting Pro in Training

Lazy simple mode.

f_in = open('output.txt').readlines()

for line in f_in:
    if 'Currently active records' in line:
        _, _, _, active_records = line.split(' ')
        print active_records
Beat_Slayer 17 Posting Pro in Training

list of int

list3 = [[int(x) for x in y] for y in list2]
Beat_Slayer 17 Posting Pro in Training

Hi, I've been messing around, and seems that only on Symbian C++.

You can send USSD AT commands on FP1, but not all of them.

The solution would be with a scriptext for that API.

Beat_Slayer 17 Posting Pro in Training

I was doing a litle research now, and I think there may be a way around.

I'll do a litle more reading and research when I'm back home, and post later it later.

:D

Beat_Slayer 17 Posting Pro in Training

Theres no module for python.

It's quite like this, best to go with Symbian C++, and yes only for FP2.

Or you can write a scriptext for that API, but it would still work on FP2, and it's quite some code.

Happy coding.

Beat_Slayer 17 Posting Pro in Training

It's like this, theres no python module for that, but you can write one using the Symbian C++ SDK API Plug-in package for S60 3rd Edition, Feature Pack 2 wich includes the Phone Client USSD API.

Beat_Slayer 17 Posting Pro in Training

I had a similar task, and i just adapted the nariables, but now I see that the output it's a litle different than i thought.

Sorry.

Beat_Slayer 17 Posting Pro in Training

Here it is.

popdata2 = [x if x > 0.05 else 0 for x in popdata1]
print(popdata2)
Beat_Slayer 17 Posting Pro in Training

You are not saving them, I think you are aware of it, but maybe not, so...

for i in range(int(P)):
    for j in range(int(A)):
        popdata[i][j] = float(popdata[i][j])

Like this youre list stays altered in the end.

Beat_Slayer 17 Posting Pro in Training

Try this. You had unneeded brackets.

for i in range(int(P)):
    for j in range(int(A)):
        float(popdata[i][j])
Beat_Slayer 17 Posting Pro in Training

Like this.

f_in = open('problem.txt').readlines()
f_out = open('code_solution.txt', 'w')

for line in f_in:
    filtered = []
    data = line.rstrip('\n')
    [filtered.append(x) for x in data.split(' ')]
    count, numb1, numb2, name, letter = [x for x in filtered if x != '']

    print count, numb1, numb2, name, letter   # not needed for the file output

    f_out.write('%s  %s\n' % (numb1, numb2))

f_out.close()
Beat_Slayer 17 Posting Pro in Training

He is usinf the mobile facebook address because it asks less information to login, like authentication token and api key.

Beat_Slayer 17 Posting Pro in Training

I really don't get what you trying to do. It seems some esay thing with the data of some file. But I just don't get what.

Sum of numbers, ordering of the numbers, listing the average of the numbers, just listing the numbers...

I really don't know what.

And the CAPS are not needed, I believe the most of the people here is able to read your posts without them.

Beat_Slayer 17 Posting Pro in Training

I have in the past bitter experience of how compatible output the CSV are and wrote my own CSV module in Delphi, so I do think that for more complicated things CSV module must be great (dialects are not there without reason, I can tell you). I only do not know it so well yet, and I like to hold whole program in my mind. I have not used in my own code namedtuple, so thought it good opportunity to learn how to put it in use and same time maybe help somebody else.

P.S. Have a look at collections source code: the code for namedtuple is fine example how expressive Python is. My namedtuple version looks like candidate for code snippet, for me, what do you think?

I was seeing the collections little time ago, I used the deque on other project.

And yes, just post it, I liked it, pretty good.

Beat_Slayer 17 Posting Pro in Training

Theres also a pyhton way of doing it, but ok, iif that serves your needs. :)

Beat_Slayer 17 Posting Pro in Training

Here it is.

idle.py -c whatever.py