Code Monkey home page Code Monkey logo

Comments (10)

fschrempf avatar fschrempf commented on September 2, 2024 1

@fschrempf do I remember correctly that this was your part of the code? Do you have time to look into this bug report?

No, I never used or touched file_upload() so far.

from churchtoolsapi.

bensteUEM avatar bensteUEM commented on September 2, 2024

@fschrempf do I remember correctly that this was your part of the code? Do you have time to look into this bug report?

from churchtoolsapi.

bensteUEM avatar bensteUEM commented on September 2, 2024

@jannesjust - i could not reproduce your described behavior.

Not only do we already have songs like "Macht hoch die Tür" on our system, i did also add a test case which specifically checks a test file with Umlaut.

Are you sure you're using the song_arrangement_id and not the song_id to upload you attachment?
I've updated a docstring to strongly point out this difference ... 53c0de0#diff-026cdb0bee0effb8f5d2b4e8d06983b2fbab48b868670644ea2d0e12ce8c153cR28

If this wasn't the cause i'd need more information.

  • Does it work with other filenames on your configuration?
  • What specific filename did you try?
  • Which ChurchTools instance are you testing against?

from churchtoolsapi.

jannesjust avatar jannesjust commented on September 2, 2024

Thanks for your quick testing and reply.

  • Yes I am using the song_arrangement_id and not the song id. I have a folder containg around 150 files. All of them are uploaded correctly, but files with umlauts or special characters do not upload.

  • The first failed filename was "011. Man erzählte mir froh". It is a pdf file. I've also tried to use the custom_file_name and upload the file with a different name, it works, but I would not like to change the file name.

  • I've tried your mentioned filename and that does not upload neither.

  • We are on ChurchTools v3.103.0

That's my code:

def initial_file_upload(api, category):
    
    cwd = os.getcwd()
    os.chdir(cwd +"/Lieder/3.Chor")

    songs = api.get_songs()

    for song in songs:
        if song['category']['id'] == category:
            
            name = f'{song["name"]}.pdf'
            arrangement = song['arrangements'][0]['id']

            if api.file_upload(name, 'song_arrangement', arrangement, overwrite = True) == True:
                logging.info(name + " hochgeladen")
            else:
                logging.info(name + " fehlgeschlagen")
            time.sleep(1)

from churchtoolsapi.

bensteUEM avatar bensteUEM commented on September 2, 2024

I'd rather suspect the use of you . might be a problem. I'll have to look into the code again though...

If that's not the issue

  • what OS are you running on (I suppose Windows? I'm testing on Linux...
  • what's the filesize?
  • does the file upload using the regular swagger API?
  • check if . In filename might cause issues
  • check if pdf is still allowed
  • check maximum filesize

from churchtoolsapi.

bensteUEM avatar bensteUEM commented on September 2, 2024

One more idea ... my test runs with overwrite = False as default.
Can you try to upload without overwrite and let me know if the issue persists?

from churchtoolsapi.

jannesjust avatar jannesjust commented on September 2, 2024
  • Yes I am using Windows.

  • Filesize is around 1 MByte. I can upload the exact same file using the custom_file_name attribute. That means, that the file is available on my computer and can be read

  • The . in the filename does not cause problems. Every filename I was uploading had . in it

  • First I also tried it without the overwrite option, that also did not work

When I upload the file via the webbroser in ChurchTools by hand, it works and the Umlaut is showing correctly

from churchtoolsapi.

jannesjust avatar jannesjust commented on September 2, 2024

After some testing on other machines and updating everything, I found the issue. Previously I used Python version 3.7.4 which did not work. After updating to 3.12.0 it finally works. Thanks for your support.

from churchtoolsapi.

bensteUEM avatar bensteUEM commented on September 2, 2024

Thanks for the update.
Would you mind trying again with Python 3.8 as specified in the requirements?

[tool.poetry.dependencies]
python = "^3.8"

If it does work with 3.8 i'd keep everything as is, but if you require 3.9, 3.10 or newer I'd have to update the requirements :)
It looks like my venv is currently using 3.11 ...

from churchtoolsapi.

jannesjust avatar jannesjust commented on September 2, 2024

Yes, it also works with 3.8

from churchtoolsapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.